[Lift] Re: Creating your own tags?

2009-08-28 Thread Viktor Klang
Tim, if you really want to go that riute create an xslt to transform your
custom tags to luft tags?

On Aug 29, 2009 8:01 AM, "marius d."  wrote:


Tim, obscuring things may get you a really long way indeed. But once
the obscurity get broken and people figure out that they can do other
things by using strange undocumented tags (i.e lift tags) they could
cause lots of problems and side effects.

Personally I'd stay away from it. And if I'd need to create a CMS
templating mechanism with special nodes I'd probably create one
separated from Lift's templating engine as parsing XML in Scala is
pretty easy, and you can safely add CMS content specific semantics
without worrying about anything else. Such templating system would be
nothing more then a transformation between the CMS language to the one
understood by Lift. But that's just me ...

Br's,
Marius

On Aug 29, 2:22 am, "Charles F. Munat"  wrote: > Security by
obscurity, eh? > > Tim...

> > On 28/08/2009 21:47, "marius d."  wrote: > >>>
Hey Marius > > >>> First...

--~--~-~--~~~---~--~~
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: Creating your own tags?

2009-08-28 Thread marius d.

Tim, obscuring things may get you a really long way indeed. But once
the obscurity get broken and people figure out that they can do other
things by using strange undocumented tags (i.e lift tags) they could
cause lots of problems and side effects.

Personally I'd stay away from it. And if I'd need to create a CMS
templating mechanism with special nodes I'd probably create one
separated from Lift's templating engine as parsing XML in Scala is
pretty easy, and you can safely add CMS content specific semantics
without worrying about anything else. Such templating system would be
nothing more then a transformation between the CMS language to the one
understood by Lift. But that's just me ...

Br's,
Marius

On Aug 29, 2:22 am, "Charles F. Munat"  wrote:
> Security by obscurity, eh?
>
> Timothy Perrett wrote:
> > Its not that I want to completely stop the normal lift tag processing, I
> > don't, I just want to make it appear to users as if they are not using
> > lift... That might sound crazy, but essentially I want users to only know
> > about that tags they are told about, rather than having obvious access to
> > all the lift default stuff.
>
> > Yes, ok, they could do some research and dig it out, but in my experience if
> > it is not staring users in the face, only a few of them will go looking any
> > deeper. Does that make any sense what-so-ever?
>
> > Cheers, Tim
>
> > On 28/08/2009 21:47, "marius d."  wrote:
> >>> Hey Marius
>
> >>> Firstly I agree with your thoughts on LiftTagPF - im not sure that
> >>> overriding the default lift tags would ever be a good idea for
> >>> implementing users...
> >> Well I was referring to overwriting (as those would take precedence
> >> over builtin snippets) ... not much of an overriding.
>
> >>> However, I do see a use case, in, for instance
> >>> the CMS arena where having a specialized tagging mechanism would be
> >>> beneficial because you simply wouldn't want to use the default lift
> >>> namespace so that users could just do:
>
> >>> 
>
> >>> All over their template code - you'd want to restrict what users could
> >>> actually do whilst still keeping the templates designer friendly.
> >> Such restrictions could be very tricky to achieve if the CMS template
> >> is processed by Lift engine. Perhaps for specialized CMS templates a
> >> dedicated templating definition and engine is more appropriate in
> >> order to strictly process given tags that define the CMS templating
> >> language?
>
> >>> This is one use case, and in my particular circumstances, I want to
> >>> provide a degree of functionality that is succinctly separate from the
> >>> lift functionality and I don't want the twain to meet (as it were) but
> >>> its important for my purposes at least that the templates still play
> >>> well with tools such as Dreamweaver (just as the lift tags do)
>
> >>> What are your thoughts?
> >> Related to my notes above if you define a set of tags for your CMS
> >> template and you run that against Lift's templating engine how do you
> >> prevent lift specific "tags" to be executed?
--~--~-~--~~~---~--~~
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] MappedStringIndex Odd Behaviour/Problems

2009-08-28 Thread Justin Reardon

Hi,

I've been attempting to use MappedStringIndex in my data model which
is being backed by a Derby database. I'm having two issues with it
though. It does not make the column NOT NULL, so when the mapper
attempts to add the index, it complains with errors like:

'TOKEN' cannot be a column of a primary key or unique key because it
can contain null values.

It also sets itself as being a primary key, which I find to be rather
odd default, which also results in SQL errors if another primary key
is defined if the first problem is resolved.

Currently, I've subclassed MappedStringIndex to fix these problems for
me (below). Is there a more appropriate way to solve my problems or
are these issues with Lift?

class ProperMappedStringIndex[T<:Mapper[T]](override val fieldOwner:
T, override val maxLen: Int) extends MappedStringIndex[T](fieldOwner,
maxLen) {
override def dbPrimaryKey_? = false
override def fieldCreatorString(dbType: DriverType, colName: String):
String = super.fieldCreatorString(dbType, colName) + " NOT NULL "
}


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



[Lift] Re: why match not exhaustive?

2009-08-28 Thread Ross Mellgren

scalac is checking that you have a case for each possible pattern for  
the given value, which it can determine because Box and its subclasses  
are sealed.

In this case, you explicitly handle Full and Empty, but do not  
consider Failure or its subclass ParamFailure, which will cause a  
MatchError at runtime if selectedTag is one of those.

Add a case for Failure, or change your case Empty => to case _ => and  
the warning will probably go away.

-Ross

On Aug 28, 2009, at 11:51 PM, g-man wrote:

>
> I am getting this warning during compile of my ToDo tutorial app
> enhancement:
>
> ToDo.scala:355: warning: match is not exhaustive!
> missing combination   ParamFailure
> missing combination Failure
>  case Nil =>  selectedTag match {
>
> My code is:
>
>currentTask.validate match {
>  case Nil =>  selectedTag match {
>case Full(currentTag) => if (! currentTask.saved_?) {
>  currentTask.save
>  JoinTags.joinTask(currentTag, currentTask)
>  S.notice("added Task: " + currentTask.desc.is)
>}
>case Empty => S.error("..please supply a Tag");
> S.mapSnippet("ToDo.addTask", doTaskBind)
>  }
>  case xs => S.error(xs); S.mapSnippet("ToDo.addTask",
> doTaskBind)
>}
>
> The code runs fine so far... Is it the nested match?
> >


--~--~-~--~~~---~--~~
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] why match not exhaustive?

2009-08-28 Thread g-man

I am getting this warning during compile of my ToDo tutorial app
enhancement:

ToDo.scala:355: warning: match is not exhaustive!
missing combination   ParamFailure
missing combination Failure
  case Nil =>  selectedTag match {

My code is:

currentTask.validate match {
  case Nil =>  selectedTag match {
case Full(currentTag) => if (! currentTask.saved_?) {
  currentTask.save
  JoinTags.joinTask(currentTag, currentTask)
  S.notice("added Task: " + currentTask.desc.is)
}
case Empty => S.error("..please supply a Tag");
S.mapSnippet("ToDo.addTask", doTaskBind)
  }
  case xs => S.error(xs); S.mapSnippet("ToDo.addTask",
doTaskBind)
}

The code runs fine so far... Is it the nested match?
--~--~-~--~~~---~--~~
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] Maven dependency problem with smack jar

2009-08-28 Thread ishiijp

Sorry, It's just my environment problem...
Please Ignore this and before post.

--~--~-~--~~~---~--~~
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: syntax question

2009-08-28 Thread Ross Mellgren

I think you need the "yield" keyword, otherwise the for-loop is acting  
as foreach, not map:

def resultTable(tab: Array[Array[Int]]): NodeSeq =
 {
 for (r <- 0 until tab.length) yield {
 {
 for (c <- 0 until tab(r).length) yield {
 { tab(r)(c).toString }
 }
 }
 }
 }

(I had to squish it on to one line to make scala REPL take it, here's  
the version I used with the REPL:)


scala> val tab = Array.fromFunction((a,b) => a*b)(10,10)
tab: Array[Array[Int]] = Array(Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0),  
Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), Array(0, 2, 4, 6, 8, 10, 12, 14,  
16, 18), Array(0, 3, 6, 9, 12, 15, 18, 21, 24, 27), Array(0, 4, 8, 12,  
16, 20, 24, 28, 32, 36), Array(0, 5, 10, 15, 20, 25, 30, 35, 40, 45),  
Array(0, 6, 12, 18, 24, 30, 36, 42, 48, 54), Array(0, 7, 14, 21, 28,  
35, 42, 49, 56, 63), Array(0, 8, 16, 24...

scala> def resultTable(tab: Array[Array[Int]]): NodeSeq =
  |{ for (r <- 0 until tab.length) yield  
{ { for (c <- 0 until tab(r).length) yield { { tab(r) 
(c).toString } } } } }
resultTable: (Array[Array[Int]])scala.xml.NodeSeq

scala> resultTable(tab)
res6: scala.xml.NodeSeq = 0001234567890246810121416180 def resultTable: NodeSeq  = {
>  
>  {for (r <- 0 until analysis.slots.length) {
>
>{for (c <- 0 until test.testvars.length) {
>  new CellType(calls(r)(c).output)
>}}
>
>  }}
>  
>  }


--~--~-~--~~~---~--~~
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] model existing postgresql database

2009-08-28 Thread Jim Myers

We have an existing PostgreSQL database with many tables, views,
indexes that we'd like to model in Lift. I created a basic model but
it seems to insist on creating an index that isn't needed.

Below is the error followed by the model code.  Note that 'person' is
a view in our database, not a table.

INFO - CREATE INDEX person_person_id ON person ( person_id )
ERROR - Failed to Boot
org.postgresql.util.PSQLException: ERROR: "person" is not a table

package raclift.model

import net.liftweb.mapper._
import net.liftweb.util._

object PersonMetaData extends Person with KeyedMetaMapper[Long, Person]
{
override def dbTableName = "person"
override def fieldOrder = List(person_id, first_name, last_name,
password)
}

class Person extends KeyedMapper[Long, Person] {
  def getSingleton = PersonMetaData
  def primaryKeyField = person_id

  object person_id extends MappedLongIndex(this)
  object first_name extends MappedString(this, 100)
  object last_name extends MappedString(this, 100)
  object password extends MappedText(this)
  def emails = EmailMetaData.findAll(By(EmailMetaData.invisible_id,
person_id))
}

--~--~-~--~~~---~--~~
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] Maven dependency problem with smack jar

2009-08-28 Thread ishiijp

Hi.
I downloaded PocketChange Application referenced in the pdf file
below.
http://build.schuerrer.org/liftbook/master.pdf

But maven say
- Missing artifact org.igniterealtime.smack:smack:jar:3.1.0:compile
- Missing artifact org.igniterealtime.smack:smackx:jar:3.1.0:compile

Which repository has smack-3.1.0.jar and smackx-3.1.0.jar?

Should I install these jars manually?

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 ajaxInvoke on page load?

2009-08-28 Thread David Pollak
On Wed, Aug 26, 2009 at 2:34 PM, harryh  wrote:

>
> Answering my own question:
>
> val (name, exp) = ajaxInvoke(() => { SetHtml(id, xhtml) })
>
> {Script(OnLoad(exp.cmd))}
>
> AFAIK I can just ignore name?


For now.  The name is part of the Lift GC mechanism.  At this time (due to a
bad interaction between Firefox and jQuery), Lift's GC is page-level rather
than being component level.  If/when we move to a component level GC, it
will be important to keep track of the "name" of the ajax function so it
doesn't get GC'ed.


>
>
> -harryh
> >
>


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

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



[Lift] Re: Creating your own tags?

2009-08-28 Thread Charles F. Munat

Security by obscurity, eh?

Timothy Perrett wrote:
> Its not that I want to completely stop the normal lift tag processing, I
> don't, I just want to make it appear to users as if they are not using
> lift... That might sound crazy, but essentially I want users to only know
> about that tags they are told about, rather than having obvious access to
> all the lift default stuff.
> 
> Yes, ok, they could do some research and dig it out, but in my experience if
> it is not staring users in the face, only a few of them will go looking any
> deeper. Does that make any sense what-so-ever?
> 
> Cheers, Tim 
> 
> 
> On 28/08/2009 21:47, "marius d."  wrote:
>>> Hey Marius
>>>
>>> Firstly I agree with your thoughts on LiftTagPF - im not sure that
>>> overriding the default lift tags would ever be a good idea for
>>> implementing users...
>> Well I was referring to overwriting (as those would take precedence
>> over builtin snippets) ... not much of an overriding.
>>
>>> However, I do see a use case, in, for instance
>>> the CMS arena where having a specialized tagging mechanism would be
>>> beneficial because you simply wouldn't want to use the default lift
>>> namespace so that users could just do:
>>>
>>> 
>>>
>>> All over their template code - you'd want to restrict what users could
>>> actually do whilst still keeping the templates designer friendly.
>> Such restrictions could be very tricky to achieve if the CMS template
>> is processed by Lift engine. Perhaps for specialized CMS templates a
>> dedicated templating definition and engine is more appropriate in
>> order to strictly process given tags that define the CMS templating
>> language?
>>
>>> This is one use case, and in my particular circumstances, I want to
>>> provide a degree of functionality that is succinctly separate from the
>>> lift functionality and I don't want the twain to meet (as it were) but
>>> its important for my purposes at least that the templates still play
>>> well with tools such as Dreamweaver (just as the lift tags do)
>>>
>>> What are your thoughts?
>> Related to my notes above if you define a set of tags for your CMS
>> template and you run that against Lift's templating engine how do you
>> prevent lift specific "tags" to be executed?
> 
> 
> 
> > 
> 

