[Lift] Re: XML unescaping

2009-03-17 Thread Jeremy Mawson
Thanks David.


2009/3/17 David Pollak feeder.of.the.be...@gmail.com



 On Mon, Mar 16, 2009 at 8:51 PM, Jeremy Mawson 
 jeremy.mawson.w...@gmail.com wrote:

 Thanks Marc.  xml:group works nicely.

 For this exercise this is hypothetical, but it matches very closely a
 project I have enabled in the past using struts and JIBX...

 Say the data was sourced from an external party's service and there was a
 contractual agreement to not alter the data in any way? I.E. I'm stuck with
 the poorly formed HTML. Probably one could agree with the partner that the
 transformation to valid XHTML is appropriate, but I'll let the question
 stand anyway.

 Is poorly formed (but otherwise supported-by-browsers) HTML renderable via
 Lift at all?


 If it's supported by the browser, it will be rendered, but Firefox and
 Chrome will both complain about malformed XHTML.

 You could run the String through an HTML parser (there are a few floating
 around for Java that will parse poorly formed HTML) and then walk the nodes
 and build XML.  I would argue that this would satisfy any contractual
 requirements, although I no longer practice law, so I can't argue it on your
 behalf. :-)




 Cheers
 Jeremy



 2009/3/17 Marc Boschma marc+lift...@boschma.cxmarc%2blift...@boschma.cx
 


 On 17/03/2009, at 12:36 PM, Jeremy Mawson wrote:

 If I change the line to description -  *
 span{Unparsed(result.description)}/span*, it compiles but I have an
 unwanted span tag and worse ... if result.description is not well formed XML
 my page will fail to render! Firefox complains of an XML Parsing Error. The
 description field has an unmatched br tag (literally lt;brgt;) in the
 middle of it to force it onto two lines.


 Try description -
 xml:group{Unparsed(result.description)}/xml:group

 That wraps the string in a scala XML group node...

 With respect to the br tag, it should be br/ or br/br to be well
 formed. If you want to support non-well formed XML fro the database wouldn't
 you need to parse it and convert it to well formed first or upon retrieval ?

 Regards,

 Marc






 --
 Jeremy Mawson
 Senior Developer | Online Directories

 Sensis Pty Ltd
 222 Lonsdale St
 Melbourne 3000
 E: jeremy.maw...@sensis.com.au






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


 



-- 
Jeremy Mawson
Senior Developer | Online Directories

Sensis Pty Ltd
222 Lonsdale St
Melbourne 3000
E: jeremy.maw...@sensis.com.au

--~--~-~--~~~---~--~~
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: XML unescaping

2009-03-17 Thread TylerWeir

 scala val title = Catsby amp; Twisp

+1 for the Penny Arcade reference.

On Mar 16, 8:51 am, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Well, it may be that the XML output portion of Scala is escaping your
 ampersands a second time. For instance, check out this session in the
 interpreter:

 scala val title = Catsby amp; Twisp
 title: java.lang.String = Catsby amp; Twisp

 scala val escaped = span{title}/span
 escaped: scala.xml.Elem = spanCatsby amp;amp; Twisp/span

 scala val unescaped = span{ scala.xml.Unparsed(title) }/span
 unescaped: scala.xml.Elem = spanCatsby amp; Twisp/span

 Note that if you embed a String within XML elements, Scala will
 automatically escape any ampersands unless you wrap the String in a
 scala.xml.Unparsed instance. The second test there will render in the
 browser like Catsby amp; Twisp, because the ampersand was escaped. I know
 you're asking about the Utility object, but I think that would be fixing the
 symptom rather than the cause.

 Derek

 On Mon, Mar 16, 2009 at 6:13 AM, Jeremy Mawson jeremy.mawson.w...@gmail.com

  wrote:
  Hi,

  I've been mucking around with lift and having a great time. I have cooked
  up a page that retrieves XML from a datasource and renders it. However some
  of the text elements I extract are HTML encoded. When rendered in the
  browser it looks like HTML code, rather than rendered HTML.

  I looked for a scala utility to unescape this, found
  scala.xml.Utility.unescape, but could not get it working.

  Here's how I've tried to use it.

        val title = Utility.unescape(result \ title text, new
  StringBuilder)

  Unfortunately this always gives me a value of null, even though
  result.\(title).text is something like - Tsvangiraiamp;#39;s wife killed
  inlt;bgt;carlt;/bgt;crash - ABC News

  What could I be doing wrong? I realise this is probably a plain old scala
  question, but I hope someone here can help me anyway.

  Thanks
  Jeremy


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



[Lift] Re: Where to continue after Getting Started?

2009-03-17 Thread Timothy Perrett

Chas,

That took me a good 5 mins to read so i've no idea how long it took
you to write!! Good work that man... a great comparison.

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: Where to continue after Getting Started?

2009-03-17 Thread Charles F. Munat

I wrote it about as quickly as I could type it, so maybe ten minutes? 
It's not difficult when you *live* it 18 hours a day...

Timothy Perrett wrote:
 Chas,
 
 That took me a good 5 mins to read so i've no idea how long it took
 you to write!! Good work that man... a great comparison.
 
 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] Google Analytics

2009-03-17 Thread Charles F. Munat

Is anyone else using Google Analytics? I am getting this strange 
JavaScript error:

operation is not supported code: 9
  var pageTracker = _gat._getTracker(UA-5774043-2);

The Google scripts are supposed to be placed right before the closing 
body tag, but Lift inserts its own script in there. I can't imagine how 
that would make a difference, but it is the only thing different from 
what Google recommends.

Also, the analytics are not working.

Any ideas?

Chas.

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



[Lift] Re: Where to continue after Getting Started?

2009-03-17 Thread erik.fris...@googlemail.com

Thanks for the responses, guys.

So far I have developed big PHP apps with the Zend Framework, and I
found the apps quite manageable. Yes, it requires some careful
planning to not end up with a big mess of undocumented code, but so
far we always got there ;)

I think I will look into the Programming in Scala Book to get an
overview of Scala, then the Lift Book. I think it will all come to me
when I develop a small app. Thanks for all your feedback, it's really
exciting to get into this new language. I will stick around and let
you know how I progress.

Anyways, you guys are an amazing help. I really appreciate that.

Erik

