[Lift] Re: Getting the generated id from a mapper instance

2009-07-05 Thread Spencer Uresk

Yep, it appears that was the mistake I somehow made.

Thanks!

- Spencer

On Jul 4, 2009, at 6:21 PM, Peter Robinett wrote:


 I think I got the same thing once before when referring to the
 companion object (singleton) instead of my specific instance. Perhaps
 you're doing the same thing?

 Peter Robinett

 On Jul 4, 2:14 am, Spencer Uresk sur...@gmail.com wrote:
 I'm having a bit of trouble with a mapper class I'm trying to make.
 Everything is working fine, except that I cannot get the id of the
 newly-saved class - it always returns the default value (-1L). Here  
 is
 what my class looks like:

 object Job extends Job with LongKeyedMetaMapper[Job] {

 }

 class Job extends LongKeyedMapper[Job] with IdPK {
 .. fields here...

 }

 Here is the save code I am trying:

 job.save
 Log.info(JOB ID:  + job.id)

 I've also tried:

 job.save
 val newJob = job.reload
 Log.info(JOB ID: + newJob.id)

 I'm using mySQL 5.1.

 Any ideas on why I'm never seeing the generated key, and what the
 correct approach would be?

 Thanks,

 - Spencer
 


--~--~-~--~~~---~--~~
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: howto do simple calculation with MappedInt

2009-07-05 Thread Tobias Daub
here are the two files, thanks!
 Send me the file and I'll debug it.

 On Fri, Jul 3, 2009 at 3:06 AM, Tobias Daub hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:


 Thanks Dave, but still getting this error:

 
 /home/wacky/NetBeansProjects/virtualMarket/src/main/scala/org/tobster/model/Order.scala:51:
 error: value lotValue is not a member of Long