--~--~-~--~~~---~--~~
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] Proposed improvement to CRUDify

2009-08-28 Thread jon

Hi,

I think the _showAllTemplate should wrap the header and footer rows in
 and  blocks respectively so that the table plays nice
with the TableSorter widget.

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



[Lift] Re: syntax question

2009-08-28 Thread Naftoli Gugenheim


--~--~-~--~~~---~--~~
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: syntax question

2009-08-28 Thread Naftoli Gugenheim

Before it was empty or not compiling?
Can you verify that it has what to iterate?

-
DavidV wrote:


Like this?

def resultTable: NodeSeq  = {
  
  {for (r <- 0 until analysis.slots.length) {

{for (c <- 0 until test.testvars.length) {
  new CellType(calls(r)(c).output)
}}

  }}
  
  }

that is not working for me either, it still returns an empty table...

can you by any chance demonstrate by editing this table?


  
for (c <- 0 until 10)  {
   {array(c)} 
}
  



thanks,
David

On Aug 28, 3:49 pm, Naftoli Gugenheim  wrote:
> You can nest curly braces - just surround the for loop with another pair.
>
> -
>
> DavidV wrote:
>
> This may be more of an HTML question, but since I haven't found an
> answer online, I'm working in Lift and I'm sure most people here can
> answer this easily I figured I'd ask.
>
> I am trying to create a dynamic HTML table, by looping through the
> rows and columns of the table and inserting variables from a two-
> dimensional array.
>
> my array is "calls" and is an Array[Array[Result]]
>
> The basic structure of the table that I want to create is:
>
> def resultTable: NodeSeq  = {
>   
>       for (r <- 0 until analysis.slots.length) {
>         
>         for (c <- 0 until test.testvars.length) {
>           new CellType(calls(r)(c).output)
>         }
>         
>       }
>   
>   }
>
> I have a class CellType that returns a  variable content 
>
> The resultTable method is in a snippet class and I am calling it from
> a separate HTML file.  All other mechanisms are working well since I
> tested a simple TEST within the same method and it
> created the table as expected.  Therefore, this is simply a syntax
> error.  I know you have to use {} to isolate scala code/variables in
> HTML, but I'm not sure how to do that when the brackets are necessary
> for the loop.
>
> Thanks for the help,
> 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: syntax question

2009-08-28 Thread DavidV

Aha!  I knew it was something simple.  Thanks!

On Aug 28, 4:57 pm, Viktor Klang  wrote:
>  { for(i <- 0 until 10) yield  { for(j <- 0 until 10) yield
> {j} }   } 
>
> My guess is that you've omitted your yields
>
>
>
> On Fri, Aug 28, 2009 at 10:34 PM, DavidV  wrote:
>
> > and yes, I verified that it has the necessary information to iterate
> > by substituting the  values with a println
>
> > On Aug 28, 4:15 pm, Naftoli Gugenheim  wrote:
> > > Before it was empty or not compiling?
> > > Can you verify that it has what to iterate?
>
> > > -
>
> > > DavidV wrote:
>
> > > Like this?
>
> > > def resultTable: NodeSeq  = {
> > >   
> > >       {for (r <- 0 until analysis.slots.length) {
> > >         
> > >         {for (c <- 0 until test.testvars.length) {
> > >           new CellType(calls(r)(c).output)
> > >         }}
> > >         
> > >       }}
> > >   
> > >   }
>
> > > that is not working for me either, it still returns an empty table...
>
> > > can you by any chance demonstrate by editing this table?
>
> > > 
> > >   
> > >     for (c <- 0 until 10)  {
> > >        {array(c)} 
> > >     }
> > >   
> > > 
>
> > > thanks,
> > > David
>
> > > On Aug 28, 3:49 pm, Naftoli Gugenheim  wrote:
>
> > > > You can nest curly braces - just surround the for loop with another
> > pair.
>
> > > > -
>
> > > > DavidV wrote:
>
> > > > This may be more of an HTML question, but since I haven't found an
> > > > answer online, I'm working in Lift and I'm sure most people here can
> > > > answer this easily I figured I'd ask.
>
> > > > I am trying to create a dynamic HTML table, by looping through the
> > > > rows and columns of the table and inserting variables from a two-
> > > > dimensional array.
>
> > > > my array is "calls" and is an Array[Array[Result]]
>
> > > > The basic structure of the table that I want to create is:
>
> > > > def resultTable: NodeSeq  = {
> > > >   
> > > >       for (r <- 0 until analysis.slots.length) {
> > > >         
> > > >         for (c <- 0 until test.testvars.length) {
> > > >           new CellType(calls(r)(c).output)
> > > >         }
> > > >         
> > > >       }
> > > >   
> > > >   }
>
> > > > I have a class CellType that returns a  variable content 
>
> > > > The resultTable method is in a snippet class and I am calling it from
> > > > a separate HTML file.  All other mechanisms are working well since I
> > > > tested a simple TEST within the same method and it
> > > > created the table as expected.  Therefore, this is simply a syntax
> > > > error.  I know you have to use {} to isolate scala code/variables in
> > > > HTML, but I'm not sure how to do that when the brackets are necessary
> > > > for the loop.
>
> > > > Thanks for the help,
> > > > David
>
> --
> Viktor Klang
>
> Blog: klangism.blogspot.com
> Twttr: viktorklang
>
> Lift Committer - liftweb.com
> AKKA Committer - akkasource.org
> Cassidy - github.com/viktorklang/Cassidy.git
> SoftPub founder:http://groups.google.com/group/softpub
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: syntax question

2009-08-28 Thread Naftoli Gugenheim

You can nest curly braces - just surround the for loop with another pair.

-
DavidV wrote:


This may be more of an HTML question, but since I haven't found an
answer online, I'm working in Lift and I'm sure most people here can
answer this easily I figured I'd ask.

I am trying to create a dynamic HTML table, by looping through the
rows and columns of the table and inserting variables from a two-
dimensional array.

my array is "calls" and is an Array[Array[Result]]

The basic structure of the table that I want to create is:

def resultTable: NodeSeq  = {
  
  for (r <- 0 until analysis.slots.length) {

for (c <- 0 until test.testvars.length) {
  new CellType(calls(r)(c).output)
}

  }
  
  }

I have a class CellType that returns a  variable content 

The resultTable method is in a snippet class and I am calling it from
a separate HTML file.  All other mechanisms are working well since I
tested a simple TEST within the same method and it
created the table as expected.  Therefore, this is simply a syntax
error.  I know you have to use {} to isolate scala code/variables in
HTML, but I'm not sure how to do that when the brackets are necessary
for the loop.

Thanks for the help,
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: Creating your own tags?

2009-08-28 Thread Timothy Perrett

Its not that I want to completely stop the normal lift tag processing, I
don't, I just want to make it appear to users as if they are not using
lift... That might sound crazy, but essentially I want users to only know
about that tags they are told about, rather than having obvious access to
all the lift default stuff.

Yes, ok, they could do some research and dig it out, but in my experience if
it is not staring users in the face, only a few of them will go looking any
deeper. Does that make any sense what-so-ever?

Cheers, Tim 


On 28/08/2009 21:47, "marius d."  wrote:
>> Hey Marius
>> 
>> Firstly I agree with your thoughts on LiftTagPF - im not sure that
>> overriding the default lift tags would ever be a good idea for
>> implementing users...
> 
> Well I was referring to overwriting (as those would take precedence
> over builtin snippets) ... not much of an overriding.
> 
>> However, I do see a use case, in, for instance
>> the CMS arena where having a specialized tagging mechanism would be
>> beneficial because you simply wouldn't want to use the default lift
>> namespace so that users could just do:
>> 
>> 
>> 
>> All over their template code - you'd want to restrict what users could
>> actually do whilst still keeping the templates designer friendly.
> 
> Such restrictions could be very tricky to achieve if the CMS template
> is processed by Lift engine. Perhaps for specialized CMS templates a
> dedicated templating definition and engine is more appropriate in
> order to strictly process given tags that define the CMS templating
> language?
> 
>> 
>> This is one use case, and in my particular circumstances, I want to
>> provide a degree of functionality that is succinctly separate from the
>> lift functionality and I don't want the twain to meet (as it were) but
>> its important for my purposes at least that the templates still play
>> well with tools such as Dreamweaver (just as the lift tags do)
>> 
>> What are your thoughts?
> 
> Related to my notes above if you define a set of tags for your CMS
> template and you run that against Lift's templating engine how do you
> prevent lift specific "tags" to be executed?



--~--~-~--~~~---~--~~
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: syntax question

2009-08-28 Thread Naftoli Gugenheim

Are you positive the list is not empty? And is it empty of tr's or just td's?

-
DavidV wrote:


Sorry for the confusion.  The way I initially represented the table,
it did not compile.  I got the following errors:

in XML literal: '>' expected instead of '0'
in XML literal: '>' expected instead of '0'
in XML literal: expected closing tag of -
in XML literal: expected closing tag of -

on lines: 3, 5, 8 and 10, respectively.

1 def resultTable: NodeSeq  = {
2  
3   for (r <- 0 until analysis.slots.length) {
4 
5 for (c <- 0 until test.testvars.length) {
6   new CellType(calls(r)(c).output)
7 }
8 
9   }
10   
11  }

I have tried a number of different ways to add the curly braces that
makes it compile, including they way you suggested.  However every
time I succeed in making it compile with curly braces it returns an
empty table.

On Aug 28, 3:49 pm, Naftoli Gugenheim  wrote:
> You can nest curly braces - just surround the for loop with another pair.
>
> -
>
> DavidV wrote:
>
> This may be more of an HTML question, but since I haven't found an
> answer online, I'm working in Lift and I'm sure most people here can
> answer this easily I figured I'd ask.
>
> I am trying to create a dynamic HTML table, by looping through the
> rows and columns of the table and inserting variables from a two-
> dimensional array.
>
> my array is "calls" and is an Array[Array[Result]]
>
> The basic structure of the table that I want to create is:
>
> def resultTable: NodeSeq  = {
>   
>       for (r <- 0 until analysis.slots.length) {
>         
>         for (c <- 0 until test.testvars.length) {
>           new CellType(calls(r)(c).output)
>         }
>         
>       }
>   
>   }
>
> I have a class CellType that returns a  variable content 
>
> The resultTable method is in a snippet class and I am calling it from
> a separate HTML file.  All other mechanisms are working well since I
> tested a simple TEST within the same method and it
> created the table as expected.  Therefore, this is simply a syntax
> error.  I know you have to use {} to isolate scala code/variables in
> HTML, but I'm not sure how to do that when the brackets are necessary
> for the loop.
>
> Thanks for the help,
> 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: error in http authetication and openid

2009-08-28 Thread iboy


i will explore more in this area .
Thanks for replies

On Aug 28, 4:33 am, David Pollak 
wrote:
> I think you'll be best off protecting your resource with basic auth to
> determine who the user is but using sitemap (for HTML pages) and guards in
> partial functions (for web services) to enforce URL-level RBAC.
>
> On Fri, Aug 28, 2009 at 2:44 AM, Timothy Perrett 
> wrote:
>
>
>
>
>
> > It should not matter if its append or prepend (relatively speaking) as
> > its a RuleSeq[T]
>
> > OOTB, the HTTP Auth stuff has nothing to do with ProtoUser... you
> > could probably knit them together, but that is not what it is designed
> > to do from the starting blocks...
>
> > Cheers, Tim
>
> > On Aug 28, 8:09 am, iboy  wrote:
> > > Thanks Timothy
>
> > > That helped me  out a lot but i have one doubt that as per given in
> > > liftbook code i used LiftRules. httpAuthProtectedResource.append
> > > but new code used prepend  and secondly how can we apply the role
> > > based access to the user  model so that when signing in we can
> > > implicitly know that this user has admin rights.
>
> > > Best
>
> > > On Aug 27, 3:47 pm, Timothy Perrett  wrote:
>
> > > > Please check:
>
> > > >http://is.gd/2BwGf
>
> > > > Can you check your code looks like that and if your still getting the
> > > > problem?
>
> > > > Cheers, Tim
>
> > > > On 27/08/2009 11:34, "iboy"  wrote:
>
> > > > > Hi all
> > > > > i am new to scala and lift.
> > > > > while trying to do a sample project i tried to use httpauthentication
> > > > > code given in liftbook (7.14 authentication example) and i am getting
> > > > > following errors
>
> > > > > a) while using import auth._
>
> > > > >  error: value auth not found
> > > > > if i try using  _root_.net.liftweb.http.auth._
> > > > > i get
> > > > >  error: value auth is not a member of package net.liftweb.http
> > > > > import _root_.net.liftweb.http.auth._
>
> > > > > any help is appreciated
>
> > > > > i am using  scala 2.7.3 final and maven 2.0.9
>
> --
> 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] Searching this Group