On Mar 17, 4:45 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 Over the years I've written a fair amount of PHP code for in-house
 applications (enterprise ticket tracking system, network equipment
 management, etc) and the experience has generally not been great. I think
 PHP functions very well for compact, well-defined apps, but the lack of
 structure in the PHP libraries ends up being a burden to non-trivial
 projects IMHO. In particular, the library is inconsistent and often
 incoherent. As an example, compare database access (pretty common
 functionality) in PHP vs Java. One app I wrote in PHP started out running
 against MySQL and then later needed to change to SQL Server. What would have
 been a simple database URL change (and replacing a jar file) in Java was a
 non-trivial search and replace of code throughout the app. I seem to
 remember there also being some functions that didn't correlate between the
 two driver types. In short, it was a very painful experience. I know that
 Pear and some other facades have been developed to make this more
 transparent, but overall I still feel like the library doesn't have an
 overarching theme. It's more a whole lot of bits and pieces stitched
 together.

 Another advantage that Lift has, being built atop the JVM, is full access to
 all Java libs, and the simplicity of adding libraries as needed. If I need
 to add SNMP support to my Lift app (network equipment), I just drop the jar
 file in. To add SNMP to PHP I had to compile a whole slew of libraries and
 recompile the PHP module. On a similar vein, the ecosystem of Java libraries
 is (in my estimation) at least an order of magnitude larger and more mature
 than for what's out there for PHP.

 Finally, and most importantly, the view-first structure of Lift is huge.
 It's difficult to overstate how much this can help improve code organization
 and page structure. Essentially, you're writing a whole bunch of little
 components in Scala and then composing them using pure XML templates.
 Templates can embed other templates, and can embed themselves into other
 templates as well, so you have incredible flexibility in how you lay things
 out while keeping things fairly simple. The ability to keep your code and
 presentation layer stuff in small, easily digestible chunks is what will
 keep you and your team sane when you tackle big projects. Of course, you can
 do this in PHP as well, but with Lift the capability is an integral part of
 the overall design.

 You might want to take a look at our demo app for the book:

 http://github.com/tjweir/pocketchangeapp/tree/master

 It covers a lot of Liftisms (not all), and I'd be happy to answer any
 questions you have about it.

 Derek

 On Mon, Mar 16, 2009 at 7:29 PM, Charles F. Munat c...@munat.com wrote:



  PHP is a language that's easy to learn thus easy to get started with.
  But down the road, that ease comes with a steep price unless you are
  very disciplined about establishing protocols for coding and sticking to
  them. It is very easy to end up with unmaintainable spaghetti code. I
  speak from painful experience.

  PHP grew up by aggregation, thus it has an odd mixture of syntax and
  conventions, some from Perl, many from other languages. Very little is
  consistent. Not surprising from a language originally called personal
  home page -- though PHP coders don't like to be reminded of that.

  In short, PHP is fine for small sites and quick prototyping, or solving
  some minor problem, but I wouldn't recommend it for anything serious.
  Yes, I know that Facebook and many other big enterprise apps are written
  in PHP, but just because it's possible doesn't make it wise.

  Ruby and Python are dynamically-typed languages that typically run in an
  interpreter. Ruby in particular is very open, providing unwary coders
  with more than enough rope to hang themselves. They have very different
  styles. If I were doing it all over again and choosing between the two,
  I'd probably choose Python. I think it has more staying power (not least
  because of Google). And there are some very interesting frameworks
  available.

  Java is a powerful, statically-typed language that is compiled into
  byte-code and run in a virtual machine. (C# is Microsoft's rip of Java
  after they lost a lawsuit. In many ways it's a better language, but 

[Lift] Re: Where to continue after Getting Started?

2009-03-17 Thread David Pollak
On Tue, Mar 17, 2009 at 1:34 AM, erik.fris...@googlemail.com 
erik.fris...@googlemail.com wrote:


 Thanks for the responses, guys.

 So far I have developed big PHP apps with the Zend Framework, and I
 found the apps quite manageable. Yes, it requires some careful
 planning to not end up with a big mess of undocumented code, but so
 far we always got there ;)

 I think I will look into the Programming in Scala Book to get an
 overview of Scala,


Really great summaries from Charles and Derek.  I'd like to see these on the
wiki with a link from the Lift home page.

I'd like to suggest starting with Beginning
Scalahttp://apress.com/book/view/1430219890rather than Programming
in Scala.  Programming in Scala is a heavier text
that is a much broader view of the language.  Beginning Scala is shorter and
much more of an introductory text (at least the first 6 chapters.)  I view
Beginning Scala as a gateway drug to Programming in Scala.  Finally, the
Scala idioms in Beginning Scala are unsurprisingly similar to the idioms in
Lift (although I spend very little time actually discussing Lift in the
book.)


 then the Lift Book. I think it will all come to me
 when I develop a small app. Thanks for all your feedback, it's really
 exciting to get into this new language. I will stick around and let
 you know how I progress.

 Anyways, you guys are an amazing help. I really appreciate that.

 Erik

 On Mar 17, 4:45 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
  Over the years I've written a fair amount of PHP code for in-house
  applications (enterprise ticket tracking system, network equipment
  management, etc) and the experience has generally not been great. I think
  PHP functions very well for compact, well-defined apps, but the lack of
  structure in the PHP libraries ends up being a burden to non-trivial
  projects IMHO. In particular, the library is inconsistent and often
  incoherent. As an example, compare database access (pretty common
  functionality) in PHP vs Java. One app I wrote in PHP started out running
  against MySQL and then later needed to change to SQL Server. What would
 have
  been a simple database URL change (and replacing a jar file) in Java was
 a
  non-trivial search and replace of code throughout the app. I seem to
  remember there also being some functions that didn't correlate between
 the
  two driver types. In short, it was a very painful experience. I know that
  Pear and some other facades have been developed to make this more
  transparent, but overall I still feel like the library doesn't have an
  overarching theme. It's more a whole lot of bits and pieces stitched
  together.
 
  Another advantage that Lift has, being built atop the JVM, is full access
 to
  all Java libs, and the simplicity of adding libraries as needed. If I
 need
  to add SNMP support to my Lift app (network equipment), I just drop the
 jar
  file in. To add SNMP to PHP I had to compile a whole slew of libraries
 and
  recompile the PHP module. On a similar vein, the ecosystem of Java
 libraries
  is (in my estimation) at least an order of magnitude larger and more
 mature
  than for what's out there for PHP.
 
  Finally, and most importantly, the view-first structure of Lift is
 huge.
  It's difficult to overstate how much this can help improve code
 organization
  and page structure. Essentially, you're writing a whole bunch of little
  components in Scala and then composing them using pure XML templates.
  Templates can embed other templates, and can embed themselves into other
  templates as well, so you have incredible flexibility in how you lay
 things
  out while keeping things fairly simple. The ability to keep your code and
  presentation layer stuff in small, easily digestible chunks is what will
  keep you and your team sane when you tackle big projects. Of course, you
 can
  do this in PHP as well, but with Lift the capability is an integral part
 of
  the overall design.
 
  You might want to take a look at our demo app for the book:
 
  http://github.com/tjweir/pocketchangeapp/tree/master
 
  It covers a lot of Liftisms (not all), and I'd be happy to answer any
  questions you have about it.
 
  Derek
 
  On Mon, Mar 16, 2009 at 7:29 PM, Charles F. Munat c...@munat.com
 wrote:
 
 
 
   PHP is a language that's easy to learn thus easy to get started with.
   But down the road, that ease comes with a steep price unless you are
   very disciplined about establishing protocols for coding and sticking
 to
   them. It is very easy to end up with unmaintainable spaghetti code. I
   speak from painful experience.
 
   PHP grew up by aggregation, thus it has an odd mixture of syntax and
   conventions, some from Perl, many from other languages. Very little is
   consistent. Not surprising from a language originally called personal
   home page -- though PHP coders don't like to be reminded of that.
 
   In short, PHP is fine for small sites and quick prototyping, or solving
   some minor problem, 