override def _toForm = Full(p{Order.this.lots *
 Order.this.marketPlace.lotValue}/p)


 What is the explanation for this behavior?

 thanks
 
 
  On Sun, Jun 21, 2009 at 6:38 AM, Tobias Daub
 hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li
  mailto:hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li wrote:
 
 
  I'm stucked again with the simple things
 
  I've a trait that extends BaseLongKeyedMapper and I wanna
 add a field
  (currentCost) that does some calculation. Nothing special.
 Here's
  the code:
 
  /*
   * Order.scala
   *
   * To change this template, choose Tools | Template Manager
   * and open the template in the editor.
   */
 
  package org.tobster.model
 
  import net.liftweb._
  import mapper._
  import http._
  import SHtml._
  import util._
  import model._
 
  /* Describes a general order.  */
  trait Order extends BaseLongKeyedMapper{
 
 /* The number of lots this order has */
 object lots extends MappedInt(this.asInstanceOf[MapperType])
 
 /* The person who owns the order */
 object owner extends
  MappedLongForeignKey(this.asInstanceOf[MapperType], User){
 
 // hides this field in the CRUDify list/create forms
 override def dbDisplay_? = false
 
 //set the default value to the current logged in user (at
  creation time)
 override def defaultValue =
 User.currentUser.map(_.id.is http://id.is
  http://id.is) openOr 0L
 }
 
 /* The market place where the order belongs to  */
 object marketPlace extends
  MappedLongForeignKey(this.asInstanceOf[MapperType],
  MarketPlaceMetaObj){
 override def _toForm = Full(SHtml.selectObj[MarketPlace](
 
  MarketPlaceMetaObj.findAll.map(mp
  = (mp, mp.name.is http://mp.name.is http://mp.name.is)),
   obj,
   (mp: MarketPlace) =
 apply(mp)))
 }
 
 /* The basic trade types are: BUY and SELL */
 object tradeType extends
  MappedLongForeignKey(this.asInstanceOf[MapperType],
 TradeTypeMetaObj){
 override def _toForm = Full(SHtml.selectObj[TradeType](
 TradeTypeMetaObj.findAll.map(t = (t,
 t.name.is http://t.name.is
  http://t.name.is)),
 obj,
 (t: TradeType) = apply(t)))
 }
 
 
 object currentCost extends
  MappedInt(this.asInstanceOf[MapperType]){
 override def _toForm = Full(p{this.lots *
  this.marketPlace.lotValue}/p)
 
 
 
  Try:
  override def _toForm = Full(p{Order.this.lots *
  Order.this.marketPlace.lotValue}/p)
 
 
 
 
 }
 
  }
 
  I get the following compiler error:
 
  [WARNING]
 
 
 /home/wacky/workspace_VirtuelleBoerse/virtualMarket/src/main/scala/org/tobster/model/Order.scala:51:
  error: value lots is not a member of Int
  [WARNING] override def _toForm = Full(p{this.lots *
  this.marketPlace.lotValue}/p)
  [WARNING]  ^
  [WARNING] one error found
 
  The field marketPlace.lotValue is of type MappedInt as well
 as the
  field
  lots.
 
  I tried things like this.lots.is http://this.lots.is
 http://this.lots.is or
  this.lots.i_is_! but without
  success. I ran out of ideas...
 
 
  thanks.
 
 
 
 
 
  --
  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 

[Lift] Re: using file-based data storage in Lift app

2009-07-05 Thread glenn

Thanks, Marius.

Now, is there something similar for writing XML to a file. I saw
nothing on LiftRules that
seems to apply.

Glenn...

On Jul 4, 12:36 am, marius d. marius.dan...@gmail.com wrote:
 Try LiftRules.loadResourceAsXml

 Br's,
 Marius

 On Jul 4, 1:11 am, glenn gl...@exmbly.com wrote:

  I've searched this group and combed through the lift book for an
  answer, but found none - how to use file-based storage for data within
  Lift.

  For example, how would I call something like:

  def xml = XML.loadFile(fileName)

  without getting a java.io.FileNotFoundException?

  I tried storing the files in a directory under webapp, and even
  included the directory in the resource path in Boot.scala, like so:

  ResourceServer.allow({
        case contents :: _ = true

      })

  But that doesn't work.

  Any help would be appreciated.

--~--~-~--~~~---~--~~
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 file-based data storage in Lift app

2009-07-05 Thread Timothy Perrett

Marius, Glen,

Can I wade in here and suggest that if Glenn wants to use an XML
datasource, then writing an XML backend for Record would be the best
way to go and maintain CRUD semantics out of the box?

Cheers, Tim

On Jul 5, 8:40 pm, glenn gl...@exmbly.com wrote:
 Thanks, Marius.

 Now, is there something similar for writing XML to a file. I saw
 nothing on LiftRules that
 seems to apply.

 Glenn...

 On Jul 4, 12:36 am, marius d. marius.dan...@gmail.com wrote:



  Try LiftRules.loadResourceAsXml

  Br's,
  Marius

  On Jul 4, 1:11 am, glenn gl...@exmbly.com wrote:

   I've searched this group and combed through the lift book for an
   answer, but found none - how to use file-based storage for data within
   Lift.

   For example, how would I call something like:

   def xml = XML.loadFile(fileName)

   without getting a java.io.FileNotFoundException?

   I tried storing the files in a directory under webapp, and even
   included the directory in the resource path in Boot.scala, like so:

   ResourceServer.allow({
         case contents :: _ = true

       })

   But that doesn't work.

   Any help would be appreciated.
--~--~-~--~~~---~--~~
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 file-based data storage in Lift app

2009-07-05 Thread Naftoli Gugenhem

Why would lift interfere with file io? Resource server is probably for static 
http. If you're getting file not found I can't imagine it's lift's fault. Try 
dumping new java.io.File(.).listFiles() or .getAbsolutePath etc. to see what 
directory is the default. What kind of server are you using?

-
glenngl...@exmbly.com wrote:


Thanks, Marius.

Now, is there something similar for writing XML to a file. I saw
nothing on LiftRules that
seems to apply.

Glenn...

On Jul 4, 12:36 am, marius d. marius.dan...@gmail.com wrote:
 Try LiftRules.loadResourceAsXml

 Br's,
 Marius

 On Jul 4, 1:11 am, glenn gl...@exmbly.com wrote:

  I've searched this group and combed through the lift book for an
  answer, but found none - how to use file-based storage for data within
  Lift.

  For example, how would I call something like:

  def xml = XML.loadFile(fileName)

  without getting a java.io.FileNotFoundException?

  I tried storing the files in a directory under webapp, and even
  included the directory in the resource path in Boot.scala, like so:

  ResourceServer.allow({
        case contents :: _ = true

      })

  But that doesn't work.

  Any help would be appreciated.



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

2009-07-05 Thread Timothy Perrett

Douglas,

Please see: http://wiki.liftweb.net/index.php/Maven_Mini_Guide

We contemplated wrapping this crap (to use your words), but in the
interests of exploiting the best of our maven based build system the
following is the recommended command for project creation:

mvn archetype:generate -DarchetypeCatalog=http://scala-tools.org/

I have explored providing scripts before, but from a maintenance and
update perspective the maven solution was just superior in every way
as its centrally managed (and therefore updatable from a project/
community perspective).

Im open to suggestions about making this process smoother, so please,
if you have some suggestions by all means make them :-)

Cheers, Tim

On Jul 4, 4:51 am, g-man gregor...@gmail.com wrote:
 I have been working on a project for a while, so I haven't needed to
 use it, but I found this in my collection of .bat files:

 cd C:\Liftweb
 mvn archetype:generate -DarchetypeCatalog=http://scala-tools.org/

 ... that way, you get a bunch of choices during the creation process,
 as I recall.

 Yes, Lift is young, and is in more of the 'for programmers' phase than
 the 'for everyone' phase as far as books and instructional websites
 go, but things are moving fast!

 Try it out and see what you can create, then report back with what you
 have learned, as many here do...

 On Jul 3, 4:00 pm, Douglas Quaid lee.ami...@gmail.com wrote:



  I heard some good vibes about Lift and then I saw this gem in the
  Getting Started documentation for creating a project:

   From a command prompt, type:

  mvn archetype:generate -U \
  -DarchetypeGroupId=net.liftweb \
  -DarchetypeArtifactId=lift-archetype-basic \
  -DarchetypeVersion=1.0 \
  -DremoteRepositories=http://scala-tools.org/repo-releases\
  -DgroupId=com.liftworkshop \
  -DartifactId=todo \
  -Dversion=0.1-SNAPSHOT

  Perhaps you guys could innovate and wrap this crap (rhyme!) in a
  shell script.

  Good day!
--~--~-~--~~~---~--~~
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 file-based data storage in Lift app

2009-07-05 Thread Timothy Perrett

If you need to get the absolute path where the exploded war is living,
you can get that via ServletContext I do believe. Generally speaking,
Lift provides no mechanism for writing stuff to the filesystem and
does not interfere with file i/o.

Cheers, Tim

On Jul 5, 9:15 pm, Naftoli Gugenhem naftoli...@gmail.com wrote:
 Why would lift interfere with file io? Resource server is probably for static 
 http. If you're getting file not found I can't imagine it's lift's fault. Try 
 dumping new java.io.File(.).listFiles() or .getAbsolutePath etc. to see 
 what directory is the default. What kind of server are you using?

 -

 glenngl...@exmbly.com wrote:

 Thanks, Marius.

 Now, is there something similar for writing XML to a file. I saw
 nothing on LiftRules that
 seems to apply.

 Glenn...

 On Jul 4, 12:36 am, marius d. marius.dan...@gmail.com wrote:



  Try LiftRules.loadResourceAsXml

  Br's,
  Marius

  On Jul 4, 1:11 am, glenn gl...@exmbly.com wrote:

   I've searched this group and combed through the lift book for an
   answer, but found none - how to use file-based storage for data within
   Lift.

   For example, how would I call something like:

   def xml = XML.loadFile(fileName)

   without getting a java.io.FileNotFoundException?

   I tried storing the files in a directory under webapp, and even
   included the directory in the resource path in Boot.scala, like so:

   ResourceServer.allow({
         case contents :: _ = true

       })

   But that doesn't work.

   Any help would be appreciated.
--~--~-~--~~~---~--~~
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 a project

2009-07-05 Thread David Pollak
On Fri, Jul 3, 2009 at 4:00 PM, Douglas Quaid lee.ami...@gmail.com wrote:


 I heard some good vibes about Lift and then I saw this gem in the
 Getting Started documentation for creating a project:

  From a command prompt, type:

 mvn archetype:generate -U \
 -DarchetypeGroupId=net.liftweb \
 -DarchetypeArtifactId=lift-archetype-basic \
 -DarchetypeVersion=1.0 \
 -DremoteRepositories=http://scala-tools.org/repo-releases \
 -DgroupId=com.liftworkshop \
 -DartifactId=todo \
 -Dversion=0.1-SNAPSHOT

 Perhaps you guys could innovate and wrap this crap (rhyme!) in a
 shell script.


Howdy,

I'll address your post in two parts.  First the form, and then the
substance.

This community is a welcoming (especially to newbies), kind, and generally
cool place to hang out.  People in this community are here to help each
other and to grow the knowledge, skills, and code around Lift.  We welcome
feedback and comments and ways to improve Lift.  But we ask that people are
polite and helpful.  Your email did not meet this standard.  So, in the
future, please treat this community the way that you would like to be
treated.  Approach this community the way you would like to be approached by
a stranger.

In terms of the substance of the issue, we've have a fair number of
discussions about this over the years.  The first problem is a bootstrap
problem.  Even if we have a shell script to wrap the maven command, how do
we get it into users' hands?  The second problem is an OS support issue.
Such a script is easy to write for Linux/Unix/OS X.  It's not so simple to
make sure it works on Windows as a separate .bat file as well as a shell
script that works under Cygwin.  We did do some testing of such a script as
part of the installer and it always led to problems and we never found a
person or collection of people who were willing to write, test and maintain
such a script.  So, we decided that the cost of copy/paste of a copy of
lines of Maven invocation was less of a priority than other Lift-related
development.

And as a practical matter, I probably create more Lift projects than anyone
else.  It was only a few weeks ago that I made a script out of the above
command rather than copy/pasting it.  I'm hardcore lazy and into making my
life easier (I would be using other frameworks if it wasn't faster and
easier for me to build a framework to do dynamic stuff rather than work
around the suboptimal decisions made in other frameworks) and in the case of
the Maven command to create a new Lift project, it just wasn't that hard.

So, if you would like to write up some scripts and post them in a public
place, that'd be great.  If you're the guy who is going to step up to the
task of maintaining a complex cross-section of scripts, we'll link to your
work and reference it in any way we can.

Thanks,

David




 Good day!

 



-- 
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 test/TDD lift apps?

2009-07-05 Thread David Pollak
On Fri, Jul 3, 2009 at 10:38 AM, Kris Nuttycombe
kris.nuttyco...@gmail.comwrote:


 Hi, David,

 Thanks for taking some time to look at this problem. I'm a little
 concerned about the approach, though - should Lift really behave
 significantly differently in test mode than it does in production
 mode? This seems like it would lend to the possibility of subtle bugs
 that don't show up until one is in production.


Unfortunately, I don't think there's a way around this issue.  If you need
stable identifiers, then you need to modify the behavior of your app.  If
you modify the behavior of the app, there's no way to test it as against how
it will run in production to a 100% certainty.  But I never consider tests
to be a 100% solution.  There are always things that can slip through the
cracks.




 With respect to unit testing, Lift's singletons depend upon underlying
 thread-local variables (via ThreadGlobal) to maintain state. I'm just
 musing here, but do you think it might be possible to inject a layer
 of indirection between Lift's singletons and the underlying state
 mechanism so that the state maintenance layer could be mocked out for
 tests?


Sure.  Open a ticket for this in GitHub and I'll try to get something done
for 1.1.




 This brings some other issues I've been wrangling with lately to mind.
 Please forgive me for rambling, but I think that the issue of testing
 is intimately tied to how Lift deals with state maintenance.


Yeah, in the area of multi-form inputs is not currently a strength of Lift.
It requires a lot of hand-rolling of state management by the developer.  I'm
working on multi-screen Wizard feature for 1.1 (see
https://www.lostlake.org/wizard.wmv , but not as XML... as a DSL... much
like SiteMap, but with better syntax).  I think it'll address a lot of your
concerns/challenges.

Thanks,

David



 State is sort of becoming a bugbear for me as my Lift app becomes more
 complex. I'm not sure whether I'm just doing things wrong or what, but
 I'm finding that using RequestVars and StatefulSnippets to maintain
 state makes it difficult to build composable editing components. As an
 example, I've got a StatefulSnippet that I use to build an object of
 type EventTrigger. There are a few possible subclasses of EventTrigger
 that can be produced through the workflow managed by the
 StatefulSnippet, and switching between the type options and such works
 well.

 The problem is that an EventTrigger may be associated with some number
 of Products, of which there are also a number of subclasses. So, I
 also have a similar StatefulSnippet that manages the flow of creating
 Products. But how do I pass the state of a newly created (or selected
 existing) EventTrigger from one StatefulSnippet to the next? As far as
 I can tell, there is no way to hand off control between
 StatefulSnippet instances - instead I must populate a RequestVar and
 use a redirect in the transition. Both sides of this state transaction
 have expectations of the state of the intermediate RequestVar, but
 there is no way to enforce that it be populated before the second
 snippet attempts to use it. This feels very Model 1 to me. It's the
 same case wherever I use RequestVar - some component (say a link) sets
 a value, then some other component reads it, and while the ReqestVar
 provides type safety for the value type, there is no associated type
 safety available for the call, as both links and redirects simply use
 strings to define behavior.

 This all seems to fall out of the fact that the processing of a
 template at a Loc results in reflective invocation of snippet
 functions. The template itself, which is outside the type system,
 defines the behavior at a Loc. As such, every snippet must be written
 to operate correctly in the absence of any piece of the state it
 expects. At least in my app, this ends up as an obnoxiously large
 amount of boilerplate.

 I think that I must be doing something wrong, because the feel of my
 app is that it is held together by snot and string, threaded through
 RequestVars that I hope will be populated with the correct values at
 the correct times and redirects that I hope are pointing to the right
 locations. At the same time, I can't figure out how else Lift will
 permit me to handle my state. With each new feature I add, I become a
 little more dismayed.

 Please, how can I handle these problems better?

 Thanks,

 Kris




 On Fri, Jul 3, 2009 at 10:43 AM, David
 Pollakfeeder.of.the.be...@gmail.com wrote:
  Jeppe,
 
  Once I check in some code (in about 20 minutes), if you run Lift in Test
  mode (-Drun.mode=test), forms, etc. will have stable names which makes
  testing easier.
 
  Thanks,
 
  David
 
  On Thu, Jul 2, 2009 at 1:13 PM, Jeppe Nejsum Madsen je...@ingolfs.dk
  wrote:
 
  Hi,
 
  Having taken the first baby steps and gotten a Lift app running, it's
  time to bring back some of the old engineering practices to make sure
  things keep running when new features are added at 

[Lift] Re: Creating a project

2009-07-05 Thread TylerWeir

 Your email did not meet this standard.

dpp, I'm glad you addressed this.  My initial response, which I
deleted, would not have helped the situation.  Yours was measured and
mature.

Ty



On Jul 5, 4:32 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Fri, Jul 3, 2009 at 4:00 PM, Douglas Quaid lee.ami...@gmail.com wrote:

  I heard some good vibes about Lift and then I saw this gem in the
  Getting Started documentation for creating a project:

   From a command prompt, type:

  mvn archetype:generate -U \
  -DarchetypeGroupId=net.liftweb \
  -DarchetypeArtifactId=lift-archetype-basic \
  -DarchetypeVersion=1.0 \
  -DremoteRepositories=http://scala-tools.org/repo-releases\
  -DgroupId=com.liftworkshop \
  -DartifactId=todo \
  -Dversion=0.1-SNAPSHOT

  Perhaps you guys could innovate and wrap this crap (rhyme!) in a
  shell script.

 Howdy,

 I'll address your post in two parts.  First the form, and then the
 substance.

 This community is a welcoming (especially to newbies), kind, and generally
 cool place to hang out.  People in this community are here to help each
 other and to grow the knowledge, skills, and code around Lift.  We welcome
 feedback and comments and ways to improve Lift.  But we ask that people are
 polite and helpful.  Your email did not meet this standard.  So, in the
 future, please treat this community the way that you would like to be
 treated.  Approach this community the way you would like to be approached by
 a stranger.

 In terms of the substance of the issue, we've have a fair number of
 discussions about this over the years.  The first problem is a bootstrap
 problem.  Even if we have a shell script to wrap the maven command, how do
 we get it into users' hands?  The second problem is an OS support issue.
 Such a script is easy to write for Linux/Unix/OS X.  It's not so simple to
 make sure it works on Windows as a separate .bat file as well as a shell
 script that works under Cygwin.  We did do some testing of such a script as
 part of the installer and it always led to problems and we never found a
 person or collection of people who were willing to write, test and maintain
 such a script.  So, we decided that the cost of copy/paste of a copy of
 lines of Maven invocation was less of a priority than other Lift-related
 development.

 And as a practical matter, I probably create more Lift projects than anyone
 else.  It was only a few weeks ago that I made a script out of the above
 command rather than copy/pasting it.  I'm hardcore lazy and into making my
 life easier (I would be using other frameworks if it wasn't faster and
 easier for me to build a framework to do dynamic stuff rather than work
 around the suboptimal decisions made in other frameworks) and in the case of
 the Maven command to create a new Lift project, it just wasn't that hard.

 So, if you would like to write up some scripts and post them in a public
 place, that'd be great.  If you're the guy who is going to step up to the
 task of maintaining a complex cross-section of scripts, we'll link to your
 work and reference it in any way we can.

 Thanks,

 David



  Good day!

 --
 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: Creating a project

2009-07-05 Thread Naftoli Gugenhem

In general I would appreciate if people would refrain from inappropriate 
vocabulary.

-
TylerWeirtyler.w...@gmail.com wrote:


 Your email did not meet this standard.

dpp, I'm glad you addressed this.  My initial response, which I
deleted, would not have helped the situation.  Yours was measured and
mature.

Ty



On Jul 5, 4:32 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Fri, Jul 3, 2009 at 4:00 PM, Douglas Quaid lee.ami...@gmail.com wrote:

  I heard some good vibes about Lift and then I saw this gem in the
  Getting Started documentation for creating a project:

   From a command prompt, type:

  mvn archetype:generate -U \
  -DarchetypeGroupId=net.liftweb \
  -DarchetypeArtifactId=lift-archetype-basic \
  -DarchetypeVersion=1.0 \
  -DremoteRepositories=http://scala-tools.org/repo-releases\
  -DgroupId=com.liftworkshop \
  -DartifactId=todo \
  -Dversion=0.1-SNAPSHOT

  Perhaps you guys could innovate and wrap this crap (rhyme!) in a
  shell script.

 Howdy,

 I'll address your post in two parts.  First the form, and then the
 substance.

 This community is a welcoming (especially to newbies), kind, and generally
 cool place to hang out.  People in this community are here to help each
 other and to grow the knowledge, skills, and code around Lift.  We welcome
 feedback and comments and ways to improve Lift.  But we ask that people are
 polite and helpful.  Your email did not meet this standard.  So, in the
 future, please treat this community the way that you would like to be
 treated.  Approach this community the way you would like to be approached by
 a stranger.

 In terms of the substance of the issue, we've have a fair number of
 discussions about this over the years.  The first problem is a bootstrap
 problem.  Even if we have a shell script to wrap the maven command, how do
 we get it into users' hands?  The second problem is an OS support issue.
 Such a script is easy to write for Linux/Unix/OS X.  It's not so simple to
 make sure it works on Windows as a separate .bat file as well as a shell
 script that works under Cygwin.  We did do some testing of such a script as
 part of the installer and it always led to problems and we never found a
 person or collection of people who were willing to write, test and maintain
 such a script.  So, we decided that the cost of copy/paste of a copy of
 lines of Maven invocation was less of a priority than other Lift-related
 development.

 And as a practical matter, I probably create more Lift projects than anyone
 else.  It was only a few weeks ago that I made a script out of the above
 command rather than copy/pasting it.  I'm hardcore lazy and into making my
 life easier (I would be using other frameworks if it wasn't faster and
 easier for me to build a framework to do dynamic stuff rather than work
 around the suboptimal decisions made in other frameworks) and in the case of
 the Maven command to create a new Lift project, it just wasn't that hard.

 So, if you would like to write up some scripts and post them in a public
 place, that'd be great.  If you're the guy who is going to step up to the
 task of maintaining a complex cross-section of scripts, we'll link to your
 work and reference it in any way we can.

 Thanks,

 David



  Good day!

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


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



[Lift] Re: How to test/TDD lift apps?

2009-07-05 Thread Channing Walton

On Jul 3, 6:38 pm, Kris Nuttycombe kris.nuttyco...@gmail.com wrote:

 With respect to unit testing, Lift's singletons depend upon underlying
 thread-local variables (via ThreadGlobal) to maintain state. I'm just
 musing here, but do you think it might be possible to inject a layer
 of indirection between Lift's singletons and the underlying state
 mechanism so that the state maintenance layer could be mocked out for
 tests?

I had a similar problem so introduced the cake pattern into my app so
that I could mock out things like this.

More about the cake pattern here:
http://jonasboner.com/2008/10/06/real-world-scala-dependency-injection-di.html

--~--~-~--~~~---~--~~
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] Becoming a Scala/Lift Guru

2009-07-05 Thread eric cs

Hi guys,

I saw some posts on Scala website about helping newcomers and I was
wondering if some of you would be kind enough to help me out to start
with Scala/Lift.
My main problem is I am not a programmer yet but I really really want
to be, I've been studying Ruby/Rails, Php/Zend/Symfony,Mvc,Design
Patterns,Uml,Sql and some Java. I read some books but I don't get my
head to think like a programer.
I really like OO,Design Patterns, Uml but I don't know how to apply
that to a full application, how to link everything together,
classes,objects(books about that?Not about those items but how to put
everything together)...I know a lot of the theory and concepts but no
practice.
I have all july available to learn that 12 hours a day or more if
necessary I just need a push, someone to teach/help me out.
What's more, I saw a post saying that I could learn Scala from scratch
without learning Java, it's possible, not so much with Groovy. If it's
not what parts of Java do I need to know, in case some of you tell me
learn Java first(the easy answer).Do I need a lot of experience in
Java to jump in in Scala? I know it helps but I would like to finish
my first e-commerce in august, 100% opensource in Scala if possible.

P.s:I did 2 years of Computer Science C++ and 2 years of Civil
Engineering over 12 years ago both unfinished.

--~--~-~--~~~---~--~~
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: Becoming a Scala/Lift Guru

2009-07-05 Thread Naftoli Gugenhem

I would say that the main advantage knowledge of Java over a similar language 
gives you is knowledge of the Java environment and system, but you can pick 
that up via scala too.
As far as turning theory into actual programming, my personal advice is to take 
one small sample, get it running, and then ask yourself questions like Why 
does it do this? and What if I change this. Once you have a thorough 
understanding of how the sample accomplishes what it was supposed to 
accomplish, and how all the parts contribute to that, repeat with another one. 
Along the way ask yourself, What if I want the computer to do xyz (similar to 
sample x)? Also, play around in the interpreter trying different permutations.
Of course, it goes without saying to read the books and articles, not to 
mention to ask all your questions on the scala-user list.
Enjoy!

-
eric cseeri...@gmail.com wrote:


Hi guys,

I saw some posts on Scala website about helping newcomers and I was
wondering if some of you would be kind enough to help me out to start
with Scala/Lift.
My main problem is I am not a programmer yet but I really really want
to be, I've been studying Ruby/Rails, Php/Zend/Symfony,Mvc,Design
Patterns,Uml,Sql and some Java. I read some books but I don't get my
head to think like a programer.
I really like OO,Design Patterns, Uml but I don't know how to apply
that to a full application, how to link everything together,
classes,objects(books about that?Not about those items but how to put
everything together)...I know a lot of the theory and concepts but no
practice.
I have all july available to learn that 12 hours a day or more if
necessary I just need a push, someone to teach/help me out.
What's more, I saw a post saying that I could learn Scala from scratch
without learning Java, it's possible, not so much with Groovy. If it's
not what parts of Java do I need to know, in case some of you tell me
learn Java first(the easy answer).Do I need a lot of experience in
Java to jump in in Scala? I know it helps but I would like to finish
my first e-commerce in august, 100% opensource in Scala if possible.

P.s:I did 2 years of Computer Science C++ and 2 years of Civil
Engineering over 12 years ago both unfinished.



--~--~-~--~~~---~--~~
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 file-based data storage in Lift app

2009-07-05 Thread David Pollak
The broader issue is that how a WAR file is exploded (converted from WAR/Zip
format to an on-disk representation) is a servlet-container specific issue.

Putting an XML file in your WAR and reading from it is totally cool.  The
abstraction that Marius pointed to is the correct one... and more generally,
using Class.getResource is the way to find something in the WAR or JAR.

Writing to something in your WAR is going to present all manner of problems
including the above-mentioned servlet-container related issues as well as
issues about being over-written on re-deployment.

If you're looking to have an XML-based persistence mechanism, I'd suggest
putting the full path to the XML store in your props file (there's a props
file per user, per host, and per run-mode, so there's lots of possibilities)
and use that to look for props.  Alternatively, put something in a dot
directory that lives in the launching user's home directory (like Maven's
.m2 directory) so it's in a well known location.

On Sun, Jul 5, 2009 at 2:01 PM, Naftoli Gugenhem naftoli...@gmail.comwrote:


 My point was to help him diagnose his file not found, not to know where the
 server is storing his app. I assume he is using relative paths and they may
 not be relative to where they should be.

 -
 Timothy Perretttimo...@getintheloop.eu wrote:


 If you need to get the absolute path where the exploded war is living,
 you can get that via ServletContext I do believe. Generally speaking,
 Lift provides no mechanism for writing stuff to the filesystem and
 does not interfere with file i/o.

 Cheers, Tim

 On Jul 5, 9:15 pm, Naftoli Gugenhem naftoli...@gmail.com wrote:
  Why would lift interfere with file io? Resource server is probably for
 static http. If you're getting file not found I can't imagine it's lift's
 fault. Try dumping new java.io.File(.).listFiles() or .getAbsolutePath
 etc. to see what directory is the default. What kind of server are you
 using?
 
  -
 
  glenngl...@exmbly.com wrote:
 
  Thanks, Marius.
 
  Now, is there something similar for writing XML to a file. I saw
  nothing on LiftRules that
  seems to apply.
 
  Glenn...
 
  On Jul 4, 12:36 am, marius d. marius.dan...@gmail.com wrote:
 
 
 
   Try LiftRules.loadResourceAsXml
 
   Br's,
   Marius
 
   On Jul 4, 1:11 am, glenn gl...@exmbly.com wrote:
 
I've searched this group and combed through the lift book for an
answer, but found none - how to use file-based storage for data
 within
Lift.
 
For example, how would I call something like:
 
def xml = XML.loadFile(fileName)
 
without getting a java.io.FileNotFoundException?
 
I tried storing the files in a directory under webapp, and even
included the directory in the resource path in Boot.scala, like so:
 
ResourceServer.allow({
  case contents :: _ = true
 
})
 
But that doesn't work.
 
Any help would be appreciated.


 



-- 
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] Scala job site written in Lift + a newcomer's experience

2009-07-05 Thread Spencer Uresk

Hey all,

I hope this isn't considered spammy, but I wanted to send out a link  
to a new website I built using Lift and share my experiences as a  
Scala and Lift newbie.

I've played around with Scala off and on for over a year now, and also  
looked at Lift once or twice during that time. After going to David  
Pollak's session at JavaOne about Lift, I decided to buckle down and  
actually create something with Scala and Lift, as I usually learn new  
things best by trying to create something useful. Looking around, I  
noticed there weren't any Scala-specific job sites and thought it  
might be nice to create one.

Going into it, I was a little concerned about HTML being embedded in  
Scala code, as the workflow (in both my day job and for my side work)  
is typically a designer cutting HTML and handing it to me to  
implement. I made sure my designer gave me valid XHTML and was  
pleasantly surprised at how easy it was to make my HTML code work in  
Lift. Even the user signup and login forms, which I got from the  
Mapper library, were easy to override with my HTML.

On the other hand, I sort of underestimated the time investment  
required to get a simple site working. Lift really does require a good  
understanding of Scala, and I found myself frustrated by stupid things  
because of it. In the past, when learning Groovy and Ruby, I've used  
their respective frameworks to learn the language itself, and I found  
that didn't work quite as well with Lift. I'm not really complaining -  
I know that the time invested will pay off handsomely in the future -  
just making an observation.

Really, I can't complain too much about the time it took to get up to  
speed - I was able to get a functioning, albeit simple, site developed  
in basically a long weekend, without having prior experience with Lift  
outside of messing with the examples for a few minutes. Here is the  
site I made:

http://www.scalacareers.com/

Obviously it is pretty simple, but I hope it is useful. I have a bunch  
of other features I want to add to it as I continue to learn Lift, but  
if any of you have suggestions for me, please feel free to send them  
on over.

Thank you for creating such a useful framework and for being such a  
friendly and helpful community - that really does make a big  
difference when first approaching a new language and framework!

- Spencer



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