2009-08-28 Thread Ryan Donahue

"Search this group" doesn't always work.  I found this by searching
for the term "fade", recalling a discussion Marius posted about fading
out messages.  "Search this group" does not find the discussion, but
you can find the discussion by changing the search criteria to "fade
group:liftweb" and use the "Search Groups" button.

Here's a very short screencast (28sec) showing the problem and
solution:
http://www.utipu.com/app/tip/id/15703/

I hope this helps somebody else find what they are looking for.  Maybe
it's why there are so many duplicate questions posted.
--~--~-~--~~~---~--~~
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: syntax question

2009-08-28 Thread Viktor Klang
 { for(i <- 0 until 10) yield  { for(j <- 0 until 10) yield
{j} }   } 


My guess is that you've omitted your yields

On Fri, Aug 28, 2009 at 10:34 PM, DavidV  wrote:

>
> and yes, I verified that it has the necessary information to iterate
> by substituting the  values with a println
>
> On Aug 28, 4:15 pm, Naftoli Gugenheim  wrote:
> > Before it was empty or not compiling?
> > Can you verify that it has what to iterate?
> >
> > -
> >
> > DavidV wrote:
> >
> > Like this?
> >
> > def resultTable: NodeSeq  = {
> >   
> >   {for (r <- 0 until analysis.slots.length) {
> > 
> > {for (c <- 0 until test.testvars.length) {
> >   new CellType(calls(r)(c).output)
> > }}
> > 
> >   }}
> >   
> >   }
> >
> > that is not working for me either, it still returns an empty table...
> >
> > can you by any chance demonstrate by editing this table?
> >
> > 
> >   
> > for (c <- 0 until 10)  {
> >{array(c)} 
> > }
> >   
> > 
> >
> > thanks,
> > David
> >
> > On Aug 28, 3:49 pm, Naftoli Gugenheim  wrote:
> >
> > > You can nest curly braces - just surround the for loop with another
> pair.
> >
> > > -
> >
> > > DavidV wrote:
> >
> > > This may be more of an HTML question, but since I haven't found an
> > > answer online, I'm working in Lift and I'm sure most people here can
> > > answer this easily I figured I'd ask.
> >
> > > I am trying to create a dynamic HTML table, by looping through the
> > > rows and columns of the table and inserting variables from a two-
> > > dimensional array.
> >
> > > my array is "calls" and is an Array[Array[Result]]
> >
> > > The basic structure of the table that I want to create is:
> >
> > > def resultTable: NodeSeq  = {
> > >   
> > >   for (r <- 0 until analysis.slots.length) {
> > > 
> > > for (c <- 0 until test.testvars.length) {
> > >   new CellType(calls(r)(c).output)
> > > }
> > > 
> > >   }
> > >   
> > >   }
> >
> > > I have a class CellType that returns a  variable content 
> >
> > > The resultTable method is in a snippet class and I am calling it from
> > > a separate HTML file.  All other mechanisms are working well since I
> > > tested a simple TEST within the same method and it
> > > created the table as expected.  Therefore, this is simply a syntax
> > > error.  I know you have to use {} to isolate scala code/variables in
> > > HTML, but I'm not sure how to do that when the brackets are necessary
> > > for the loop.
> >
> > > Thanks for the help,
> > > David
> >
>


-- 
Viktor Klang

Blog: klangism.blogspot.com
Twttr: viktorklang

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

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



[Lift] Re: Creating your own tags?

2009-08-28 Thread marius d.



On Aug 28, 11:20 pm, Timothy Perrett  wrote:
> Hey Marius
>
> Firstly I agree with your thoughts on LiftTagPF - im not sure that
> overriding the default lift tags would ever be a good idea for
> implementing users...

Well I was referring to overwriting (as those would take precedence
over builtin snippets) ... not much of an overriding.

> However, I do see a use case, in, for instance
> the CMS arena where having a specialized tagging mechanism would be
> beneficial because you simply wouldn't want to use the default lift
> namespace so that users could just do:
>
> 
>
> All over their template code - you'd want to restrict what users could
> actually do whilst still keeping the templates designer friendly.

Such restrictions could be very tricky to achieve if the CMS template
is processed by Lift engine. Perhaps for specialized CMS templates a
dedicated templating definition and engine is more appropriate in
order to strictly process given tags that define the CMS templating
language?

>
> This is one use case, and in my particular circumstances, I want to
> provide a degree of functionality that is succinctly separate from the
> lift functionality and I don't want the twain to meet (as it were) but
> its important for my purposes at least that the templates still play
> well with tools such as Dreamweaver (just as the lift tags do)
>
> What are your thoughts?

Related to my notes above if you define a set of tags for your CMS
template and you run that against Lift's templating engine how do you
prevent lift specific "tags" to be executed?

>
> Cheers, Tim
>
> On Aug 28, 5:48 pm, "marius d."  wrote:
>
> > Personally I'm not a fan of such feature. To me this doesn't bring
> > much benefits especially that snippets pretty much allow this support
> > such as:
>
> > 
> >    
> > 
>
> > ...yes the wrapping tag is extra typing but still I can't find a real
> > problem where a custom tags solves it and snippets do now. To me this
> > looks like ... what I'd call "a false sense of extensibility". I mean
> > at the first glance we allow people to define a tag soup (with or
> > without naming overlaps) but then looking closely is that we didn't
> > actually do too much. Snippets would do the job in a more
> > "standardize" lift way IMO.
>
> > For what I can tell the LiftRules.LiftTagPF should probably be
> > deprecated. The debatable value that I could currently find in
> > LiftTagPF is that people could overwrite Lift built in snippets with
> > some proprietary implementation. However in practice this is not
> > really needed .. I think.
>
> > All in all I'd love to see some types of problems where custom tags
> > would be a better fit.
>
> > Br's,
> > Marius
>
> > On Aug 28, 7:30 pm, Timothy Perrett  wrote:
>
> > > Hey David,
>
> > > Id like to echo your thoughts - I see no issue with views being tied
> > > to plugins or other such arbitrary tags... as you say, they are
> > > already tied to snippets.
>
> > > What are your thoughts on how arbitrary tag / prefix support could be
> > > implemented?
>
> > > Cheers, Tim
>
> > > > There's been some discussion of this feature in the past.  The generally
> > > > outcome is that cost of prefix/label soup would become very confusing
> > > > because the views become tied to plugins (although this seems weird to 
> > > > me
> > > > because views are tied to snippets.)
>
> > > > I think in light of the modularization discussion and the potential for
> > > > snippet name overlap, it might be having the discussion about supporting
> > > > arbitrary tags and arbitrary attributes in Lift's templating system.
>
> > > > Anybody have thoughts?
--~--~-~--~~~---~--~~
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: Creating your own tags?

2009-08-28 Thread marius d.

Personally I'm not a fan of such feature. To me this doesn't bring
much benefits especially that snippets pretty much allow this support
such as:


   


...yes the wrapping tag is extra typing but still I can't find a real
problem where a custom tags solves it and snippets do now. To me this
looks like ... what I'd call "a false sense of extensibility". I mean
at the first glance we allow people to define a tag soup (with or
without naming overlaps) but then looking closely is that we didn't
actually do too much. Snippets would do the job in a more
"standardize" lift way IMO.

For what I can tell the LiftRules.LiftTagPF should probably be
deprecated. The debatable value that I could currently find in
LiftTagPF is that people could overwrite Lift built in snippets with
some proprietary implementation. However in practice this is not
really needed .. I think.

All in all I'd love to see some types of problems where custom tags
would be a better fit.

Br's,
Marius

On Aug 28, 7:30 pm, Timothy Perrett  wrote:
> Hey David,
>
> Id like to echo your thoughts - I see no issue with views being tied
> to plugins or other such arbitrary tags... as you say, they are
> already tied to snippets.
>
> What are your thoughts on how arbitrary tag / prefix support could be
> implemented?
>
> Cheers, Tim
>
> > There's been some discussion of this feature in the past.  The generally
> > outcome is that cost of prefix/label soup would become very confusing
> > because the views become tied to plugins (although this seems weird to me
> > because views are tied to snippets.)
>
> > I think in light of the modularization discussion and the potential for
> > snippet name overlap, it might be having the discussion about supporting
> > arbitrary tags and arbitrary attributes in Lift's templating system.
>
> > Anybody have thoughts?
--~--~-~--~~~---~--~~
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: syntax question

2009-08-28 Thread DavidV

and yes, I verified that it has the necessary information to iterate
by substituting the  values with a println

On Aug 28, 4:15 pm, Naftoli Gugenheim  wrote:
> Before it was empty or not compiling?
> Can you verify that it has what to iterate?
>
> -
>
> DavidV wrote:
>
> Like this?
>
> def resultTable: NodeSeq  = {
>   
>       {for (r <- 0 until analysis.slots.length) {
>         
>         {for (c <- 0 until test.testvars.length) {
>           new CellType(calls(r)(c).output)
>         }}
>         
>       }}
>   
>   }
>
> that is not working for me either, it still returns an empty table...
>
> can you by any chance demonstrate by editing this table?
>
> 
>   
>     for (c <- 0 until 10)  {
>        {array(c)} 
>     }
>   
> 
>
> thanks,
> David
>
> On Aug 28, 3:49 pm, Naftoli Gugenheim  wrote:
>
> > You can nest curly braces - just surround the for loop with another pair.
>
> > -
>
> > DavidV wrote:
>
> > This may be more of an HTML question, but since I haven't found an
> > answer online, I'm working in Lift and I'm sure most people here can
> > answer this easily I figured I'd ask.
>
> > I am trying to create a dynamic HTML table, by looping through the
> > rows and columns of the table and inserting variables from a two-
> > dimensional array.
>
> > my array is "calls" and is an Array[Array[Result]]
>
> > The basic structure of the table that I want to create is:
>
> > def resultTable: NodeSeq  = {
> >   
> >       for (r <- 0 until analysis.slots.length) {
> >         
> >         for (c <- 0 until test.testvars.length) {
> >           new CellType(calls(r)(c).output)
> >         }
> >         
> >       }
> >   
> >   }
>
> > I have a class CellType that returns a  variable content 
>
> > The resultTable method is in a snippet class and I am calling it from
> > a separate HTML file.  All other mechanisms are working well since I
> > tested a simple TEST within the same method and it
> > created the table as expected.  Therefore, this is simply a syntax
> > error.  I know you have to use {} to isolate scala code/variables in
> > HTML, but I'm not sure how to do that when the brackets are necessary
> > for the loop.
>
> > Thanks for the help,
> > 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: syntax question

2009-08-28 Thread DavidV

Sorry for the confusion.  The way I initially represented the table,
it did not compile.  I got the following errors:

in XML literal: '>' expected instead of '0'
in XML literal: '>' expected instead of '0'
in XML literal: expected closing tag of -
in XML literal: expected closing tag of -

on lines: 3, 5, 8 and 10, respectively.

1 def resultTable: NodeSeq  = {
2  
3   for (r <- 0 until analysis.slots.length) {
4 
5 for (c <- 0 until test.testvars.length) {
6   new CellType(calls(r)(c).output)
7 }
8 
9   }
10   
11  }

I have tried a number of different ways to add the curly braces that
makes it compile, including they way you suggested.  However every
time I succeed in making it compile with curly braces it returns an
empty table.