[Lift] Re: XML unescaping

2009-03-17 Thread Derek Chen-Becker
Glad someone caught it :)

On Tue, Mar 17, 2009 at 2:32 AM, TylerWeir tyler.w...@gmail.com wrote:


  scala val title = Catsby amp; Twisp

 +1 for the Penny Arcade reference.

 On Mar 16, 8:51 am, Derek Chen-Becker dchenbec...@gmail.com wrote:
  Well, it may be that the XML output portion of Scala is escaping your
  ampersands a second time. For instance, check out this session in the
  interpreter:
 
  scala val title = Catsby amp; Twisp
  title: java.lang.String = Catsby amp; Twisp
 
  scala val escaped = span{title}/span
  escaped: scala.xml.Elem = spanCatsby amp;amp; Twisp/span
 
  scala val unescaped = span{ scala.xml.Unparsed(title) }/span
  unescaped: scala.xml.Elem = spanCatsby amp; Twisp/span
 
  Note that if you embed a String within XML elements, Scala will
  automatically escape any ampersands unless you wrap the String in a
  scala.xml.Unparsed instance. The second test there will render in the
  browser like Catsby amp; Twisp, because the ampersand was escaped. I
 know
  you're asking about the Utility object, but I think that would be fixing
 the
  symptom rather than the cause.
 
  Derek
 
  On Mon, Mar 16, 2009 at 6:13 AM, Jeremy Mawson 
 jeremy.mawson.w...@gmail.com
 
   wrote:
   Hi,
 
   I've been mucking around with lift and having a great time. I have
 cooked
   up a page that retrieves XML from a datasource and renders it. However
 some
   of the text elements I extract are HTML encoded. When rendered in the
   browser it looks like HTML code, rather than rendered HTML.
 
   I looked for a scala utility to unescape this, found
   scala.xml.Utility.unescape, but could not get it working.
 
   Here's how I've tried to use it.
 
 val title = Utility.unescape(result \ title text, new
   StringBuilder)
 
   Unfortunately this always gives me a value of null, even though
   result.\(title).text is something like - Tsvangiraiamp;#39;s wife
 killed
   inlt;bgt;carlt;/bgt;crash - ABC News
 
   What could I be doing wrong? I realise this is probably a plain old
 scala
   question, but I hope someone here can help me anyway.
 
   Thanks
   Jeremy
 
 
 


--~--~-~--~~~---~--~~
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: Google Analytics

2009-03-17 Thread Derek Chen-Becker
Can you send the beginning of the XHTML output, up to and including the GA
script?

Derek

On Tue, Mar 17, 2009 at 6:31 AM, Charles F. Munat c...@munat.com wrote:


 Is anyone else using Google Analytics? I am getting this strange
 JavaScript error:

 operation is not supported code: 9
  var pageTracker = _gat._getTracker(UA-5774043-2);

 The Google scripts are supposed to be placed right before the closing
 body tag, but Lift inserts its own script in there. I can't imagine how
 that would make a difference, but it is the only thing different from
 what Google recommends.

 Also, the analytics are not working.

 Any ideas?

 Chas.

 


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



[Lift] Ticket #19 (mail and character encoding)

2009-03-17 Thread Derek Chen-Becker
I'm looking at ticket #19:

http://liftweb.lighthouseapp.com/projects/26102/tickets/19-mailer-doesnt-handle-plain-text-encoding

The setText method is essentially a shortcut for setContent(...,
text/plain), but it also allows you to specify the character encoding.
Would anyone be opposed to modifying the code so that PlainMailBodyType uses
UTF-8 for character encoding? Would it be useful to provide an additional
case class, a la

PlainPlusBodyType(text : String, charset : String)

Derek

--~--~-~--~~~---~--~~
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] lift:snippet type=Foo.bar != lift:Foo.bar?

2009-03-17 Thread Clemens

Hello everybody,

I'm fairly new to lift (and to scala, to be honest), and just trying
to find my way around. So far I like what I'm seeing and deing, but
some things keep me puzzled.

Short version of my confusion: Is
lift:snippet type=SiteOps.add form=post.../lift:snippet
equivalent to
lift:SiteOps.add.../lift:SiteOps.add
?

Long version:
I was trying to implement a typical entry-form for database entities.
The model classes for the database entities have a variety of
verification checks. When checks fail, the form should be redisplayed,
with the previously entered (and probably erroneous) values filled in.
My snippet is pretty much a mixture of the various examples and the
starter guide:

def add(form: NodeSeq) = {
val invokedAs = S.invokedAs
val site = Site.create

def newSite(form: NodeSeq): NodeSeq = {
  def saveMe(): Unit = {
site.validate match {
  case Nil = site.save ; S.notice(Added  + site.name);
S.redirectTo(/sites/)
  case xs = S.error(xs) ; S.mapSnippet(invokedAs, newSite)
}
  }

  bind(site, form,
   name - site.name.toForm,
   abbreviation - site.abbreviation.toForm,
   submit - SHtml.submit(New, saveMe))
}

newSite(form)
  }

With the lift:snippet type=SiteOps.add form=post style tags,
everything works as expected (form fields are populated after a failed
validation). If I use lift:SiteOps.add, the form comes up empty
after a failed validation. What am I getting wrong?

Thanks in advance!

Best,
Clemens

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



[Lift] Re: lift:snippet type=Foo.bar != lift:Foo.bar?

2009-03-17 Thread David Pollak
lift:snippet type=SiteOps.add form=post == lift:SiteOps.add
form=post

If this is not the case, it's a Lift defect.

On Tue, Mar 17, 2009 at 8:41 AM, Clemens clemens.oer...@gmail.com wrote:


 Hello everybody,

 I'm fairly new to lift (and to scala, to be honest), and just trying
 to find my way around. So far I like what I'm seeing and deing, but
 some things keep me puzzled.

 Short version of my confusion: Is
 lift:snippet type=SiteOps.add form=post.../lift:snippet
 equivalent to
 lift:SiteOps.add.../lift:SiteOps.add
 ?

 Long version:
 I was trying to implement a typical entry-form for database entities.
 The model classes for the database entities have a variety of
 verification checks. When checks fail, the form should be redisplayed,
 with the previously entered (and probably erroneous) values filled in.
 My snippet is pretty much a mixture of the various examples and the
 starter guide:

 def add(form: NodeSeq) = {
val invokedAs = S.invokedAs
val site = Site.create

def newSite(form: NodeSeq): NodeSeq = {
  def saveMe(): Unit = {
site.validate match {
  case Nil = site.save ; S.notice(Added  + site.name);
 S.redirectTo(/sites/)
  case xs = S.error(xs) ; S.mapSnippet(invokedAs, newSite)
}
  }

  bind(site, form,
   name - site.name.toForm,
   abbreviation - site.abbreviation.toForm,
   submit - SHtml.submit(New, saveMe))
}

newSite(form)
  }

 With the lift:snippet type=SiteOps.add form=post style tags,
 everything works as expected (form fields are populated after a failed
 validation). If I use lift:SiteOps.add, the form comes up empty
 after a failed validation. What am I getting wrong?

 Thanks in advance!

 Best,
 Clemens

 