On Aug 28, 3:49 pm, Naftoli Gugenheim  wrote:
> You can nest curly braces - just surround the for loop with another pair.
>
> -
>
> DavidV wrote:
>
> This may be more of an HTML question, but since I haven't found an
> answer online, I'm working in Lift and I'm sure most people here can
> answer this easily I figured I'd ask.
>
> I am trying to create a dynamic HTML table, by looping through the
> rows and columns of the table and inserting variables from a two-
> dimensional array.
>
> my array is "calls" and is an Array[Array[Result]]
>
> The basic structure of the table that I want to create is:
>
> def resultTable: NodeSeq  = {
>   
>       for (r <- 0 until analysis.slots.length) {
>         
>         for (c <- 0 until test.testvars.length) {
>           new CellType(calls(r)(c).output)
>         }
>         
>       }
>   
>   }
>
> I have a class CellType that returns a  variable content 
>
> The resultTable method is in a snippet class and I am calling it from
> a separate HTML file.  All other mechanisms are working well since I
> tested a simple TEST within the same method and it
> created the table as expected.  Therefore, this is simply a syntax
> error.  I know you have to use {} to isolate scala code/variables in
> HTML, but I'm not sure how to do that when the brackets are necessary
> for the loop.
>
> Thanks for the help,
> 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: Creating your own tags?

2009-08-28 Thread Timothy Perrett

Hey Marius

Firstly I agree with your thoughts on LiftTagPF - im not sure that
overriding the default lift tags would ever be a good idea for
implementing users... However, I do see a use case, in, for instance
the CMS arena where having a specialized tagging mechanism would be
beneficial because you simply wouldn't want to use the default lift
namespace so that users could just do:



All over their template code - you'd want to restrict what users could
actually do whilst still keeping the templates designer friendly.

This is one use case, and in my particular circumstances, I want to
provide a degree of functionality that is succinctly separate from the
lift functionality and I don't want the twain to meet (as it were) but
its important for my purposes at least that the templates still play
well with tools such as Dreamweaver (just as the lift tags do)

What are your thoughts?

Cheers, Tim

On Aug 28, 5:48 pm, "marius d."  wrote:
> Personally I'm not a fan of such feature. To me this doesn't bring
> much benefits especially that snippets pretty much allow this support
> such as:
>
> 
>    
> 
>
> ...yes the wrapping tag is extra typing but still I can't find a real
> problem where a custom tags solves it and snippets do now. To me this
> looks like ... what I'd call "a false sense of extensibility". I mean
> at the first glance we allow people to define a tag soup (with or
> without naming overlaps) but then looking closely is that we didn't
> actually do too much. Snippets would do the job in a more
> "standardize" lift way IMO.
>
> For what I can tell the LiftRules.LiftTagPF should probably be
> deprecated. The debatable value that I could currently find in
> LiftTagPF is that people could overwrite Lift built in snippets with
> some proprietary implementation. However in practice this is not
> really needed .. I think.
>
> All in all I'd love to see some types of problems where custom tags
> would be a better fit.
>
> Br's,
> Marius
>
> On Aug 28, 7:30 pm, Timothy Perrett  wrote:
>
>
>
> > Hey David,
>
> > Id like to echo your thoughts - I see no issue with views being tied
> > to plugins or other such arbitrary tags... as you say, they are
> > already tied to snippets.
>
> > What are your thoughts on how arbitrary tag / prefix support could be
> > implemented?
>
> > Cheers, Tim
>
> > > There's been some discussion of this feature in the past.  The generally
> > > outcome is that cost of prefix/label soup would become very confusing
> > > because the views become tied to plugins (although this seems weird to me
> > > because views are tied to snippets.)
>
> > > I think in light of the modularization discussion and the potential for
> > > snippet name overlap, it might be having the discussion about supporting
> > > arbitrary tags and arbitrary attributes in Lift's templating system.
>
> > > Anybody have thoughts?
--~--~-~--~~~---~--~~
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: Modularization of Lift code

2009-08-28 Thread glenn

David,

I'll take a look at the ESME code to see if what you've done scratches
my
itch on this issue. I've run the war file and it looks interesting. I
assume the source is
also available. Thanks for the heads-up.

Glenn...

On Aug 27, 7:55 pm, David Pollak 
wrote:
> On Thu, Aug 27, 2009 at 2:00 PM, glenn  wrote:
>
> > David,
>
> > Besides the very detailed discussion here about the problems of Boot
> > initialization
> > and the immutability of sitemap and liftrules, that strikes me as a
> > sufficient
> > barrier to real modularization.
>
> Are you talking about modularization of web apps?  Are you talking about
> being able to "plop in" a JAR file and do one or two bits of configuration
> and have that JAR's features be part of your app?  If you are, with the
> exception of the "where do my menu items go" issue, as long as you can do
> the configuration in Boot, Lift allows for fully modular apps.
>
> Rather than complaining the Lift doesn't offer what you need, please define
> what you need in very specific terms (I need to intercept a GET request to a
> URL, I need to intercept requests to a URL if certain conditions are met, I
> need to include a tag in view code that invokes code in my module, etc.) or
> point to another framework that allows for this plugin modularization.
>
> > I hadn't thought about turning
> > reuseable code into
> > traits and assigning those around in jar files until you mentioned it.
> > Not a bad idea.
>
> > But I wouldn't feel comfortable incorporating third-party traits in my
> > code unless
> > I had the source to fall back on.
>
> Why are traits any different than objects that you subclass?  As far as I
> can tell, traits simply give you nearly multiple inheritance without the
> headaches.  Why would you be any less willing to mix in a trait than to
> subclass a class provided by another library?
>
>
>
> > Example of poor encapsulation - just the fact that you can encapsulate
> > snippets and templates. Without the
> > source, how can a user ever hope to incorporate those.
>
> I think that snippets are a near perfect encapsulation mechanism.  They are
> simply a transformation of XHTML -> XHTML.  What could be more straight
> forward?  What could be more encapsulated?  Further, Lift's mechanism of
> associating HTML elements with functions means that there's no need to have
> special URLs to handle forms or anything else.  My snippet can generate a
> form that will be processed if it is submitted back to the server, no matter
> what URL the form is submitted to.  In Rails and other MVC frameworks, the
> POST/GET must be done to a specific controller in order for the parameters
> to be correctly processed.  Why does this matter?
>
> Well, in the ESME codebase, I just created an authentication plugin
> mechanism that allows a plugin to define a part of a form that is to be
> filled in as part of the signup process.  The signup process doesn't know
> anything about the plugin or what fields the plugin needs.  The snippet that
> handles the signup simply binds one element to the plugins part of the
> sign-up.  The plugin manages its own portion of the form, manages its own
> validation, manages its own saving, all without having to register as being
> part of the controller.  This is highly modular.
>
> > And then, to
> > make them private, which is done...that's turning
> > a headache into a nightmare.
>
> Can you give me an example of a private snippet or a private template and
> how you would use one?
>
>
>
> > Yeah, as long as you work at the source-level, there is no problem.
> > But that, in-and-of itself, is the problem. As you
> > suggest, some, as yet unilluminated patterns, would be most helpful.
>
> If I understood what you were trying to do, I could help you with patterns.
>
> Code works best for me.  If you could put together templates and stubbed
> Scala and make clear what you're trying to do and what Lift is not letting
> you do, I could help you out.
>
> Thanks,
>
> David
>
>
>
> > Glenn...
>
> > On Aug 27, 12:11 pm, David Pollak 
> > wrote:
> > > On Thu, Aug 27, 2009 at 11:22 AM, glenn  wrote:
>
> > > > David,
>
> > > > Returning menu items from your init function is OK, but forces the
> > > > user
> > > > of your module to guess on function-call order
>
> > > I don't understand... what function call order are you talking about?
> >  The
> > > order in which the modules are initialized?  Something else?
>
> > > > , or be forced to glean
> > > > it from
> > > > the source, which he should not be required to do.
>
> > > > Putting code such as this, instead, in your init function helps, but
> > > > does not eliminate that problem.
>
> > > What particular problem?
>
> > > > val sitemap = LiftRules.siteMap match {
> > > >      case Full(sm) => LiftRules.setSiteMap(SiteMap(sm.menus :::
> > > > Role.menus:_* ))
> > > >      case _ => LiftRules.setSiteMap(SiteMap(Role.menus:_*))
> > > >    }
>
> > > Where are you proposing to put this code?
>
> > > > With it, you 

[Lift] Re: syntax question

2009-08-28 Thread DavidV

Like this?

def resultTable: NodeSeq  = {
  
  {for (r <- 0 until analysis.slots.length) {

{for (c <- 0 until test.testvars.length) {
  new CellType(calls(r)(c).output)
}}

  }}
  
  }

that is not working for me either, it still returns an empty table...

can you by any chance demonstrate by editing this table?


  
for (c <- 0 until 10)  {
   {array(c)} 
}
  



thanks,
David

On Aug 28, 3:49 pm, Naftoli Gugenheim  wrote:
> You can nest curly braces - just surround the for loop with another pair.
>
> -
>
> DavidV wrote:
>
> This may be more of an HTML question, but since I haven't found an
> answer online, I'm working in Lift and I'm sure most people here can
> answer this easily I figured I'd ask.
>
> I am trying to create a dynamic HTML table, by looping through the
> rows and columns of the table and inserting variables from a two-
> dimensional array.
>
> my array is "calls" and is an Array[Array[Result]]
>
> The basic structure of the table that I want to create is:
>
> def resultTable: NodeSeq  = {
>   
>       for (r <- 0 until analysis.slots.length) {
>         
>         for (c <- 0 until test.testvars.length) {
>           new CellType(calls(r)(c).output)
>         }
>         
>       }
>   
>   }
>
> I have a class CellType that returns a  variable content 
>
> The resultTable method is in a snippet class and I am calling it from
> a separate HTML file.  All other mechanisms are working well since I
> tested a simple TEST within the same method and it
> created the table as expected.  Therefore, this is simply a syntax
> error.  I know you have to use {} to isolate scala code/variables in
> HTML, but I'm not sure how to do that when the brackets are necessary
> for the loop.
>
> Thanks for the help,
> 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: Modularization of Lift code

2009-08-28 Thread AlBlue

On Jul 29, 12:55 pm, Heiko Seeberger 
wrote:
> Just a quick and dirty reply: In order to get OSGi support LiftRules should
> delegate *everything* to a Collection of LiftModules.  LiftModules can be
> added to and removed from this collection anytime.

Yup, maintaining a collection is the easiest way to use dynamic
updates in the future.

That said, I've been discussing modularity of scala code generally
recently:

http://alblue.blogspot.com/2009/08/modularity-for-scala.html

If anyone's interested helping out then please drop me a note on my
blog. Hopefully we'll be able to extend the work that Heiko has
already done and use that to modularise the core library. If
successful, this could be used as an approach for both the lift code
and apps that depend on lift.

Alex

--~--~-~--~~~---~--~~
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: Creating your own tags?

2009-08-28 Thread Timothy Perrett

Hey David,

Id like to echo your thoughts - I see no issue with views being tied
to plugins or other such arbitrary tags... as you say, they are
already tied to snippets.

What are your thoughts on how arbitrary tag / prefix support could be
implemented?

Cheers, Tim

> There's been some discussion of this feature in the past.  The generally
> outcome is that cost of prefix/label soup would become very confusing
> because the views become tied to plugins (although this seems weird to me
> because views are tied to snippets.)
>
> I think in light of the modularization discussion and the potential for
> snippet name overlap, it might be having the discussion about supporting
> arbitrary tags and arbitrary attributes in Lift's templating system.
>
> Anybody have thoughts?

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



[Lift] Re: has anyone seen this exception?

2009-08-28 Thread David Pollak
On Fri, Aug 28, 2009 at 9:21 AM, Jack Widman  wrote:

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


No.  Jetty is just a bunch of stuff running on the JVM.

If you're making HTTP requests on external systems, I'd recommend using the
Apache Commons HTTP library or some abstraction on top of it (I think
N8hanhas some code that does this).


>
>
> On Fri, Aug 28, 2009 at 12:20 AM, Ross Mellgren  wrote:
>
>> That error sounds like it's probably that the remote server is
>> disconnecting prematurely, or is not handling Transfer-Encoding: Chunked as
>> HttpURLConnection expects.
>> Have you tried getting whatever URL it's trying with wget or curl?
>>
>> -Ross
>>
>> On Aug 27, 2009, at 7:28 PM, Jack Widman wrote:
>>
>> Here is the code I am using. The exception is happening at line 12, the
>> line that goes  line =
>> br.readLine()
>>  The exception is happening alot. Any ideas?
>>
>> package com.authoritude.snippet
>>
>> import java.io.{InputStreamReader, BufferedInputStream, BufferedReader,
>> OutputStreamWriter, InputStream}
>>
>> object StreamUtil {
>>   def streamToString(stream: InputStream): String = {
>> val buf = new StringBuilder
>> val br = new BufferedReader(new InputStreamReader(stream))
>> var line: String = null
>> var eof = false
>> while (! eof) {
>>   line = br.readLine()
>>   if (line == null) eof = true else
>> buf.append(line).append("\n")
>> }
>> buf.toString
>>   }
>> }
>>
>>
>> On Thu, Aug 27, 2009 at 5:49 PM, David Pollak <
>> feeder.of.the.be...@gmail.com> wrote:
>>
>>> This happens sometimes when the client disconnects before the
>>> communications with the server is complete.  I see them from time to time
>>> and they indicate to me that the Internet is a random place.
>>>
>>> On Thu, Aug 27, 2009 at 12:06 PM, jack  wrote:
>>>

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

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



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


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

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



[Lift] syntax question

2009-08-28 Thread DavidV

This may be more of an HTML question, but since I haven't found an
answer online, I'm working in Lift and I'm sure most people here can
answer this easily I figured I'd ask.

I am trying to create a dynamic HTML table, by looping through the
rows and columns of the table and inserting variables from a two-
dimensional array.

my array is "calls" and is an Array[Array[Result]]

The basic structure of the table that I want to create is:

def resultTable: NodeSeq  = {
  
  for (r <- 0 until analysis.slots.length) {

for (c <- 0 until test.testvars.length) {
  new CellType(calls(r)(c).output)
}

  }
  
  }

I have a class CellType that returns a  variable content 

The resultTable method is in a snippet class and I am calling it from
a separate HTML file.  All other mechanisms are working well since I
tested a simple TEST within the same method and it
created the table as expected.  Therefore, this is simply a syntax
error.  I know you have to use {} to isolate scala code/variables in
HTML, but I'm not sure how to do that when the brackets are necessary
for the loop.

Thanks for the help,
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: Db.addLogFunc

2009-08-28 Thread Derek Chen-Becker
Hi all,
I've made a change to the Mapper logging functionality in
wip-dcb-sql-log-wrappers. The DB.addLogFunc method has changed to:

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

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

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

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

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

and we have some new event class/traits:

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

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

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

And we get output like:

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

Note that this code does introduce a breaking change if you're already using
log functions, since the addLogFunc signature has changed. If I can get a
review on the code before I merge to master I would appreciate it.

Derek

On Sat, Aug 15, 2009 at 8:02 AM, Derek Chen-Becker wrote:

> OK, a preliminary version of log wrappers is checked in on
> wip-dcb-sql-log-wrappers. I'll merge it on Tuesday if no one sees any
> problems with it.
>
> Derek
>
>
> On Tue, Aug 11, 2009 at 11:08 AM, Derek Chen-Becker  > wrote:
>
>> Will do.
>>
>>
>> On Tue, Aug 11, 2009 at 2:33 AM, marius d. wrote:
>>
>>>
>>> Please do so. If you need any help for some reason (time availability
>>> etc.) please let me know. As a note probably the wrappers should be
>>> only only when there is at least one log function registered.
>>>
>>> Br's,
>>> Marius
>>>
>>> On Aug 6, 11:48 pm, Derek Chen-Becker  wrote:
>>> > If there's a consensus that we want our own JDBC wrappers I'll go ahead
>>> and
>>> > write them.
>>> >
>>> > Derek
>>> >
>>> > On Thu, Aug 6, 2009 at 1:19 PM, marius d. 
>>> wrote:
>>> >
>>> > > Probably building our own wrappers would be more lightweight then
>>> 3-rd
>>> > > party. Jus' guessing
>>> >
>>> > > Br's,
>>> > > Marius
>>> >
>>> > > On Aug 6, 9:58 pm, Derek Chen-Becker  wrote:
>>> > > > Well, I started looking at it and determined that the only way for
>>> us to
>>> > > > truly log the queries would be to essentially make our own wrappers
>>> over
>>> > > > Statement and PreparedStatement. There are projects (log4jdbc,
>>> notably)
>>> > > that
>>> > > > already do this, and in a transparent manner. I'm not sure that
>>> adding a
>>> > > > whole bunch of SQL logging directly to Lift is better than
>>> leveraging
>>> > > some
>>> > > > existing libraries to do it.
>>> >
>>> > > > Derek
>>> >
>>> > > > On Thu, Aug 6, 2009 at 11:03 AM, marius d. <
>>> marius.dan...@gmail.com>
>>> > > wrote:
>>> >
>>> > > > > Yeah we're aware of that. That is based on toString application
>>> which
>>> > > > > is JDBC driver dependent. I think Derek started some work on this
>>> to
>>> > > > > correct this behavior. Derek ?
>>> >
>>> > > > > Br's,
>>> > > > > Marius
>>> >
>>> > > > > On Aug 6, 8:01 pm, jon  wrote:
>>> > > > > > Hi,
>>> >
>>> > > > > > I have the following in boot:
>>> > > > > >   DB.addLogFunc((query, len) => Log.info("The query: "+query+"
>>> took
>>> > > > > > "+len+" milliseconds"))
>>> >
>>> > > > > > I was expecting the query parameter to be sql, but it's
>>> actually some
>>> > > > > > sort of guid
>>> >
>>> > > > > > "INFO - The query: 6839c016-0122-f09a-9c96-003844e8 took 5
>>> > > > > > milliseconds"
>>> >
>>> > > > > > Any ideas?
>>> > > > > > I'm running with derby.
>>> >
>>> > > > > > Thanks,
>>> >
>>> > > > > > Jon
>>> >>>
>>>

[Lift] Re: weirdness with stateful snippets and multiple forms on the page

2009-08-28 Thread harryh

> Yeah... that's a bug.  I'll have a fix committed up in a few.

Bug fix FTW!  Thanks!

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



[Lift] Re: Creating your own tags?

2009-08-28 Thread David Pollak
On Fri, Aug 28, 2009 at 8:03 AM, Timothy Perrett wrote:

>
> Guys,
>
> If I wanted to create my own set of custom tags that looked like:
>
> 


There's been some discussion of this feature in the past.  The generally
outcome is that cost of prefix/label soup would become very confusing
because the views become tied to plugins (although this seems weird to me
because views are tied to snippets.)

I think in light of the modularization discussion and the potential for
snippet name overlap, it might be having the discussion about supporting
arbitrary tags and arbitrary attributes in Lift's templating system.

Anybody have thoughts?


>
>
> Ive not seen anyone ask this before and I know I cant use LiftTagPF to
> do it, so how would one go about doing such trickery? Can I still make
> use of lift goodness for snippets etc?
>
> Cheers, Tim
> >
>


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

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



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

2009-08-28 Thread harryh

> Currently thinking through what's going on in
> HasManyThrough::afterUpdate

override def afterUpdate {
  val current = through.findAll(By
(throughFromField,owner.primaryKeyField))

  val newKeys = new HashSet[ThroughType];

  theSetList.foreach(i => newKeys += i)
  val toDelete = current.filter(c => !newKeys.contains
(throughToField.actualField(c).is))
  toDelete.foreach(_.delete_!)

  // function continues
}

Unless I'm misunderstanding something (a distinct possibility) newKeys
will be (in my case) a HashSet[TipListBind] containing all the
TipListBinds associated with my specifi Tip.

But then when doing the filter it checks to see if newKeys contains a
given long corresponding to (again, in my case) the listid on all the
current TipListBinds.  Since the types aren't right here, it will
never contain this so toDelete will end up beind all of current, and
all the bindings will always be deleted.  Is this really what is
happening here?

-harryh

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



[Lift] Bug in HasManyThough causing unexpected deletions?

2009-08-28 Thread harryh

Tips are on TipLists based on TipListBinds.
Tips are also hooked to a Venue:

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

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

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

Currently thinking through what's going on in
HasManyThrough::afterUpdate

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



[Lift] Re: Db.addLogFunc

2009-08-28 Thread marius d.

EXCELLENT WORK DEREK !

On Aug 28, 7:28 pm, Derek Chen-Becker  wrote:
> Hi all,
>     I've made a change to the Mapper logging functionality in
> wip-dcb-sql-log-wrappers. The DB.addLogFunc method has changed to:
>
> addLogFunc( f: (DBLog,Long) => Any)
>
> where DBLog is a new trait (below) and the Long corresponds to the *total*
> duration of a given DB execution method. DBLog is defined as:
>
> trait DBLog {
>   ... private stuff up here ...
>   /** Return a list of all of the DBStatementEntry instances in the log
> buffer */
>   def statementEntries : List[DBStatementEntry] = ...
>
>   /** Return a list of all of the DBMetaEntry instances in the log buffer */
>   def metaEntries : List[DBMetaEntry] = ...
>
>   /** Return all log buffer entries */
>   def allEntries : List[DBLogEntry] = ...
>
> }
>
> and we have some new event class/traits:
>
> trait DBLogEntry {
>   def statement : String
>   def duration : Long}
>
> object DBLogEntry {
>   def unapply(obj : Any) = obj match {
>     case entry : DBLogEntry => Some(entry.statement,entry.duration)
>     case _ => None
>   }}
>
> case class DBStatementEntry(statement : String, duration : Long) extends
> DBLogEntry
> case class DBMetaEntry(statement : String, duration : Long) extends
> DBLogEntry
>
> Statements are SQL statements, prepared or immediate, and meta entries
> correspond to things like getMaxRows, getGeneratedKeys, etc. As you can see,
> each individual statement records its own duration as well, so you can get
> fine-grained detail on all activity. An example log function in Boot could
> look like:
>
>     DB.addLogFunc {
>       case (query, time) => {
>         Log.info("All queries took " + time + "ms: ")
>         query.allEntries.foreach({ case DBLogEntry(stmt, duration) =>
> Log.info(stmt + " took " + duration + "ms")})
>         Log.info("End queries")
>       }
>     }
>
> And we get output like:
>
> INFO - All queries took 17ms:
> INFO - Exec update "INSERT INTO users
> (lastname,locale,password_pw,password_slt,validated,uniqueid,timezone,firstname,email,superuser,textarea)
> VALUES
> ("C","en_US","GzwLqDpmJ6TrECg06bGKvOAQxyc=","1JTAWGSSYLJHXASO",1,"DU0G0RT3IFOA0NHSY5QQQTX42BOIHDGI","US/Mountain","D","
> d...@c.com",0,"")" : updated 1 rows took 9ms
> INFO - Get generated keys : rs =
> oracle.jdbc.driver.oraclereturnresult...@23f9e6e5 took 2ms
> INFO - Closed Statement took 0ms
> INFO - End queries
>
> Note that this code does introduce a breaking change if you're already using
> log functions, since the addLogFunc signature has changed. If I can get a
> review on the code before I merge to master I would appreciate it.
>
> Derek
>
> On Sat, Aug 15, 2009 at 8:02 AM, Derek Chen-Becker 
> wrote:
>
> > OK, a preliminary version of log wrappers is checked in on
> > wip-dcb-sql-log-wrappers. I'll merge it on Tuesday if no one sees any
> > problems with it.
>
> > Derek
>
> > On Tue, Aug 11, 2009 at 11:08 AM, Derek Chen-Becker  > > wrote:
>
> >> Will do.
>
> >> On Tue, Aug 11, 2009 at 2:33 AM, marius d. wrote:
>
> >>> Please do so. If you need any help for some reason (time availability
> >>> etc.) please let me know. As a note probably the wrappers should be
> >>> only only when there is at least one log function registered.
>
> >>> Br's,
> >>> Marius
>
> >>> On Aug 6, 11:48 pm, Derek Chen-Becker  wrote:
> >>> > If there's a consensus that we want our own JDBC wrappers I'll go ahead
> >>> and
> >>> > write them.
>
> >>> > Derek
>
> >>> > On Thu, Aug 6, 2009 at 1:19 PM, marius d. 
> >>> wrote:
>
> >>> > > Probably building our own wrappers would be more lightweight then
> >>> 3-rd
> >>> > > party. Jus' guessing
>
> >>> > > Br's,
> >>> > > Marius
>
> >>> > > On Aug 6, 9:58 pm, Derek Chen-Becker  wrote:
> >>> > > > Well, I started looking at it and determined that the only way for
> >>> us to
> >>> > > > truly log the queries would be to essentially make our own wrappers
> >>> over
> >>> > > > Statement and PreparedStatement. There are projects (log4jdbc,
> >>> notably)
> >>> > > that
> >>> > > > already do this, and in a transparent manner. I'm not sure that
> >>> adding a
> >>> > > > whole bunch of SQL logging directly to Lift is better than
> >>> leveraging
> >>> > > some
> >>> > > > existing libraries to do it.
>
> >>> > > > Derek
>
> >>> > > > On Thu, Aug 6, 2009 at 11:03 AM, marius d. <
> >>> marius.dan...@gmail.com>
> >>> > > wrote:
>
> >>> > > > > Yeah we're aware of that. That is based on toString application
> >>> which
> >>> > > > > is JDBC driver dependent. I think Derek started some work on this
> >>> to
> >>> > > > > correct this behavior. Derek ?
>
> >>> > > > > Br's,
> >>> > > > > Marius
>
> >>> > > > > On Aug 6, 8:01 pm, jon  wrote:
> >>> > > > > > Hi,
>
> >>> > > > > > I have the following in boot:
> >>> > > > > >   DB.addLogFunc((query, len) => Log.info("The query: "+query+"
> >>> took
> >>> > > > > > "+len+" milliseconds"))
>
> >>> > > > > > I was expecting the query parameter to be sql, but it's
> >>> actually some
> >>> > 

[Lift] Re: has anyone seen this exception?

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

On Fri, Aug 28, 2009 at 12:20 AM, Ross Mellgren  wrote:

> That error sounds like it's probably that the remote server is
> disconnecting prematurely, or is not handling Transfer-Encoding: Chunked as
> HttpURLConnection expects.
> Have you tried getting whatever URL it's trying with wget or curl?
>
> -Ross
>
> On Aug 27, 2009, at 7:28 PM, Jack Widman wrote:
>
> Here is the code I am using. The exception is happening at line 12, the
> line that goes  line =
> br.readLine()
>  The exception is happening alot. Any ideas?
>
> package com.authoritude.snippet
>
> import java.io.{InputStreamReader, BufferedInputStream, BufferedReader,
> OutputStreamWriter, InputStream}
>
> object StreamUtil {
>   def streamToString(stream: InputStream): String = {
> val buf = new StringBuilder
> val br = new BufferedReader(new InputStreamReader(stream))
> var line: String = null
> var eof = false
> while (! eof) {
>   line = br.readLine()
>   if (line == null) eof = true else
> buf.append(line).append("\n")
> }
> buf.toString
>   }
> }
>
>
> On Thu, Aug 27, 2009 at 5:49 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> This happens sometimes when the client disconnects before the
>> communications with the server is complete.  I see them from time to time
>> and they indicate to me that the Internet is a random place.
>>
>> On Thu, Aug 27, 2009 at 12:06 PM, jack  wrote:
>>
>>>
>>> Has anyone seen this error? I get it while transforming a Stream into
>>> a String. The stream is from an http request I just made.
>>>
>>> Message: java.io.IOException: Premature EOF
>>>sun.net.www.http.ChunkedInputStream.readAheadBlocking
>>> (ChunkedInputStream.java:556)
>>>sun.net.www.http.ChunkedInputStream.readAhead
>>> (ChunkedInputStream.java:
>>> 600)
>>>sun.net.www.http.ChunkedInputStream.read
>>> (ChunkedInputStream.java:687)
>>>java.io.FilterInputStream.read(FilterInputStream.java:133)
>>>sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read
>>> (HttpURLConnection.java:2419)
>>>sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282)
>>>sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:324)
>>>sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176)
>>>java.io.InputStreamReader.read(InputStreamReader.java:184)
>>>java.io.BufferedReader.fill(BufferedReader.java:153)
>>>java.io.BufferedReader.readLine(BufferedReader.java:316)
>>>java.io.BufferedReader.readLine(BufferedReader.java:379)
>>>com.abc.snippet.StreamUtil$.streamToString(StreamUtil.scala:12)
>>>
>>>
>>>
>>
>>
>> --
>> Lift, the simply functional web framework http://liftweb.net
>> Beginning Scala http://www.apress.com/book/view/1430219890
>> Follow me: http://twitter.com/dpp
>> Git some: http://github.com/dpp
>>
>>
>>
>>
>
>
>
>
>
> >
>

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



[Lift] Re: Implementing new datatypes into metamapper

2009-08-28 Thread Derek Chen-Becker
Well, off the top of my head this may require some changes to the MetaMapper
code to get working. Looking at the example PG code that you linked to, they
use setObject on the PreparedStatement to insert CIDR objects. The problem
is that the current MetaMapper code *always* uses the overload of setObject
that takes the type parameter, and as you've discovered, there is no type
for CIDR. We could maybe add a flag or special Type that tells MetaMapper to
use the setObject without the type...

Derek

On Tue, Aug 25, 2009 at 9:18 PM, Franz Bettag  wrote:

>
> Hey guys,
>
> i've been successfull with lift so far, now i want to do some more in
> depth stuff. anyway, i am missing the postgresql cidr/ip datatypes.
> Since they mostly work like strings i did the following:
>
> import _root_.net.liftweb.mapper._
> import _root_.net.liftweb.http.{S, FieldError}
> import _root_.java.sql.{ResultSet, Types}
> import _root_.java.util.regex._
> import _root_.scala.xml.Text
>
> object MappedCIDR {
>val ipv4 =
> Pattern.compile("^25[0-5]|2[0-4]\\d|[01]\\d{2}|\\d{1,2})(\
> \.(25[0-5]|2[0-4]\\d|[01]\\d{2}|\\d{1,2})){3}(/(3[012]|[12]\\d|\\d)$")
>val ipv6 = Pattern.compile("^\\w*\\:\\w*\\:\\w*$")
>def valid(ip: String): Boolean = ipv4.matcher(ip).matches ||
> ipv6.matcher(ip).matches
>def validIPAddr_?(ip: String) = valid(ip)
> }
>
>
> class MappedCIDR[T<:Mapper[T]](owner: T, maxLen: Int) extends
> MappedString[T](owner, maxLen) {
>
>/**
> * Get the JDBC SQL Type for this field
> */
>def targetSQLType = Types.VARCHAR
>
>override def setFilter = notNull _ :: toLower _ :: trim _ ::
> super.setFilter
>override def validate =  {
>(
>if (MappedCIDR.ipv4.matcher(i_is_!).matches ||
> MappedCIDR.ipv6.matcher(i_is_!).matches()) Nil
>else List(FieldError(this,
> Text(S.??("invalid.ip.address"
>) ::: super.validate
>}
>
> }
>
> The question is, how would one go about implementing a type which is
> not in sql.Types? ;)
> I found some jdbc driver extensions for that:
> http://oak.cats.ohiou.edu/~rf358197/jdbc/2/
>
> Patching the current driver is painless, but i am still not sure how
> to go on.
>
> Can anyone gimme some advice at what code i should look which would
> give me the best example for this?
>
> Thanks!
> >
>

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



[Lift] Re: Mapper with custom id

2009-08-28 Thread Derek Chen-Becker
I'm probably missing something here, but wouldn't putting those 5 lines of
code into a trait work?

trait ManualValue {
   /* allow user-defined primary key */
   override def writePermission_? = true
   override def dbAutogenerated_? = false
   private var myDirty = false
   override def dirty_? = myDirty
   override def dirty_?(b : Boolean) = { myDirty = b; super.dirty_?(b) }
}

object myId extends MappedLongIndex(this) with ManualValue

If that does work, I don't see any issue with adding that trait to the
Mapper library for others to use...

Derek

On Tue, Aug 25, 2009 at 12:42 PM, Naftoli Gugenheim wrote:

>
>
> On Tue, Aug 25, 2009 at 2:31 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>>
>>
>> On Tue, Aug 25, 2009 at 10:56 AM, Naftoli Gugenheim > > wrote:
>>
>>> It definitely would have been an option, although it would have been
>>> more difficult due to the complex structure of the new database. But I
>>> want to understand why it can't work the way I thought it would.
>>
>>
>>
>> Peter provided code that allows you to override autogeneration of keys.
>>
>
> Like I said, it doesn't make sense to add 5 lines of code to 13 mappers
> each just to make importing simpler. That code is good for a
> non-autogenerated primary key.
>
> Why does it work the way it does?  Because in the nearly 3 year life of
>> Mapper, you're the first person that's asked for the feature.  Because the
>> cost of changing Mapper to work differently (especially when there's a
>> work-around) and testing it and making sure it doesn't break isn't worth it.
>>
> Well, I can't argue with that...
>
> But is it really so complicated to change? Would the following not cover
> all the bases?
> 1) A private var on the mapper, _saved_? etc., initialized to false
> 2) When find etc. creates an instance it uses reflection to set this
> variable to true
> 3) When save is successful it sets this variable to true
> 4) def saved_? returns the value of the var.
> Wouldn't that be more accurate from a logical standpoint? I'm not coming
> from the angle of, "I have a use case for a feature," but from, "doesn't
> this use case bring out a hole in the logic and demonstrate that the index
> can be nondefault and still represent a new record (aside from MSAccess)?"
>
> Regards
>
>
> >
>

--~--~-~--~~~---~--~~
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] Creating your own tags?