-- 
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: SQL Server Errors

2009-03-17 Thread Timothy Perrett

*bump*

Al, any progress on these?

Cheers, Tim

On Mar 10, 11:04 am, Timothy Perrett timo...@getintheloop.eu wrote:
 Is someone able to take ownership of these tickets?

 Cheers, Tim

 On Mar 9, 5:52 pm, Tim Perrett timo...@getintheloop.eu wrote:

  Guys,

  Just logged a couple of bugs for SQL Server drivers:

 http://liftweb.lighthouseapp.com/projects/26102/tickets/18-sql-server...

 http://liftweb.lighthouseapp.com/projects/26102/tickets/17-mappedtext...

  Can someone take a look? This really is not my speciality.

  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: SQL Server Errors

2009-03-17 Thread Derek Chen-Becker
I think the DateTime issue should be fixed pretty easily in MappedDateTime
itself. Let me make a new branch and make a minor change.

Derek

On Tue, Mar 17, 2009 at 12:09 PM, Timothy Perrett
timo...@getintheloop.euwrote:


 *bump*

 Al, any progress on these?

 Cheers, Tim

 On Mar 10, 11:04 am, Timothy Perrett timo...@getintheloop.eu wrote:
  Is someone able to take ownership of these tickets?
 
  Cheers, Tim
 
  On Mar 9, 5:52 pm, Tim Perrett timo...@getintheloop.eu wrote:
 
   Guys,
 
   Just logged a couple of bugs for SQL Server drivers:
 
  http://liftweb.lighthouseapp.com/projects/26102/tickets/18-sql-server.
 ..
 
  http://liftweb.lighthouseapp.com/projects/26102/tickets/17-mappedtext.
 ..
 
   Can someone take a look? This really is not my speciality.
 
   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: lift:snippet type=Foo.bar != lift:Foo.bar?

2009-03-17 Thread Clemens

That's good to hear - I like orthogonality.

I created a ticket for this, #21.

Thanks
Clemenns

On Mar 17, 12:26 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 lift:snippet type=SiteOps.add form=post == lift:SiteOps.add
 form=post

 If this is not the case, it's a Lift defect.





 On Tue, Mar 17, 2009 at 8:41 AM, Clemens clemens.oer...@gmail.com wrote:

  Hello everybody,

  I'm fairly new to lift (and to scala, to be honest), and just trying
  to find my way around. So far I like what I'm seeing and deing, but
  some things keep me puzzled.

  Short version of my confusion: Is
  lift:snippet type=SiteOps.add form=post.../lift:snippet
  equivalent to
  lift:SiteOps.add.../lift:SiteOps.add
  ?

  Long version:
  I was trying to implement a typical entry-form for database entities.
  The model classes for the database entities have a variety of
  verification checks. When checks fail, the form should be redisplayed,
  with the previously entered (and probably erroneous) values filled in.
  My snippet is pretty much a mixture of the various examples and the
  starter guide:

  def add(form: NodeSeq) = {
     val invokedAs = S.invokedAs
     val site = Site.create

     def newSite(form: NodeSeq): NodeSeq = {
       def saveMe(): Unit = {
         site.validate match {
           case Nil = site.save ; S.notice(Added  + site.name);
  S.redirectTo(/sites/)
           case xs = S.error(xs) ; S.mapSnippet(invokedAs, newSite)
         }
       }

       bind(site, form,
            name - site.name.toForm,
            abbreviation - site.abbreviation.toForm,
            submit - SHtml.submit(New, saveMe))
     }

     newSite(form)
   }

  With the lift:snippet type=SiteOps.add form=post style tags,
  everything works as expected (form fields are populated after a failed
  validation). If I use lift:SiteOps.add, the form comes up empty
  after a failed validation. What am I getting wrong?

  Thanks in advance!

  Best,
  Clemens

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

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



[Lift] Re: SQL Server Errors

2009-03-17 Thread Derek Chen-Becker
OK, actually, the change is in SqlServerDriver. I've made the change and I'm
running a build before committing. Once I push the branch could you check it
out and test? I'm looking at #17 right now, too.

Derek

On Tue, Mar 17, 2009 at 12:44 PM, Derek Chen-Becker
dchenbec...@gmail.comwrote:

 I think the DateTime issue should be fixed pretty easily in MappedDateTime
 itself. Let me make a new branch and make a minor change.

 Derek


 On Tue, Mar 17, 2009 at 12:09 PM, Timothy Perrett timo...@getintheloop.eu
  wrote:


 *bump*

 Al, any progress on these?

 Cheers, Tim

 On Mar 10, 11:04 am, Timothy Perrett timo...@getintheloop.eu wrote:
  Is someone able to take ownership of these tickets?
 
  Cheers, Tim
 
  On Mar 9, 5:52 pm, Tim Perrett timo...@getintheloop.eu wrote:
 
   Guys,
 
   Just logged a couple of bugs for SQL Server drivers:
 
  http://liftweb.lighthouseapp.com/projects/26102/tickets/18-sql-server.
 ..
 
  http://liftweb.lighthouseapp.com/projects/26102/tickets/17-mappedtext.
 ..
 
   Can someone take a look? This really is not my speciality.
 
   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: SQL Server Errors

2009-03-17 Thread Timothy Perrett

Hey Derek,

Awesome - thanks. I knew the DataTime one would be a simple fix - I
just don't know enough about mapper.

#17 is the one thats really hurting me right now... if you could fix
that I would be sooo grateful!

Cheers, Tim

On Mar 17, 6:02 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
 OK, actually, the change is in SqlServerDriver. I've made the change and I'm
 running a build before committing. Once I push the branch could you check it
 out and test? I'm looking at #17 right now, too.

 Derek

 On Tue, Mar 17, 2009 at 12:44 PM, Derek Chen-Becker
 dchenbec...@gmail.comwrote:

  I think the DateTime issue should be fixed pretty easily in MappedDateTime
  itself. Let me make a new branch and make a minor change.

  Derek

  On Tue, Mar 17, 2009 at 12:09 PM, Timothy Perrett timo...@getintheloop.eu
   wrote:

  *bump*

  Al, any progress on these?

  Cheers, Tim

  On Mar 10, 11:04 am, Timothy Perrett timo...@getintheloop.eu wrote:
   Is someone able to take ownership of these tickets?

   Cheers, Tim

   On Mar 9, 5:52 pm, Tim Perrett timo...@getintheloop.eu wrote:

Guys,

Just logged a couple of bugs for SQL Server drivers:

   http://liftweb.lighthouseapp.com/projects/26102/tickets/18-sql-server.
  ..

   http://liftweb.lighthouseapp.com/projects/26102/tickets/17-mappedtext.
  ..

Can someone take a look? This really is not my speciality.

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: SQL Server Errors

2009-03-17 Thread Derek Chen-Becker
OK, check out the wip-dcb-datetime branch and test that.

It looks like the CLOB object that jTDS returns doesn't override toString to
return the contents of the CLOB. It does, however, implement the
java.sql.Clob interface, so it may be possible to match that somehow and
make it work. I'm diving into parts of Mapper that I haven't really worked
with before, so no guarantees. Just to confirm, can you change your snippet
to use:

description - m.description.toString

and see if you get the same thing?

Thanks,

Derek



On Tue, Mar 17, 2009 at 1:05 PM, Timothy Perrett timo...@getintheloop.euwrote:


 Hey Derek,

 Awesome - thanks. I knew the DataTime one would be a simple fix - I
 just don't know enough about mapper.

 #17 is the one thats really hurting me right now... if you could fix
 that I would be sooo grateful!

 Cheers, Tim

 On Mar 17, 6:02 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
  OK, actually, the change is in SqlServerDriver. I've made the change and
 I'm
  running a build before committing. Once I push the branch could you check
 it
  out and test? I'm looking at #17 right now, too.
 
  Derek
 
  On Tue, Mar 17, 2009 at 12:44 PM, Derek Chen-Becker
  dchenbec...@gmail.comwrote:
 
   I think the DateTime issue should be fixed pretty easily in
 MappedDateTime
   itself. Let me make a new branch and make a minor change.
 
   Derek
 
   On Tue, Mar 17, 2009 at 12:09 PM, Timothy Perrett
 timo...@getintheloop.eu
wrote:
 
   *bump*
 
   Al, any progress on these?
 
   Cheers, Tim
 
   On Mar 10, 11:04 am, Timothy Perrett timo...@getintheloop.eu wrote:
Is someone able to take ownership of these tickets?
 
Cheers, Tim
 
On Mar 9, 5:52 pm, Tim Perrett timo...@getintheloop.eu wrote:
 
 Guys,
 
 Just logged a couple of bugs for SQL Server drivers:
 

 http://liftweb.lighthouseapp.com/projects/26102/tickets/18-sql-server.
   ..
 

 http://liftweb.lighthouseapp.com/projects/26102/tickets/17-mappedtext.
   ..
 
 Can someone take a look? This really is not my speciality.
 
 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: SQL Server Errors

2009-03-17 Thread Derek Chen-Becker
Actually, now I'm more confused. In the MappedText source it's using the
JDBC type VARCHAR. In MetaMapper's buildMapper method it appears that
VARCHAR should be retrieved via a resultSet.getString call, which should
return the String form of the data. I confirmed this in jTDS source:

http://jtds.cvs.sourceforge.net/viewvc/jtds/jtds/src/java/net/sourceforge/jtds/jdbc/Support.java?revision=1.1view=markuppathrev=MAIN

Line 289. I have no idea how you're getting a real ClobImpl object, since
the source seems to indicate that it should just be a String:

class MappedText[T:Mapper[T]](val fieldOwner: T) extends
MappedField[String, T]

Derek

On Tue, Mar 17, 2009 at 2:08 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 OK, check out the wip-dcb-datetime branch and test that.

 It looks like the CLOB object that jTDS returns doesn't override toString
 to return the contents of the CLOB. It does, however, implement the
 java.sql.Clob interface, so it may be possible to match that somehow and
 make it work. I'm diving into parts of Mapper that I haven't really worked
 with before, so no guarantees. Just to confirm, can you change your snippet
 to use:

 description - m.description.toString

 and see if you get the same thing?

 Thanks,

 Derek




 On Tue, Mar 17, 2009 at 1:05 PM, Timothy Perrett 
 timo...@getintheloop.euwrote:


 Hey Derek,

 Awesome - thanks. I knew the DataTime one would be a simple fix - I
 just don't know enough about mapper.

 #17 is the one thats really hurting me right now... if you could fix
 that I would be sooo grateful!

 Cheers, Tim

 On Mar 17, 6:02 pm, Derek Chen-Becker dchenbec...@gmail.com wrote:
  OK, actually, the change is in SqlServerDriver. I've made the change and
 I'm
  running a build before committing. Once I push the branch could you
 check it
  out and test? I'm looking at #17 right now, too.
 
  Derek
 
  On Tue, Mar 17, 2009 at 12:44 PM, Derek Chen-Becker
  dchenbec...@gmail.comwrote:
 
   I think the DateTime issue should be fixed pretty easily in
 MappedDateTime
   itself. Let me make a new branch and make a minor change.
 
   Derek
 
   On Tue, Mar 17, 2009 at 12:09 PM, Timothy Perrett
 timo...@getintheloop.eu
wrote:
 
   *bump*
 
   Al, any progress on these?
 
   Cheers, Tim
 
   On Mar 10, 11:04 am, Timothy Perrett timo...@getintheloop.eu
 wrote:
Is someone able to take ownership of these tickets?
 
Cheers, Tim
 
On Mar 9, 5:52 pm, Tim Perrett timo...@getintheloop.eu wrote:
 
 Guys,
 
 Just logged a couple of bugs for SQL Server drivers:
 

 http://liftweb.lighthouseapp.com/projects/26102/tickets/18-sql-server.
   ..
 

 http://liftweb.lighthouseapp.com/projects/26102/tickets/17-mappedtext.
   ..
 
 Can someone take a look? This really is not my speciality.
 
 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: Ticket #19 (mail and character encoding)

2009-03-17 Thread Marc Boschma
It depends upon what is meant by plain. According to RFC 2045 (5.2)  
the default character encoding for a non-MIME message is us-ascii and  
the transfer encoding would be 7bit.

Given that I think we are speaking of MIME encoded messages I think  
that the default of UTF-8 is ok in a lift context, but that you should  
provide the case class as not all email clients understand UTF-8 and  
if building a message that has the widest support is desired then it  
should be easy to specify alternatives that can be interpreted.

What is the treatment of character encoding in the interface? ie. can  
I specify base64 or quoted-printable, etc?

Marc