2009-08-28 Thread Timothy Perrett

Guys,

If I wanted to create my own set of custom tags that looked like:



Ive not seen anyone ask this before and I know I cant use LiftTagPF to
do it, so how would one go about doing such trickery? Can I still make
use of lift goodness for snippets etc?

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



[Lift] Re: (beginner question) Liftweb View folder

2009-08-28 Thread dan

On Aug 27, 12:26 pm, David Pollak 
wrote:
> On Thu, Aug 27, 2009 at 9:49 AM, Daniel Nelson  wrote:
> > Hello,
>
> > *Problem*
> > I'm new to Lift/Scala and trying to understand/experiment with Lift's View
> > folder.  I've not gotten past a 404 error on the browser (as it relates to
> > the View folder; templates render fine).
>
> I'd suggest using Lift 1.1-SNAPSHOT... you would have likely gotten a polite
> error message.
>
> In this case, I believe you have to add XmlFun/index to your sitemap in
> Boot.scala
>
>
>
>
>
> > *Background/Environment*
> > I've been reading "Exploring Lift" (~Section 3.7) along with "What's the
> > 'View' folder for?" fromhttp://wiki.liftweb.net/index.php/FAQ.
>
> > Following are the URL and corresponding class (in the View Folder and
> > adapted fromhttp://github.com/dpp/liftweb/...   
> > here).
>
> > The server is maven/jetty.
>
> > I'm struggling to find other reading materials/examples which highlight my
> > error(s); any help is appreciated.  Thanks!  Dan
>
> > ~~~
>
> > URL:http://localhost:8080/XmlFun/index
>
> > package org.delreino.simplyLift.view
>
> > import _root_.scala.xml.{Text, Node, NodeSeq}
> > import _root_.net.liftweb.http._
> > import S._
> > import _root_.net.liftweb.util._
>
> > class XmlFun extends LiftView {
> >     def dispatch = Map("index" -> render _)
> >     def render = {
> >         println ("XmlFun")
> >         Full(
> >         
> >         XMLFun
> >         )
> >     }
> > }
>
> --
> 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

Yes; thank you very much, David.  My gap was with sitemap's role in
exposing/enabling the View folder.

Thanks,
Dan

--~--~-~--~~~---~--~~
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 use thread in lift

2009-08-28 Thread David Pollak
Using threads in Lift is the same as using threads in any JVM-based
application.  Scala has a particular friendly mechanism for dealing with
threads called Actors (others have noted this).  Combined with Futures, they
make for some nice coding.  Here's an example:

import scala.actors._
import Actor._

object Actor1 extends Actor {
  def act = loop {
react {
  case "M1" =>
  Thread.sleep(2000)
  reply((8 to 15).toList)
}
  }

  this.start
}

object Actor2 extends Actor {
  def act = loop {
react {
  case "M1" =>
  Thread.sleep(1000)
  reply((100 to 103).toList)
}
  }

  this.start
}

val start = System.currentTimeMillis

val f1 = Actor1 !! ("M1", {case a: List[Int] => a})
println("Got a future from Actor 1: "+f1)
println("Time1: "+(System.currentTimeMillis - start))

val f2 = Actor2 !! ("M1", {case a: List[Int] => a})
println("Got a future from Actor 2: "+f2)
println("Time2: "+(System.currentTimeMillis - start))

println("Answer: "+(f1() ::: f2()))
println("Took: "+(System.currentTimeMillis - start))


The main thread sends messages to the two different actors and receives a
Future from each.  The time to receive the future is very short, but the
thread blocks on the application of f1 and f2... waiting for the answers
from the Actors.

Hope you find this useful

On Fri, Aug 28, 2009 at 2:05 AM, pravin  wrote:

>
> Hi,
> i want to use thread in my lift application.
> I have two Lists i.e. List1() and List2();
> when i click on submit button
> i want to do following things -
>
> i am executing to method  to populate above to list -;
>
> List1() = fun1();
> List2() = fun2();
>
> So i want to do above things with thread s
>
> thread 1 will do List1() = fun1();
> and thread 2 will do List2() = fun2();
>
> so i can increase performance of my application
>
> Note:serial execution is working
>
> Is this possible with lift
>
>
> >
>


-- 
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: authentication and access control

2009-08-28 Thread Timothy Perrett