On 18/03/2009, at 1:23 AM, Derek Chen-Becker wrote:

 I'm looking at ticket #19:

 http://liftweb.lighthouseapp.com/projects/26102/tickets/19-mailer-doesnt-handle-plain-text-encoding

 The setText method is essentially a shortcut for setContent(...,  
 text/plain), but it also allows you to specify the character  
 encoding. Would anyone be opposed to modifying the code so that  
 PlainMailBodyType uses UTF-8 for character encoding? Would it be  
 useful to provide an additional case class, a la

 PlainPlusBodyType(text : String, charset : String)

 Derek

 


--~--~-~--~~~---~--~~
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: Ticket #19 (mail and character encoding)

2009-03-17 Thread Derek Chen-Becker
This is strictly MIME, so the plain text part of the message will have an
explicit charset associated with the text. The JavaMail framework is very
flexible in terms of what you can send, how it's encoded, etc, but Lift's
interface only exposes a small subset appropriate for sending either text
emails or XHtml w/ optional images. The BodyPart interface that we're using
doesn't directly allow you to specify content encoding, just the charset:

http://java.sun.com/products/javamail/javadocs/javax/mail/BodyPart.html

If you want to do more interesting things (ie send a file attachment) you
would want to use JavaMail directly.

Derek

On Tue, Mar 17, 2009 at 2:31 PM, Marc Boschma
marc+lift...@boschma.cxmarc%2blift...@boschma.cx
 wrote:

 It depends upon what is meant by plain. According to RFC 2045 (5.2) the
 default character encoding for a non-MIME message is us-ascii and the
 transfer encoding would be 7bit.
 Given that I think we are speaking of MIME encoded messages I think that
 the default of UTF-8 is ok in a lift context, but that you should provide
 the case class as not all email clients understand UTF-8 and if building a
 message that has the widest support is desired then it should be easy to
 specify alternatives that can be interpreted.

 What is the treatment of character encoding in the interface? ie. can I
 specify base64 or quoted-printable, etc?

 Marc

 On 18/03/2009, at 1:23 AM, Derek Chen-Becker wrote:

 I'm looking at ticket #19:


 http://liftweb.lighthouseapp.com/projects/26102/tickets/19-mailer-doesnt-handle-plain-text-encoding

 The setText method is essentially a shortcut for setContent(...,
 text/plain), but it also allows you to specify the character encoding.
 Would anyone be opposed to modifying the code so that PlainMailBodyType uses
 UTF-8 for character encoding? Would it be useful to provide an additional
 case class, a la

 PlainPlusBodyType(text : String, charset : String)

 Derek





 


--~--~-~--~~~---~--~~
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: Ticket #19 (mail and character encoding)

2009-03-17 Thread Derek Chen-Becker
OK, new code is checked in on wip-dcb-mailer-charset branch. Does anyone
have time to test?

Derek

On Tue, Mar 17, 2009 at 2:39 PM, Derek Chen-Becker dchenbec...@gmail.comwrote:

 This is strictly MIME, so the plain text part of the message will have an
 explicit charset associated with the text. The JavaMail framework is very
 flexible in terms of what you can send, how it's encoded, etc, but Lift's
 interface only exposes a small subset appropriate for sending either text
 emails or XHtml w/ optional images. The BodyPart interface that we're using
 doesn't directly allow you to specify content encoding, just the charset:

 http://java.sun.com/products/javamail/javadocs/javax/mail/BodyPart.html

 If you want to do more interesting things (ie send a file attachment) you
 would want to use JavaMail directly.

 Derek


 On Tue, Mar 17, 2009 at 2:31 PM, Marc Boschma 
 marc+lift...@boschma.cxmarc%2blift...@boschma.cx
  wrote:

 It depends upon what is meant by plain. According to RFC 2045 (5.2) the
 default character encoding for a non-MIME message is us-ascii and the
 transfer encoding would be 7bit.
 Given that I think we are speaking of MIME encoded messages I think that
 the default of UTF-8 is ok in a lift context, but that you should provide
 the case class as not all email clients understand UTF-8 and if building a
 message that has the widest support is desired then it should be easy to
 specify alternatives that can be interpreted.

 What is the treatment of character encoding in the interface? ie. can I
 specify base64 or quoted-printable, etc?

 Marc

 On 18/03/2009, at 1:23 AM, Derek Chen-Becker wrote:

 I'm looking at ticket #19:


 http://liftweb.lighthouseapp.com/projects/26102/tickets/19-mailer-doesnt-handle-plain-text-encoding

 The setText method is essentially a shortcut for setContent(...,
 text/plain), but it also allows you to specify the character encoding.
 Would anyone be opposed to modifying the code so that PlainMailBodyType uses
 UTF-8 for character encoding? Would it be useful to provide an additional
 case class, a la

 PlainPlusBodyType(text : String, charset : String)

 Derek





 



--~--~-~--~~~---~--~~
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: Google Analytics

2009-03-17 Thread Charles F. Munat

OK, I have to stop posting this crap when it's 5:30 AM, I've been 
working for 18 hours straight, and my brain is fried.

The problem was that I was looking at it on my development machine, not 
the production server. The Google Analytics code is tied to the URL. If 
the URL is wrong, it doesn't serve the script, so Firebug reports the 
error. I are dumb.

Hopefully, though, my posting this will save some other person a hassle 
and a little public embarrassment.

Chas.

Derek Chen-Becker wrote:
 Can you send the beginning of the XHTML output, up to and including the 
 GA script?
 
 Derek
 
 On Tue, Mar 17, 2009 at 6:31 AM, Charles F. Munat c...@munat.com 
 mailto:c...@munat.com wrote:
 
 
 Is anyone else using Google Analytics? I am getting this strange
 JavaScript error:
 
 operation is not supported code: 9
  var pageTracker = _gat._getTracker(UA-5774043-2);
 
 The Google scripts are supposed to be placed right before the closing
 body tag, but Lift inserts its own script in there. I can't imagine how
 that would make a difference, but it is the only thing different from
 what Google recommends.
 
 Also, the analytics are not working.
 
 Any ideas?
 
 Chas.
 
 
 
 
  

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



[Lift] FieldType and ForeignType

2009-03-17 Thread Jorge Ortiz
Anyone know what these two types:

  type FieldType : KeyType
  type ForeignType : KeyedMapper[KeyType, Other]

in trait MappedForeignKey are doing?

They're never fully defined and never used, but somehow were causing compile
problems in someone's code.

If they're useless, can they be axed?

--j

--~--~-~--~~~---~--~~
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: FieldType and ForeignType

2009-03-17 Thread Jorge Ortiz
And if they're useful, can subclasses of MappedForeignKey define them more
exactly?

Errors looked like this:

[WARNING] C:\workspace\liftapp\src\main\scala\com\liftworkshop\model\ToDo.scala:
16: error: object creation impossible, since type ForeignType in trait MappedFor
eignKey with bounds : Nothing : net.liftweb.mapper.KeyedMapper[Long,my.liftapp
.model.User] is not defined
[WARNING]   object owner extends MappedLongForeignKey( this , User )
[WARNING]  ^