A your talking about access control? That is something different. See
DPP's response about that as his answer I believe is what you want.

Regarding the JPA example I'll look at that - there have been some breaking
changes in trunk recently so its likely that they have not been updated.

Cheers, Tim

On 28/08/2009 12:47, "Chris Lewis"  wrote:

> 
> Tim,
> 
> No, just looking around at a higher level. Back to what I like about
> spring security, it stays entirely out of application code's way (as
> does the protouser stuff). I will look at those auth examples, and I
> will poke through (Mega)ProtoUser source (I'm more accustomed to having
> an application component manage access control, as opposed to http auth.
> 
> On another note, are you using lift 1.1-M4? I used the jpa basic
> archetype last night and the web module is broken (mainly imports in Boot).
> 
> Thanks again for your input!
> 
> Timothy Perrett wrote:
>> Chris,
>> 
>> Are you thinking along the lines of JAAS or similar? As Marius said,
>> we currently don't have a defined way of doing general purpose
>> authentication within Lift apps
>> 
>> Cheers, Tim
>> 
>> Sent from my iPhone
>> 
>> On 28 Aug 2009, at 08:14, "marius d."  wrote:
>> 
>>> I'm not sure you HTTP authentication is what your looking for. Lift
>>> has support for both BASIC and DIGEST authentication models
>>> (irrespective of any persistence technology) and you can grant access
>>> based on Roles defined as a hierarchical structure.
>>> 
>>> See /examples/http-authentication application.
>>> 
>>> As far as Mapper goes it has a built in ProtoUser implementation for
>>> login, registration, forgot password etc.
>>> 
>>> Br's,
>>> Marius
>>> 
>>> On Aug 28, 4:42 am, Chris Lewis  wrote:
 Lift users,
 
 I'm curious what you all are using for user access control (Mapper
 users
   excluded). I'm seriously evaluating lift for a project that will
 use
 JPA. My full time job uses Spring Security, which while nice in
 that it
 stays out of the way, is too clunky for my tastes. I haven't
 dissected
 how lift implements it with Mapper, but wanted to ask the group
 first.
 Thanks!
 
 chris
 
>> 
>>> 
>> 
> 
> > 
> 



--~--~-~--~~~---~--~~
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: Scope issues with CometActors

2009-08-28 Thread David Pollak
On Thu, Aug 27, 2009 at 11:24 PM, Spencer Uresk  wrote:

> That did the trick, and I understand what is going on much better now.
> Thank you!
>
> For some reason my brain is having trouble adjusting to the idea that you
> can generate more sophisticated markup in Scala code.


I think it's okay to have non-display XML appear in your scala code.  My
pattern for something like this is to have view code that looks like:


  ... the view template to be passed to the comet actor goes here


And my Scala code looks like:

class PersonActor {
  def select(in: NodeSeq): NodeSeq =
  {in}
}

Thus you're preserving the view code and using the PersonActor snippet to
rewrite the view code to insert the correct name.

It's also a reminder of why Lift's recursive view rendering is so powerful.
 Jorge Ortiz once likened it to a very verbose Lisp.  But the fact that
Lift's templating rules are applied to the results of snippets means that
you have an awful lot of power.

I'm still used to the world of JSF and the like where all the markup is in a
> separate (non-code) file and you use EL expressions to accomplish something
> similar, so this has been a good example for me.
>
> Thanks again,
>
> - Spencer
>
> On Thu, Aug 27, 2009 at 8:38 PM, David Pollak <
> feeder.of.the.be...@gmail.com> wrote:
>
>> 
>> The optional name attribute allows you to have different comet actor names
>> (e.g., one per person).  You can retrieve the CometActor's name via the name
>> method, which returns a Box[String].
>>
>> In your CometActor, make sure to:
>>
>> override def lifespan = Full(5 minutes)
>>
>> This will make the particular CometActor go away if it does not appear on
>> a page for a 5 minute span.
>>
>> This lets you have a different CometActor per person, but allows you to
>> share a single CometActor instance for a given session for a given name
>> across browser windows/tabs.
>>
>> I hope this helps and I'd suggest against using SessionVars for passing
>> setup information to CometActors.
>>
>>
>> On Thu, Aug 27, 2009 at 7:28 PM, Spencer Uresk  wrote:
>>
>>> Hey all,
>>>
>>> I'm trying to build an app that takes advantage of the Comet support in
>>> Lift. This is a simple app that displays all messages from a given person
>>> and shows new messages as they are added. At first, I struggled with trying
>>> to pull the request parameter (the url looks like this - /person/1) into my
>>> CometActor, and then I found a message on the lift board that talked about
>>> the scope mismatch between the request scope and a CometActor, and
>>> recommends setting a session variable that the CometActor then reads.
>>>
>>> The scope mismatch makes sense to me, so I tried the suggested way of
>>> doing it, which worked. However, now when I go back to the home page and
>>> select another person to view messages for, I still see the the old
>>> messages. After some testing, it appears that CometActors on the same page
>>> are not re-created if there is one already active. I can't seem to find any
>>> method that gets called on it when the page is rendered either, and I am not
>>> sure how to update the state of the CometActor so that it retrieves the
>>> proper messages.
>>>
>>> Is there any documentation or examples for using CometActors in
>>> conjunction with a request parameter like that? Or is there a better way
>>> altogether for me to be doing this?
>>>
>>> Thank you,
>>>
>>> - Spencer
>>>
>>>
>>>
>>
>>
>> --
>> 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: error in http authetication and openid

2009-08-28 Thread David Pollak
I think you'll be best off protecting your resource with basic auth to
determine who the user is but using sitemap (for HTML pages) and guards in
partial functions (for web services) to enforce URL-level RBAC.

On Fri, Aug 28, 2009 at 2:44 AM, Timothy Perrett wrote:

>
> It should not matter if its append or prepend (relatively speaking) as
> its a RuleSeq[T]
>
> OOTB, the HTTP Auth stuff has nothing to do with ProtoUser... you
> could probably knit them together, but that is not what it is designed
> to do from the starting blocks...
>
> Cheers, Tim
>
> On Aug 28, 8:09 am, iboy  wrote:
> > Thanks Timothy
> >
> > That helped me  out a lot but i have one doubt that as per given in
> > liftbook code i used LiftRules. httpAuthProtectedResource.append
> > but new code used prepend  and secondly how can we apply the role
> > based access to the user  model so that when signing in we can
> > implicitly know that this user has admin rights.
> >
> > Best
> >
> > On Aug 27, 3:47 pm, Timothy Perrett  wrote:
> >
> >
> >
> > > Please check:
> >
> > >http://is.gd/2BwGf
> >
> > > Can you check your code looks like that and if your still getting the
> > > problem?
> >
> > > Cheers, Tim
> >
> > > On 27/08/2009 11:34, "iboy"  wrote:
> >
> > > > Hi all
> > > > i am new to scala and lift.
> > > > while trying to do a sample project i tried to use httpauthentication
> > > > code given in liftbook (7.14 authentication example) and i am getting
> > > > following errors
> >
> > > > a) while using import auth._
> >
> > > >  error: value auth not found
> > > > if i try using  _root_.net.liftweb.http.auth._
> > > > i get
> > > >  error: value auth is not a member of package net.liftweb.http
> > > > import _root_.net.liftweb.http.auth._
> >
> > > > any help is appreciated
> >
> > > > i am using  scala 2.7.3 final and maven 2.0.9
> >
>


-- 
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 do pagination in lift application...

2009-08-28 Thread David Pollak
Our support for SQL Server is not complete.  Please file tickets with
specific use cases at http://github.com/dpp/liftweb/issues
We currently have little demand for SQL Server support.  If you have an app
that's greenlighted for production, please contact me off-list about it and
we can talk about increasing the priority of SQL Server support.

On Fri, Aug 28, 2009 at 2:10 AM, pravin  wrote:

>
> Hi..
> i am using lift ORM (mapper framework) and MS SQL server(2008)
> i want to do pagination in my application.
>
> i tried with  to starAt() and maxRows() but this generate Limit
> query...
>
> And MSSQL server not support limit query (it uses top for same..)
>
>
> So how can i do pagination  with Lift ORM and MSSQL Server
>
>
> Thanks
> -Pravin
>
>
> >
>


-- 
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: authentication and access control

2009-08-28 Thread David Pollak
On Thu, Aug 27, 2009 at 6:42 PM, Chris Lewis wrote:

>
> Lift users,
>
> I'm curious what you all are using for user access control (Mapper users
>  excluded). I'm seriously evaluating lift for a project that will use
> JPA. My full time job uses Spring Security, which while nice in that it
> stays out of the way, is too clunky for my tastes. I haven't dissected
> how lift implements it with Mapper, but wanted to ask the group first.
> Thanks!


For HTML access control, Lift's SiteMap offers URL level protection of pages
(and menu generation based on the access control rules.)  For each Loc
(location) in your sitemap, you can chain together If() and Unless() clauses
to define what rules are applied to each page.  These rules are based on
invoking functions (e.g., User.superUser_?) and can be arbitrarily complex.

For protecting non-sitemap resources (stuff that's served up via a custom
dispatch [DispatchPF]), it's best practice to put a guard in the partial
function:

{
  case Req("api" :: "accounts" :: Nil, _, GetRequest) if
currentUserCanViewAccounts_? => renderAccounts _
}

Hope this helps.


>
>
> chris
>
> >
>


-- 
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: authentication and access control

2009-08-28 Thread Chris Lewis

Tim,

No, just looking around at a higher level. Back to what I like about 
spring security, it stays entirely out of application code's way (as 
does the protouser stuff). I will look at those auth examples, and I 
will poke through (Mega)ProtoUser source (I'm more accustomed to having 
an application component manage access control, as opposed to http auth.

On another note, are you using lift 1.1-M4? I used the jpa basic 
archetype last night and the web module is broken (mainly imports in Boot).

Thanks again for your input!

Timothy Perrett wrote:
> Chris,
> 
> Are you thinking along the lines of JAAS or similar? As Marius said,  
> we currently don't have a defined way of doing general purpose  
> authentication within Lift apps
> 
> Cheers, Tim
> 
> Sent from my iPhone
> 
> On 28 Aug 2009, at 08:14, "marius d."  wrote:
> 
>> I'm not sure you HTTP authentication is what your looking for. Lift
>> has support for both BASIC and DIGEST authentication models
>> (irrespective of any persistence technology) and you can grant access
>> based on Roles defined as a hierarchical structure.
>>
>> See /examples/http-authentication application.
>>
>> As far as Mapper goes it has a built in ProtoUser implementation for
>> login, registration, forgot password etc.
>>
>> Br's,
>> Marius
>>
>> On Aug 28, 4:42 am, Chris Lewis  wrote:
>>> Lift users,
>>>
>>> I'm curious what you all are using for user access control (Mapper  
>>> users
>>>   excluded). I'm seriously evaluating lift for a project that will  
>>> use
>>> JPA. My full time job uses Spring Security, which while nice in  
>>> that it
>>> stays out of the way, is too clunky for my tastes. I haven't  
>>> dissected
>>> how lift implements it with Mapper, but wanted to ask the group  
>>> first.
>>> Thanks!
>>>
>>> chris
>>>
> 
> > 
> 

--~--~-~--~~~---~--~~
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 use thread in lift

2009-08-28 Thread Stefan Langer
Are you sure you are increasing performance?

--~--~-~--~~~---~--~~
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 use thread in lift

2009-08-28 Thread Timothy Perrett


Pravin, why not use scala actors?

Cheers, Tim

On 28/08/2009 10:05, "pravin"  wrote:

> 
> Hi,
> i want to use thread in my lift application.
> I have two Lists i.e. List1() and List2();
> when i click on submit button
> i want to do following things -
> 
> i am executing to method  to populate above to list -;
> 
> List1() = fun1();
> List2() = fun2();
> 
> So i want to do above things with thread s
> 
> thread 1 will do List1() = fun1();
> and thread 2 will do List2() = fun2();
> 
> so i can increase performance of my application
> 
> Note:serial execution is working
> 
> Is this possible with 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: Newbie Question design pattern for ORM in Lift

2009-08-28 Thread Bjarte Stien Karlsen

That looks very cool from a first glance.

mvh
Bjarte

On Fri, Aug 28, 2009 at 5:04 AM, rstradling wrote:
>
> git clone git://github.com/rstradling/DDLtoLiftORM.git  is the
> location of the git code.
>
> http://github.com/rstradling/DDLtoLiftORM is the web address
>
> I hope this is helpful to others.
>
> On Aug 27, 3:13 pm, rstradling  wrote:
>> Thanks for the answers everyone.  What David hit upon about wanting
>> objects to be subclassible is the conclusion I came to that would
>> work..if it existed.  I was hoping there was a way. :(.  Well, I guess
>> Naftoli has provided a possible solution but seems more involved than
>> I have the experience for.
>>
>> I will resort to putting the stuff on the generated classes and let
>> merge tools do the rest.
>>
>> Regarding sharing the codeI should be more specific in that it
>> parses ddl.  To be honest, I hope you all are not hoping for
>> muchbut I will get it up on github and when I do will reply to
>> this thread with the location.
>>
>> On Aug 27, 1:35 pm, David Pollak 
>> wrote:
>>
>> > On Thu, Aug 27, 2009 at 10:26 AM, rstradling 
>> > wrote:
>>
>> > > With a parser combinator I wrote to parse .sql and it outputs scala
>> > > orm files.
>>
>> > Care to share?  That'd be a pretty darned useful utility!
>>
>> > > Please note it is very specific to my needs (i.e. only
>> > > works with certain grammars (INSERTS) but that particular grammar is
>> > > all I needed to process at the time) but is written in a way that
>> > > could be extended to the full grammar (at least that was my
>> > > intent :)..
>>
>> > So... the problem is that objects in Scala are not subclassible.  What does
>> > this mean?  For example:
>>
>> > trait Foo {
>> >   object bar extends AnyRef
>>
>> > }
>>
>> > trait MyFoo extends Foo {
>> >   override object bar {
>> >     def cantDoIt = "sigh"
>> >   }
>>
>> > }
>>
>> > Back in the Scala 2.5 days, there was some talk about allowing this to
>> > happen, but it never did.  So, unfortunately, I can't think of a way for
>> > your sql generator to create a superclass that could be subclassed and have
>> > the effect that you want.
>>
>> > Sorry/
>>
>> > > On Aug 27, 1:09 pm, Naftoli Gugenheim  wrote:
>> > > > How do you auto-generate them?
>>
>> > > > On Thu, Aug 27, 2009 at 1:03 PM, rstradling 
>> > > wrote:
>>
>> > > > > I am using Lift 1.0 with the Mapper ORM module from Lift. I am a
>> > > > > newbie to Scala and Lift.  I have auto-generated my ORM classes from
>> > > > > a .sql file.  Given that these classes are auto-generated I would
>> > > > > prefer not to edit them directly and provide additional functionality
>> > > > > via inheritance.
>>
>> > > > > Say I have the following...
>> > > > > class StatGenerated extends LongKeyedMapper[StatGenerated] with IdPK 
>> > > > > {
>> > > > >   def getSingleton = StatGenerated
>> > > > >   object errors extends MappedLong(this)
>> > > > >   object hits extends MappedLong(this)
>> > > > >   object AB extends MappedLong(this)
>> > > > > }
>>
>> > > > > object StatGenerated extends StatGenerated with LongKeyedMetaMapper
>> > > > > [StatGenerated] {
>> > > > >   override def fieldOrder = List(errors, hits)
>> > > > > }
>>
>> > > > > class Statistics extends StatGenerated {
>> > > > >   def GetBattingAverage(id : Long) : float = {
>> > > > >                val stat = Stat.findByKey(id)
>> > > > >                stat.hits/stat.AB
>> > > > >   }
>> > > > > }
>>
>> > > > > Now what I would like to do is work with the Statistics class as my
>> > > > > ORM object...
>> > > > > But I believe everything that is ORM related is actually of type
>> > > > > StatGenerated rather than Statistics.  i.e. findByKey will return me 
>> > > > > a
>> > > > > StatGenerated rather than a Statistics class.  Is there any clever 
>> > > > > way
>> > > > > around this that I am missing without either modifying the generated
>> > > > > class or duplicating code?
>>
>> > --
>> > 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
>
> >
>



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

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



[Lift] Re: error in http authetication and openid

2009-08-28 Thread Timothy Perrett

It should not matter if its append or prepend (relatively speaking) as
its a RuleSeq[T]

OOTB, the HTTP Auth stuff has nothing to do with ProtoUser... you
could probably knit them together, but that is not what it is designed
to do from the starting blocks...

Cheers, Tim

On Aug 28, 8:09 am, iboy  wrote:
> Thanks Timothy
>
> That helped me  out a lot but i have one doubt that as per given in
> liftbook code i used LiftRules. httpAuthProtectedResource.append
> but new code used prepend  and secondly how can we apply the role
> based access to the user  model so that when signing in we can
> implicitly know that this user has admin rights.
>
> Best
>
> On Aug 27, 3:47 pm, Timothy Perrett  wrote:
>
>
>
> > Please check:
>
> >http://is.gd/2BwGf
>
> > Can you check your code looks like that and if your still getting the
> > problem?
>
> > Cheers, Tim
>
> > On 27/08/2009 11:34, "iboy"  wrote:
>
> > > Hi all
> > > i am new to scala and lift.
> > > while trying to do a sample project i tried to use httpauthentication
> > > code given in liftbook (7.14 authentication example) and i am getting
> > > following errors
>
> > > a) while using import auth._
>
> > >  error: value auth not found
> > > if i try using  _root_.net.liftweb.http.auth._
> > > i get
> > >  error: value auth is not a member of package net.liftweb.http
> > > import _root_.net.liftweb.http.auth._
>
> > > any help is appreciated
>
> > > i am using  scala 2.7.3 final and maven 2.0.9
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] how to use thread in lift

2009-08-28 Thread pravin

Hi,
i want to use thread in my lift application.
I have two Lists i.e. List1() and List2();
when i click on submit button
i want to do following things -

i am executing to method  to populate above to list -;

List1() = fun1();
List2() = fun2();

So i want to do above things with thread s

thread 1 will do List1() = fun1();
and thread 2 will do List2() = fun2();

so i can increase performance of my application

Note:serial execution is working

Is this possible with 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: how to use thread in lift

2009-08-28 Thread marius d.

Why don't you use scala actors?

... and after you populate asynchronously the two lists do you need to
report the lists back to client asynchronously (say Comet) or when the
page is rendered? ... If it's the later that you'd probably need a
count-down-latch or a cyclic barrier.

Br's,
Mairus

On Aug 28, 12:05 pm, pravin  wrote:
> Hi,
> i want to use thread in my lift application.
> I have two Lists i.e. List1() and List2();
> when i click on submit button
> i want to do following things -
>
> i am executing to method  to populate above to list -;
>
> List1() = fun1();
> List2() = fun2();
>
> So i want to do above things with thread s
>
> thread 1 will do List1() = fun1();
> and thread 2 will do List2() = fun2();
>
> so i can increase performance of my application
>
> Note:serial execution is working
>
> Is this possible with 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] How to do pagination in lift application...

2009-08-28 Thread pravin

Hi..
i am using lift ORM (mapper framework) and MS SQL server(2008)
i want to do pagination in my application.

i tried with  to starAt() and maxRows() but this generate Limit
query...

And MSSQL server not support limit query (it uses top for same..)


So how can i do pagination  with Lift ORM and MSSQL Server


Thanks
-Pravin


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



[Lift] Re: Using Lift to build a Web Service and the PUT HTTP method??

2009-08-28 Thread Charles F. Munat

If, for example, you are sending an "id" property, then you should be 
able to get it through the Req object via params:

req.params("id")

That's how I do it, but without seeing what you're sending, I can't be 
sure how you would do it.

It works the same way as with POST, so I'm not sure why you can't see 
it. Can you post some code?

Chas.

Alan M wrote:
> I'm trying to use PUT with Lift and it seems to be working, except I
> can't find the content I put.  I'm using jQuery on the front end (a
> custom front-end) and firebug seems to think the data gets sent.
> Although it doesn't show me the raw request, it adds a PUT tab that
> shows the key and value(I couldn't get PUT in jQuery to work without a
> key/value pair).  So where should I look for this data in the req?
> I've used POST and GET before without problem, but I need to use PUT
> here.  I looked in the body field and in the xml field (it is an xml
> string being PUT).  BTW, I'm using Lift .11 and scala 2.7.2.
> 
> So anyone doing this?  If so where is the PUT data?
> 
> Oh also should I upgrade Lift?  Last time I did (from .9 to .11) it
> was a lot of work.
> Alan
> > 
> 

--~--~-~--~~~---~--~~
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: error in http authetication and openid

2009-08-28 Thread iboy

Thanks Timothy

That helped me  out a lot but i have one doubt that as per given in
liftbook code i used LiftRules. httpAuthProtectedResource.append
but new code used prepend  and secondly how can we apply the role
based access to the user  model so that when signing in we can
implicitly know that this user has admin rights.

Best

On Aug 27, 3:47 pm, Timothy Perrett  wrote:
> Please check:
>
> http://is.gd/2BwGf
>
> Can you check your code looks like that and if your still getting the
> problem?
>
> Cheers, Tim
>
> On 27/08/2009 11:34, "iboy"  wrote:
>
>
>
>
>
> > Hi all
> > i am new to scala and lift.
> > while trying to do a sample project i tried to use httpauthentication
> > code given in liftbook (7.14 authentication example) and i am getting
> > following errors
>
> > a) while using import auth._
>
> >  error: value auth not found
> > if i try using  _root_.net.liftweb.http.auth._
> > i get
> >  error: value auth is not a member of package net.liftweb.http
> > import _root_.net.liftweb.http.auth._
>
> > any help is appreciated
>
> > i am using  scala 2.7.3 final and maven 2.0.9

--~--~-~--~~~---~--~~
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: authentication and access control

2009-08-28 Thread Timothy Perrett

Chris,

Are you thinking along the lines of JAAS or similar? As Marius said,  
we currently don't have a defined way of doing general purpose  
authentication within Lift apps

Cheers, Tim

Sent from my iPhone

On 28 Aug 2009, at 08:14, "marius d."  wrote:

>
> I'm not sure you HTTP authentication is what your looking for. Lift
> has support for both BASIC and DIGEST authentication models
> (irrespective of any persistence technology) and you can grant access
> based on Roles defined as a hierarchical structure.
>
> See /examples/http-authentication application.
>
> As far as Mapper goes it has a built in ProtoUser implementation for
> login, registration, forgot password etc.
>
> Br's,
> Marius
>
> On Aug 28, 4:42 am, Chris Lewis  wrote:
>> Lift users,
>>
>> I'm curious what you all are using for user access control (Mapper  
>> users
>>   excluded). I'm seriously evaluating lift for a project that will  
>> use
>> JPA. My full time job uses Spring Security, which while nice in  
>> that it
>> stays out of the way, is too clunky for my tastes. I haven't  
>> dissected
>> how lift implements it with Mapper, but wanted to ask the group  
>> first.
>> Thanks!
>>
>> chris
> >
>

--~--~-~--~~~---~--~~
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: authentication and access control

2009-08-28 Thread marius d.

I'm not sure you HTTP authentication is what your looking for. Lift
has support for both BASIC and DIGEST authentication models
(irrespective of any persistence technology) and you can grant access
based on Roles defined as a hierarchical structure.

See /examples/http-authentication application.

As far as Mapper goes it has a built in ProtoUser implementation for
login, registration, forgot password etc.

Br's,
Marius

On Aug 28, 4:42 am, Chris Lewis  wrote:
> Lift users,
>
> I'm curious what you all are using for user access control (Mapper users
>   excluded). I'm seriously evaluating lift for a project that will use
> JPA. My full time job uses Spring Security, which while nice in that it
> stays out of the way, is too clunky for my tastes. I haven't dissected
> how lift implements it with Mapper, but wanted to ask the group first.
> Thanks!
>
> chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Using Lift to build a Web Service and the PUT HTTP method??

2009-08-28 Thread David Pollak
On Thu, Aug 27, 2009 at 5:35 PM, Alan M  wrote:

>
> I'm trying to use PUT with Lift and it seems to be working, except I
> can't find the content I put.  I'm using jQuery on the front end (a
> custom front-end) and firebug seems to think the data gets sent.
> Although it doesn't show me the raw request, it adds a PUT tab that
> shows the key and value(I couldn't get PUT in jQuery to work without a
> key/value pair).  So where should I look for this data in the req?
> I've used POST and GET before without problem, but I need to use PUT
> here.  I looked in the body field and in the xml field (it is an xml
> string being PUT).  BTW, I'm using Lift .11 and scala 2.7.2.


Please either use Lift 1.0 or 1.1-SNAPSHOT.

The query parameters are parsed the same way for PUTs and POSTs...  If it's
xml, you have to make sure the mime type is "text/xml" or the Req's xml
parser will not try to parse it.

If you still can't get it working, please post a sample runnable application
and I'll take a look at it.


>
>
> So anyone doing this?  If so where is the PUT data?
>
> Oh also should I upgrade Lift?  Last time I did (from .9 to .11) it
> was a lot of work.
> Alan
> >
>


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