[WARNING] C:\workspace\liftapp\src\main\scala\com\liftworkshop\model\ToDo.scala:
16: error: object creation impossible, since type FieldType in trait MappedForei
gnKey with bounds : Nothing : Long is not defined
[WARNING]   object owner extends MappedLongForeignKey( this , User )
[WARNING]  ^


--j

On Tue, Mar 17, 2009 at 5:42 PM, Jorge Ortiz jorge.or...@gmail.com wrote:

 Anyone know what these two types:

   type FieldType : KeyType
   type ForeignType : KeyedMapper[KeyType, Other]

 in trait MappedForeignKey are doing?

 They're never fully defined and never used, but somehow were causing
 compile problems in someone's code.

 If they're useless, can they be axed?

 --j


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



[Lift] Re: Where to continue after Getting Started?

2009-03-17 Thread Ikai Lan
I'll add my two cents:
I've written my share of Ruby, PHP and Python. My preference is towards Ruby
because the way things work is simply more logical than Python, which is
much more old school. For instance, default parameters for functions are
calculated at method invocation rather than method definition. To me, this
has always just made more sense.

Scala is like Java without the pain! Learning Scala is an absolute joy
because you always discover a better, more elegant way to solve problems.
Traits, for instance, are absolutely awesome. Unfortunately, NetBeans
doesn't seem to support this correctly when doing autocomplete - not all the
time, anyway.

I started Scala because it seemed like Java with first class functions, but
it's been much, much more. I still don't completely understand case classes
but I'm getting there!

Ikai

--~--~-~--~~~---~--~~
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: Tutorial No Schemify in Boot.scala

2009-03-17 Thread Tobias Daub

Hi Eric,

By the way, is there any documentation about the different maven2 
lift-archetype-something options?

I wanted to setup a lift project that has the login stuff already 
included, but since I didn't know why, I used the ToDo project and 
modified it.

Are there other solutions?

thanks
Tobias
 Jeff,

 I am assuming that you are referring to Starting with Lift by
 Chen-Becker, Danciu, Pollak, and Weir.

 Chapter 1 introduces a simple application that is created from
 lift-archetype-blank and has no support for databases. In Chapter 2,
 that application is thrown away and a new application is created with
 lift-archetype-basic which does have support for databases.

 I think you are still trying to use a lift-archetype-blank application
 when following along with examples that require a lift-archetype-basic
 application.

 Hope this helps.
 Eric

 On Wed, Mar 4, 2009 at 9:12 PM, jeff.chen.gr...@gmail.com
 jeff.chen.gr...@gmail.com wrote:
   
 Hi All - I am new and pardon me if this is really a naive question. I
 am following GetStartedGuide and working on the todo app. However in
 2.4, I cannot find the Schemifier statement in the Boot.scala file.
 Did I miss anything? I also didn't find the part on how to connect
 Lift with a backend database.

 Thanks,
 Jeff

 

 
   


--~--~-~--~~~---~--~~
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] Forms validation formatter

2009-03-17 Thread Clemens Oertel

Hello everybody,

Still trying to learn how to use lift efficiently and effectively, I  
got a little bit confused about the toForm function in the model/ 
mappers. Admittedly, my web framework background may be limited, but  
this looked to me as if some view code snuck into the model space  
there (I must admit that I do like how RoR tries to keep the models  
fairly clean of both controller  code and of view code).

For my first little project, I was going to encapsulate the HTML field  
formatting into a separate class (similar to what RoR does, but making  
use of the type system).

This is a very quick brain dump, not running code.

// The different field types, at a higher level than HTML
abstract class InputType
case class TextField extends InputType
case class DateField extends InputType
case class DateTimeField extends InputType

// Rendering hints that an form field formatter may use, could also be  
called FormGenerator ...
abstract class RenderingHint
case class MinLength(l: Int) extends RenderingHint
case class MaxLength(l: Int) extends RenderingHint

// Input-type aware callback'ed formatter, from the model's perspective
trait InputTypeHandler {
   def handleTextField(fieldID: String, presetValue: String,  
renderingHints: RenderingHint*)

   def handleDateField(fieldID: String, presetValue: Date,  
renderingHints: RenderingHint*)
}

// A model class using the callback
class ModelClass {
   object aField extends MappedString(this, 128) {
 def inputTypeCallback(InputTypeHandler handler) {
   // A reasonable default should/could be pushed upwards in the  
type hierarchy
   handler.handleTextField(fieldID, this.is, MaxLength(this.length))
 }
   }
}

This InputTypeHandler could be a nice spot to deal with validation  
result formatting:

class AnInputFormatter(errors: List[FieldError]) extends  
InputTypeHandler {
   def handleTextField(fieldID: String, presetValue: String,  
renderingHints: RenderingHint*) {
 errors.filter(_._1 == fieldID).match {
   case Nil = /* format field normally */
   case xs = /* format as error, i.e. red background, error  
messages right of field  */
 }
   }

   ...
}

// A snippet
...
val inputFormatter = new AnInputFormatter(errorsFromValidation)
bind(form, html, aField - aModelClass.aField.  
inputTypeCallback(inputFormatter))
...

Maybe a partial function, potentially on case classes, is better? Many  
options ...

I'm looking forward to any feedback.

Best,
Clemens

--~--~-~--~~~---~--~~
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] Melbourne Scala User Group

2009-03-17 Thread Jem Mawson

Hello

The Melbourne (Australia) Scala User Group has quite recently been set
up and discussions are underway about what topics / activities would
be of interest. Lift is one topic that will undoubtedly be pursued.

Anyone in Melbourne with an interest in Scala would be welcome at
http://groups.google.com/group/scala-melb ... Anyone with good Lift
knowledge and experience will *most certainly* be welcomed. I'll even
shout you a beer.

Cheers,
Jeremy

--~--~-~--~~~---~--~~
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] Melbourne Scala User Group

2009-03-17 Thread Jeremy Mawson
Apologies for possible double-posting. I posted this via the google groups
UI, but it has not been published to the group.

2009/3/18 Jem Mawson jeremy.mawson.w...@gmail.com

 Hello

 The Melbourne (Australia) Scala User Group has quite recently been set
 up and discussions are underway about what topics / activities would
 be of interest. Lift is one topic that will undoubtedly be pursued.

 Anyone in Melbourne with an interest in Scala would be welcome at
 http://groups.google.com/group/scala-melb ... Anyone with good Lift
 knowledge and experience will *most certainly* be welcomed. I'll even
 shout you a beer.

 Cheers,
 Jeremy

--~--~-~--~~~---~--~~
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] Forms validation formatter

2009-03-17 Thread Clemens

Hello everybody,

(I sent this post once already a few hours ago, but it has not shown
up yet, so I decided to send it again. I apologize should it show up
twice.)

Still trying to learn how to use lift efficiently and effectively, I
got a little bit confused about the toForm function in the model/
mappers. Admittedly, my web framework background may be limited, but
this looked to me as if some view code snuck into the model space
there (I must admit that I do like how RoR tries to keep the models
fairly clean of both controller  code and of view code).

For my first little project, I was going to encapsulate the HTML field
formatting into a separate class (similar to what RoR does, but making
use of the type system).

This is a very quick brain dump, not running code.

// The different field types, at a higher level than HTML
abstract class InputType
case class TextField extends InputType
case class DateField extends InputType
case class DateTimeField extends InputType

// Rendering hints that an form field formatter may use, could also be
called FormGenerator ...
abstract class RenderingHint
case class MinLength(l: Int) extends RenderingHint
case class MaxLength(l: Int) extends RenderingHint

// Input-type aware callback'ed formatter, from the model's
perspective
trait InputTypeHandler {
 def handleTextField(fieldID: String, presetValue: String,
renderingHints: RenderingHint*)

 def handleDateField(fieldID: String, presetValue: Date,
renderingHints: RenderingHint*)
}

// A model class using the callback
class ModelClass {
 object aField extends MappedString(this, 128) {
   def inputTypeCallback(InputTypeHandler handler) {
 // A reasonable default should/could be pushed upwards in the
type hierarchy
 handler.handleTextField(fieldID, this.is, MaxLength(this.length))
   }
 }
}

This InputTypeHandler could be a nice spot to deal with validation
result formatting:

class AnInputFormatter(errors: List[FieldError]) extends
InputTypeHandler {
 def handleTextField(fieldID: String, presetValue: String,
renderingHints: RenderingHint*) {
   errors.filter(_._1 == fieldID).match {
 case Nil = /* format field normally */
 case xs = /* format as error, i.e. red background, error
messages right of field  */
   }
 }

 ...
}

// A snippet
...
val inputFormatter = new AnInputFormatter(errorsFromValidation)
bind(form, html, aField - aModelClass.aField. inputTypeCallback
(inputFormatter))
...

Maybe a partial function, potentially on case classes, is better? Many
options ...

I'm looking forward to any feedback.

Best,
Clemens

--~--~-~--~~~---~--~~
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] Welcome Lee Mighdoll to the Lift committers

2009-03-17 Thread David Pollak
Folks,
I'm pleased to welcome Lee Mighdoll to the Lift committers.  Lee wrote the
brilliant line:

Lift is an expressive and elegant framework for writing web applications.


Almost 18 months ago... but he's not a marketing guy, he's a code slinger
and he's going to be slinging some pretty cool code into Lift.

Please join me in welcoming Lee on board!

Thanks,

David

-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
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: FieldType and ForeignType

2009-03-17 Thread David Pollak
What version of Scala?

On Tue, Mar 17, 2009 at 5:45 PM, Jorge Ortiz jorge.or...@gmail.com wrote:

 And if they're useful, can subclasses of MappedForeignKey define them more
 exactly?

 Errors looked like this:

 [WARNING] 
 C:\workspace\liftapp\src\main\scala\com\liftworkshop\model\ToDo.scala:

 16: error: object creation impossible, since type ForeignType in trait 
 MappedFor
 eignKey with bounds : Nothing : 
 net.liftweb.mapper.KeyedMapper[Long,my.liftapp
 .model.User] is not defined
 [WARNING]   object owner extends MappedLongForeignKey( this , User )

 [WARNING]  ^


 [WARNING] 
 C:\workspace\liftapp\src\main\scala\com\liftworkshop\model\ToDo.scala:
 16: error: object creation impossible, since type FieldType in trait 
 MappedForei

 gnKey with bounds : Nothing : Long is not defined
 [WARNING]   object owner extends MappedLongForeignKey( this , User )
 [WARNING]  ^


 --j


 On Tue, Mar 17, 2009 at 5:42 PM, Jorge Ortiz jorge.or...@gmail.comwrote:

 Anyone know what these two types:

   type FieldType : KeyType
   type ForeignType : KeyedMapper[KeyType, Other]

 in trait MappedForeignKey are doing?

 They're never fully defined and never used, but somehow were causing
 compile problems in someone's code.

 If they're useless, can they be axed?

 --j



 



-- 
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: FieldType and ForeignType

2009-03-17 Thread Jorge Ortiz
Argh. Good call. I don't know as I was debugging through IRC, but it was
probably 2.7.2 since he was using the todo example site from the Lift
workshop.

And I told him to upgrade to Lift 1.0. That's going to cause problems. Oh
well.

--j

On Tue, Mar 17, 2009 at 8:23 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 What version of Scala?


 On Tue, Mar 17, 2009 at 5:45 PM, Jorge Ortiz jorge.or...@gmail.comwrote:

 And if they're useful, can subclasses of MappedForeignKey define them more
 exactly?

 Errors looked like this:

 [WARNING] 
 C:\workspace\liftapp\src\main\scala\com\liftworkshop\model\ToDo.scala:

 16: error: object creation impossible, since type ForeignType in trait 
 MappedFor
 eignKey with bounds : Nothing : 
 net.liftweb.mapper.KeyedMapper[Long,my.liftapp
 .model.User] is not defined
 [WARNING]   object owner extends MappedLongForeignKey( this , User )


 [WARNING]  ^


 [WARNING] 
 C:\workspace\liftapp\src\main\scala\com\liftworkshop\model\ToDo.scala:
 16: error: object creation impossible, since type FieldType in trait 
 MappedForei

 gnKey with bounds : Nothing : Long is not defined
 [WARNING]   object owner extends MappedLongForeignKey( this , User )
 [WARNING]  ^


 --j


 On Tue, Mar 17, 2009 at 5:42 PM, Jorge Ortiz jorge.or...@gmail.comwrote:

 Anyone know what these two types:

   type FieldType : KeyType
   type ForeignType : KeyedMapper[KeyType, Other]

 in trait MappedForeignKey are doing?

 They're never fully defined and never used, but somehow were causing
 compile problems in someone's code.

 If they're useless, can they be axed?

 --j







 --
 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: Welcome Lee Mighdoll to the Lift committers

2009-03-17 Thread Derek Chen-Becker
Great to have you along, Lee :)

Derek

On Tue, Mar 17, 2009 at 9:11 PM, David Pollak feeder.of.the.be...@gmail.com
 wrote:

 Folks,
 I'm pleased to welcome Lee Mighdoll to the Lift committers.  Lee wrote the
 brilliant line:

 Lift is an expressive and elegant framework for writing web applications.


 Almost 18 months ago... but he's not a marketing guy, he's a code slinger
 and he's going to be slinging some pretty cool code into Lift.

 Please join me in welcoming Lee on board!

 Thanks,

 David

 --
 Lift, the simply functional web framework http://liftweb.net
 Beginning Scala http://www.apress.com/book/view/1430219890
 Follow me: http://twitter.com/dpp
 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
-~--~~~~--~~--~--~---