Re: [Lift] scala-time and Lift pom.xml

2010-02-26 Thread Hannes

Hi Peter,

I read your mail, maybe you can help me. I'm wondering how I can 
integrate JodaTime or scala-time into my project.


thanks.
Hannes

This is more a question for Jorge than anyone else but since it's Lift-
related I thought I'd put it here:

What's the easiest way to add scala-tools to my Lift project's
pom.xml? My knowledge of Maven is very limited, but I hope that it is
simply a matter of adding another repository and dependency.

Thanks,
Peter Robinett

--

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


  


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



Re: [Lift] scala-time and Lift pom.xml

2010-02-26 Thread Hannes

Jim,

Thanks that helped!

Maybe its to late, or I don't know what, but.

Its a bit complicated to use I think. What's about scala-time? For my 
purpose, I just need the the time as a number (e.g. long). How do I do that?


thanks.

In what fashion do you mean integrate?
Adding this:
dependency
groupIdjoda-time/groupId
artifactIdjoda-time/artifactId
version1.6/version

/dependency
  


 to the dependency section to your maven POM will bring in the jar files.

On Fri, Feb 26, 2010 at 10:14 AM, Hannes hannes.flo...@gmx.li 
mailto:hannes.flo...@gmx.li wrote:


Hi Peter,

I read your mail, maybe you can help me. I'm wondering how I can
integrate JodaTime or scala-time into my project.

thanks.
Hannes

This is more a question for Jorge than anyone else but since
it's Lift-
related I thought I'd put it here:

What's the easiest way to add scala-tools to my Lift project's
pom.xml? My knowledge of Maven is very limited, but I hope
that it is
simply a matter of adding another repository and dependency.

Thanks,
Peter Robinett

--

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
mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb%2bunsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=.


 



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

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




--
James A Barrows

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

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


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



Re: [Lift] scala-time and Lift pom.xml

2010-02-26 Thread Hannes

THANKS!

You saved my weekend

On Fri, Feb 26, 2010 at 10:43 AM, Hannes hannes.flo...@gmx.li 
mailto:hannes.flo...@gmx.li wrote:


Jim,

Thanks that helped!

Maybe its to late, or I don't know what, but.

Its a bit complicated to use I think. What's about scala-time? For
my purpose, I just need the the time as a number (e.g. long). How
do I do that?


java.util.Date will give it to you.
 



thanks.


In what fashion do you mean integrate?
Adding this:
dependency
groupIdjoda-time/groupId
artifactIdjoda-time/artifactId
version1.6/version

/dependency
  


 to the dependency section to your maven POM will bring in the
jar files.

On Fri, Feb 26, 2010 at 10:14 AM, Hannes hannes.flo...@gmx.li
mailto:hannes.flo...@gmx.li wrote:

Hi Peter,

I read your mail, maybe you can help me. I'm wondering how I
can integrate JodaTime or scala-time into my project.

thanks.
Hannes

This is more a question for Jorge than anyone else but
since it's Lift-
related I thought I'd put it here:

What's the easiest way to add scala-tools to my Lift
project's
pom.xml? My knowledge of Maven is very limited, but I
hope that it is
simply a matter of adding another repository and dependency.

Thanks,
Peter Robinett

--

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 mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb%2bunsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=.


 



-- 
You received this message because you are subscribed to the

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




-- 
James A Barrows


-- 
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
mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.


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

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




--
James A Barrows

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

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


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



Re: [Lift] scala-time and Lift pom.xml

2010-02-26 Thread Hannes
I swear that I ONLY use it to compare if things are older than other 
things. I think comparison of long values is faster than string or date 
comparison, or?


thanks.


On Fri, Feb 26, 2010 at 10:52 AM, Hannes hannes.flo...@gmx.li 
mailto:hannes.flo...@gmx.li wrote:


THANKS!

You saved my weekend


You're welcome.
 On the other hand using a Long as a date terrifies me, and makes 
me think your weekend, and the next three are all toast... but, maybe 
not...



 





On Fri, Feb 26, 2010 at 10:43 AM, Hannes hannes.flo...@gmx.li
mailto:hannes.flo...@gmx.li wrote:

Jim,

Thanks that helped!

Maybe its to late, or I don't know what, but.

Its a bit complicated to use I think. What's about
scala-time? For my purpose, I just need the the time as a
number (e.g. long). How do I do that?


java.util.Date will give it to you.
 



thanks.


In what fashion do you mean integrate?
Adding this:
dependency
groupIdjoda-time/groupId
artifactIdjoda-time/artifactId
version1.6/version

/dependency
  


 to the dependency section to your maven POM will bring in
the jar files.

On Fri, Feb 26, 2010 at 10:14 AM, Hannes
hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li wrote:

Hi Peter,

I read your mail, maybe you can help me. I'm wondering
how I can integrate JodaTime or scala-time into my project.

thanks.
Hannes

This is more a question for Jorge than anyone else
but since it's Lift-
related I thought I'd put it here:

What's the easiest way to add scala-tools to my Lift
project's
pom.xml? My knowledge of Maven is very limited, but
I hope that it is
simply a matter of adding another repository and
dependency.

Thanks,
Peter Robinett

--

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
mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb%2bunsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=.


 



-- 
You received this message because you are subscribed to

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




-- 
James A Barrows


-- 
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 mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.


-- 
You received this message because you are subscribed to the

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




-- 
James A Barrows


-- 
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
mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.


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

Groups Lift group.
To post to this group, send email to liftweb@googlegroups.com
mailto:liftweb@googlegroups.com.
To unsubscribe from this group, send email to
liftweb+unsubscr...@googlegroups.com
mailto:liftweb

Re: [Lift] Re: scala-time and Lift pom.xml

2010-02-26 Thread Hannes

OK, thanks a lot to all of you, for helping me!

I really appreciate it!

Keep your Longs as millisecond UTC timestmaps and you should be ok.
That being said, it does make sense to keep your time information in
time-specific objects. To use scala-time add the following to the
dependencies section of your POM:
!-- for scala-time --
dependency
  groupIdorg.scala-tools/groupId
  artifactIdtime/artifactId
  version2.7.4-0.1/version !-- FIXME: Using version for Scala
2.7.4! --
/dependency

As I mentioned in your original thread about time, Jorge hasn't
compiled scala-time for the latest versions of Scala but I found that
the 2.7.4 version worked.

Peter

On Feb 26, 10:14 am, Jim Barrows jim.barr...@gmail.com wrote:
  

On Fri, Feb 26, 2010 at 11:12 AM, Hannes hannes.flo...@gmx.li wrote:


 I swear that I ONLY use it to compare if things are older than other
things. I think comparison of long values is faster than string or date
comparison, or?
  

In what timezone?  and for what calendar?









thanks.
  
On Fri, Feb 26, 2010 at 10:52 AM, Hannes hannes.flo...@gmx.li wrote:
  

THANKS!

You saved my weekend


You're welcome.
 On the other hand using a Long as a date terrifies me, and makes me
think your weekend, and the next three are all toast... but, maybe
not...
  

 On Fri, Feb 26, 2010 at 10:43 AM, Hannes hannes.flo...@gmx.li wrote:


Jim,
  
Thanks that helped!
  
Maybe its to late, or I don't know what, but.
  
Its a bit complicated to use I think. What's about scala-time? For my

purpose, I just need the the time as a number (e.g. long). How do I do that?
  

java.util.Date will give it to you.


thanks.
  
In what fashion do you mean integrate?

Adding this:
  
dependency

groupIdjoda-time/groupId
artifactIdjoda-time/artifactId
version1.6/version
  
/dependency
  
 to the dependency section to your maven POM will bring in the jar files.
  
On Fri, Feb 26, 2010 at 10:14 AM, Hannes hannes.flo...@gmx.li wrote:
  

Hi Peter,

I read your mail, maybe you can help me. I'm wondering how I can

integrate JodaTime or scala-time into my project.

thanks.

Hannes


This is more a question for Jorge than anyone else but since it's Lift-
related I thought I'd put it here:
  
What's the easiest way to add scala-tools to my Lift project's

pom.xml? My knowledge of Maven is very limited, but I hope that it is
simply a matter of adding another repository and dependency.
  
Thanks,

Peter Robinett
  
--
  
You received this message because you are subscribed to the Google

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

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


--
James A Barrows
  
--

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

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

--
James A Barrows

--

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

   --

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


--
James A Barrows
  
--

You received this message because you are subscribed to the Google

RE: [Lift] Re: redirectTo in (Stateful)Snippets

2010-02-23 Thread Restel, Hannes
Hi David.
thanks for your answer. It helped me a lot!
Didn't knew that SiteMap disables serving unregistered pages..

Now two more questions to come:

1) citation from David: Second, you can define a subdirectory that all content 
will be served from.
How do I do that?

2) I found out some strange behaviour: I named my page to redirect to 
search.html.
When calling that page, an error occured:
Exception occured while processing /search

Message: java.lang.IllegalArgumentException: line 1 does not exist

scala.io.Source.getLine(Source.scala:280)

scala.io.Source.report(Source.scala:368)

scala.io.Source.reportError(Source.scala:355) (..)
 
When chosing another name for the page then all works fine.
So the question is: is the page name search an reserved keyword in Lift?

Thanks!



Hannes Restel | Fraunhofer Institut für Software- und Systemtechnik
Sichere Business IT-Infrastrukuren, Studentischer Mitarbeiter
Steinplatz 2, 10623 Berlin, Germany
Telefon: +49 (0)30/24 306-324
mailto:hannes.res...@isst.fraunhofer.de
http://www.isst.fraunhofer.de

From: liftweb@googlegroups.com [mailto:lift...@googlegroups.com] On Behalf Of 
David Pollak
Sent: Monday, February 22, 2010 7:20 PM
To: liftweb@googlegroups.com
Subject: Re: [Lift] Re: redirectTo in (Stateful)Snippets


On Mon, Feb 22, 2010 at 1:53 AM, Restel, Hannes 
hannes.res...@isst.fraunhofer.demailto:hannes.res...@isst.fraunhofer.de 
wrote:
Hi Nico,
thanks for your answer.

I think you misunderstood me: I want to redirect to a HTML-page without using a 
SiteMap at all. So the page I redirect to is not registered in any place. It 
simply resides in my 'webapp' folder.
But when trying to redirect to that page, the resource (i.e. my page) is not 
found.

Yes.  This is correct behavior.  If you have defined a SiteMap, Lift will not 
serve any pages except those that are defined in the SiteMap.  If you are using 
Lift  1.0.x, there will be a polite message as part of the 404 informing you 
why the page was not served (if you're running in development mode.)

You have a couple of choices to serve additional pages.  First, you can include 
them in the SiteMap and mark them as Hidden such that there's no menu item 
displayed, but the page will still be served.  Second, you can define a 
subdirectory that all content will be served from.


So please try again :-)

(And yes: I did read The Lift Book :-)

Cheers,
   Hannes



-Original Message-
From: liftweb@googlegroups.commailto:liftweb@googlegroups.com 
[mailto:liftweb@googlegroups.commailto:liftweb@googlegroups.com] On Behalf Of 
Nico Tromp
Sent: Friday, February 19, 2010 2:46 PM
To: Lift
Subject: [Lift] Re: redirectTo in (Stateful)Snippets

Hannes, sorry for the strange :) sentence. It should read:

did you register the page in the Boot class?

If you want to know more about the SiteMap have a look at chapter 5
from the lift book. At the bottom of the page (http://
groups.google.com/group/the-lift-bookhttp://groups.google.com/group/the-lift-book)
 there is a link to the PDF
version.

Happy reading

Nico Tromp

On Feb 19, 1:49 pm, Nico Tromp 
nico.tr...@gmail.commailto:nico.tr...@gmail.com wrote:
 Hannes,

 did you registered the page in the in the Boot class? Below is a small
 example.

 ===
 class Boot {
   def boot {
 // where to search snippet
 // LiftRules.addToPackages(enter your package)

  // Build SiteMap
 val entries = Menu(Loc(Home, List(index), Home)) ::
   Menu(Loc(Search, List(search), Search page)) ::
   Nil
 LiftRules.setSiteMap(SiteMap(entries:_*))
   }}

 ===
 Hope this is helpfull

 Cheers Nico Tromp

 On Feb 19, 1:26 pm, Restel, Hannes



 hannes.res...@isst.fraunhofer.demailto:hannes.res...@isst.fraunhofer.de 
 wrote:
  Hi,

  I am new to Lift (and Scala) and need help with dispatching/redirecting to 
  a page after processing a form.

  My problem: I get a The Requested URL /search was not found on this 
  server error message although the page search.html does exist.

  When adding the page search.html to the LiftRules-SiteMap, then the page 
  does exist!
  So is there any need to register HTML pages? I hope not!

  This is my HTML fragment:
  lift:surround with=default at=content
   h3 class=alt Search
lift:HelloWorld.search form=POST
  entry:searchfield/
  entry:submit/
/lift:HelloWorld.search
   /h3
  /lift:surround

  And this is the corresponding Scala code:
  class HelloWorld extends StatefulSnippet {

override def dispatch:DispatchIt = {
  case search = search _
}

def search(xhtml : NodeSeq) : NodeSeq = {
  object searchExpression extends RequestVar()

  def processSearch () {
if (searchExpression.isEmpty) {
  S.error(Must not be empty!)
}
else {
  S.notice(Value was:  + searchExpression)
  redirectTo(/search)
}
  }

  bind(entry, xhtml,
  searchfield

RE: [Lift] Re: redirectTo in (Stateful)Snippets

2010-02-22 Thread Restel, Hannes
Hi Nico,
thanks for your answer.

I think you misunderstood me: I want to redirect to a HTML-page without using a 
SiteMap at all. So the page I redirect to is not registered in any place. It 
simply resides in my 'webapp' folder.
But when trying to redirect to that page, the resource (i.e. my page) is not 
found.

So please try again :-)

(And yes: I did read The Lift Book :-)

Cheers,
Hannes



-Original Message-
From: liftweb@googlegroups.com [mailto:lift...@googlegroups.com] On Behalf Of 
Nico Tromp
Sent: Friday, February 19, 2010 2:46 PM
To: Lift
Subject: [Lift] Re: redirectTo in (Stateful)Snippets

Hannes, sorry for the strange :) sentence. It should read:

did you register the page in the Boot class?

If you want to know more about the SiteMap have a look at chapter 5
from the lift book. At the bottom of the page (http://
groups.google.com/group/the-lift-book) there is a link to the PDF
version.

Happy reading

Nico Tromp

On Feb 19, 1:49 pm, Nico Tromp nico.tr...@gmail.com wrote:
 Hannes,

 did you registered the page in the in the Boot class? Below is a small
 example.

 ===
 class Boot {
   def boot {
     // where to search snippet
     // LiftRules.addToPackages(enter your package)

  // Build SiteMap
     val entries = Menu(Loc(Home, List(index), Home)) ::
       Menu(Loc(Search, List(search), Search page)) ::
       Nil
     LiftRules.setSiteMap(SiteMap(entries:_*))
   }}

 ===
 Hope this is helpfull

 Cheers Nico Tromp

 On Feb 19, 1:26 pm, Restel, Hannes



 hannes.res...@isst.fraunhofer.de wrote:
  Hi,

  I am new to Lift (and Scala) and need help with dispatching/redirecting to 
  a page after processing a form.

  My problem: I get a The Requested URL /search was not found on this 
  server error message although the page search.html does exist.

  When adding the page search.html to the LiftRules-SiteMap, then the page 
  does exist!
  So is there any need to register HTML pages? I hope not!

  This is my HTML fragment:
  lift:surround with=default at=content
   h3 class=alt Search
    lift:HelloWorld.search form=POST
      entry:searchfield/
      entry:submit/
    /lift:HelloWorld.search
   /h3
  /lift:surround

  And this is the corresponding Scala code:
  class HelloWorld extends StatefulSnippet {

    override def dispatch:DispatchIt = {
      case search = search _
    }

    def search(xhtml : NodeSeq) : NodeSeq = {
      object searchExpression extends RequestVar()

      def processSearch () {
        if (searchExpression.isEmpty) {
          S.error(Must not be empty!)
        }
        else {
          S.notice(Value was:  + searchExpression)
          redirectTo(/search)
        }
      }

      bind(entry, xhtml,
          searchfield - SHtml.text(searchExpression.is, 
  searchExpression(_)),
          submit - SHtml.submit(Suche, processSearch)
      )
    }

  }

  Why cannot my /search page be found?

  Thanks for help!
          Hannes

  Hannes Restel | Fraunhofer Institut für Software- und Systemtechnik
  Sichere Business IT-Infrastrukuren, Studentischer Mitarbeiter
  Steinplatz 2, 10623 Berlin, Germany
  Telefon: +49 (0)30/24 306-324
  mailto:hannes.res...@isst.fraunhofer.dehttp://www.isst.fraunhofer.de

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

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



Re: [Lift] Re: What is the current working pattern for storing timestamps?

2010-02-22 Thread Hannes

Hi Peter,

Thanks in advance.

I was browsing through the list and read, that there's a lot of problems 
with the Java stuff. That's why I asked. I'll have a look at this 
JodaTime thing...


thanks.



Hi Hannes,

Jonathan's suggestion of MappedDateTime is a good one and one that I
have used. However, I haven't been super happy about how time is
handled by, in my case, MappedDateTime + java.util.Date + MySQL
Datetime. I played around a little with making a MappedField that
holds a ScalaTime (ie JodaTime) object that would be persisted in a
database as a millisecond UTC timestamp but didn't get very far with
it. I believe if you look through this mailing list you'll find
someone else (sorry, I forget who!) talking about basically doing just
this and sharing some code. Anyway, just another possible approach...

Peter

On Feb 21, 10:59 am, Jonathan Hoffman jonhoff...@gmail.com wrote:
  

Does MappedDateTime do what you want?

Also look at MappedEnum for the status

On Feb 21, 2010, at 6:07 AM, Hannes wrote:





Hi Lifters,
  
I'm using Mapper with Lift 1.1-M7 and I need to have some information about time.
  
Especially I wanna store a time-stamp for a status field that can have three values: NEW; OPEN; CLOSED;
  
So, what I thought about was defining two new fields open_time and close_time that I'd use to filter/sort items.
  
thanks for any ideas!
  
--

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


  


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



[Lift] What is the current working pattern for storing timestamps?

2010-02-21 Thread Hannes

Hi Lifters,


I'm using Mapper with Lift 1.1-M7 and I need to have some information 
about time.


Especially I wanna store a time-stamp for a status field that can have 
three values: NEW; OPEN; CLOSED;


So, what I thought about was defining two new fields open_time and 
close_time that I'd use to filter/sort items.



thanks for any ideas!

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



[Lift] redirectTo in (Stateful)Snippets

2010-02-19 Thread Restel, Hannes
Hi,

I am new to Lift (and Scala) and need help with dispatching/redirecting to a 
page after processing a form.

My problem: I get a The Requested URL /search was not found on this server 
error message although the page search.html does exist.

When adding the page search.html to the LiftRules-SiteMap, then the page does 
exist!
So is there any need to register HTML pages? I hope not!

This is my HTML fragment:
lift:surround with=default at=content
 h3 class=alt Search
  lift:HelloWorld.search form=POST
entry:searchfield/
entry:submit/
  /lift:HelloWorld.search
 /h3
/lift:surround

And this is the corresponding Scala code:
class HelloWorld extends StatefulSnippet {
  
  override def dispatch:DispatchIt = {
case search = search _
  }
  
  def search(xhtml : NodeSeq) : NodeSeq = {
object searchExpression extends RequestVar()

def processSearch () {
  if (searchExpression.isEmpty) {
S.error(Must not be empty!)
  }
  else {
S.notice(Value was:  + searchExpression)
redirectTo(/search)
  }
}

bind(entry, xhtml,
searchfield - SHtml.text(searchExpression.is, searchExpression(_)),
submit - SHtml.submit(Suche, processSearch)
)
  }
}


Why cannot my /search page be found?

Thanks for help!
Hannes

Hannes Restel | Fraunhofer Institut für Software- und Systemtechnik
Sichere Business IT-Infrastrukuren, Studentischer Mitarbeiter
Steinplatz 2, 10623 Berlin, Germany
Telefon: +49 (0)30/24 306-324
mailto:hannes.res...@isst.fraunhofer.de
http://www.isst.fraunhofer.de

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



Re: [Lift] Re: Documentation Site

2009-12-20 Thread Hannes
Hi Tim,

Thanks for your reply.
 1.0 is the last official release that was not a milestone or snapshot
 - thus, they are the primary api docs right now until we release 2.0
 (that is, what was being called 1.1 is being renamed to 2.0). API docs
 are a process issue, and handled as part of our build process - they
 will always live both on scala-tools and liftweb.net where applicable.
 They wont ever sit anywhere else (officially).
   
I just mentioned the API docs, because some time ago I was on the look 
for something I couldn't find in the 1.0 docs and than I had real 
problems to find the link for the 1.1 docs.
 Yes, the wiki is a little out dated. I forget the number of times i've
 tried to spear head a wiki effort... the bottom line is that other
 people need to start writing content - there are a fair number of
 competent lift users in the community who simply are not giving
 anything back by way of articles or wiki cleaning - thus our docs get
 out dated fast because the team prefer to write code than
 documentation. We even tried to appointed a wiki gardener but he
 appears to have just disappeared into the ether... Id be open to
 hearing suggestions on how one could keep the wiki more up to date?
 Short of users actually contributing back, there is a limit on what
 the team can do at anyone time. We are getting there, but its not
 going to be an overnight process.

   
Actually I didn't used the Lift Wiki so much, because in general I don't 
like the Media Wiki content organization so much. I think (my personal 
opinion) there are to much links and sometimes its hard to see which 
ones belong to the Media Wiki functionality itself and which ones are 
actually representing the interesting stuff. I think this was one of 
the major reasons why I didn't applied as a Wiki gardener.
 Blogs - a fundamental corner stone of the internet and your right,
 they are a great information repository. Perhaps we could syndicate
 some blogs onto liftweb.net during the rewrite (yes, im going to
 rewrite it at last!)... certainly open for that.
   
Maybe some idea would be to setup liftweb.net with some CMS and first 
re-arrange and update the content there and than, as a second run, 
include Blogs, the Wiki and easy to find links for the API docs.

Besides that, another problem with Media Wiki is, that it doesn't 
provide all the functionality, that this project needs and because of 
this, at least one other application is needed to deal with the rest. A 
CMS can do a lot and there are a lot of plug-ins available  for all 
kinds of stuff (a lot of stuff that doesn't need to be re-invented). And 
I believe that one system is easier to handle than three different ones.

Like I said before, just my opinion and an idea.
 Cheers, Tim

 PS: Sorry that was a bit of a rant, but this is a frustrating issue
 that i've been pushing for over a year ;-)

   
thanks.

 On Dec 19, 1:16 pm, Hannes hannes.flo...@gmx.li wrote:
   
 Definitely! I would like one location for everything, but I believe that
 the current situation is not like that.

 - there two API docs 1.0 and 1.1, the latter is hard to find
 - there's liftweb.net (a little bit out-dated)
 - there's the Wiki
 - there's David's Blog (that has some unique information)

 What did I forget?

 thanks.



 
 Why not improve the existing wiki on github?
   
 Or fork the book and make improvements that way?
   
 I'm not opposed to additional resources, but why create another place
 where docs may or not be out of date?
   
 I think that Lift is still at the point where one location of docs is
 better.
   
 My opinion.
   
 On Dec 19, 6:37 am, Hannes hannes.flo...@gmx.li wrote:
   
 Hi Lifters,
 
 I'm thinking about setting up a site that takes together all available
 information about Lift (Links, News, ...).
 
 I would like to know, if this would be appreciated or not. I still think
 that all the available information is to much spread out - specially for
 people who get started with Lift. In case of positive responds, I would
 like to setup a Plone (CMS) site. I think its a really good tool, to
 organize content.
 
 thanks for listening.
 
 --
   
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@googlegroups.com.
 To unsubscribe from this group, send email to 
 liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/liftweb?hl=en.
   

 --

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


   

--

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

[Lift] Documentation Site

2009-12-19 Thread Hannes
Hi Lifters,

I'm thinking about setting up a site that takes together all available 
information about Lift (Links, News, ...).

I would like to know, if this would be appreciated or not. I still think 
that all the available information is to much spread out - specially for 
people who get started with Lift. In case of positive responds, I would 
like to setup a Plone (CMS) site. I think its a really good tool, to 
organize content.

thanks for listening.

--

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




Re: [Lift] Re: Documentation Site

2009-12-19 Thread Hannes
Definitely! I would like one location for everything, but I believe that 
the current situation is not like that.

- there two API docs 1.0 and 1.1, the latter is hard to find
- there's liftweb.net (a little bit out-dated)
- there's the Wiki
- there's David's Blog (that has some unique information)

What did I forget?

thanks.


 Why not improve the existing wiki on github?

 Or fork the book and make improvements that way?

 I'm not opposed to additional resources, but why create another place
 where docs may or not be out of date?

 I think that Lift is still at the point where one location of docs is
 better.

 My opinion.

 On Dec 19, 6:37 am, Hannes hannes.flo...@gmx.li wrote:
   
 Hi Lifters,

 I'm thinking about setting up a site that takes together all available
 information about Lift (Links, News, ...).

 I would like to know, if this would be appreciated or not. I still think
 that all the available information is to much spread out - specially for
 people who get started with Lift. In case of positive responds, I would
 like to setup a Plone (CMS) site. I think its a really good tool, to
 organize content.

 thanks for listening.
 

 --

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


   

--

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




Re: [Lift] method call from out of nowhere

2009-12-01 Thread Hannes
David Pollak schrieb:


 On Mon, Nov 30, 2009 at 11:26 PM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 Hi David,



 On Mon, Nov 30, 2009 at 12:11 AM, Hannes hannes.flo...@gmx.li
 mailto:hannes.flo...@gmx.li wrote:

 Hi David,

 In my LimitOrder Meta Object, I did:

 override def afterCreate

 to inform an Actor, everytime a new Order is created. The
 Actor than calls the joinOtherOrders method.
 #
 I think I understand it now. Cause I'm creating new orders
 inside the loop at some point. But still I don' t really
 know, why it gets called after the old scope of
 joinOtherOrders ends...


 Sounds to me like it's all in your application's logic.  As
 others have pointed out, Thread.dumpStack will let you figure out
 where things are being called.
 I think the biggest problem is, that its necessary in my logic to
 inform the Actor, everytime a new order is created. This
 while-loop is an exception to this rule. I don't think that it
 would be a good idea, to change the behavior of how the Actor
 responds to messages, just to fix this case, or? Or is there any
 chance to tell a new order NOT to inform the Actor, even when its
 defined in def afterCreate ?


 Without seeing the whole of your application logic, it's difficult for 
 me to advise you.
  



 Also, you might want to use recursion and pattern matching to
 replace your while loop (which is O(n^2) btw):

 def dealWithList(in: List[Something]): Unit = in match {
   case Nil = () // nothing left to do
   case x :: _ if x.condition1 = x.doThing1
   case x :: _ if x.condition2 = x.doThing2
   case x :: xs if x.condition3 = x.doThing3 ; dealWithList(xs)
   case _ :: xs = dealWithList(xs)
 }
 I thought about pattern matching as well, but in my first
 implementation, I just wanted to get it running and change it
 afterwards. Something else: I think recursion is slower than a
 while-loop as long as its not tail recursive, or?


 This case is tail recursive, so it's as fast as a well written while 
 loop.  But you've got an O(n ^ 2) construct in your app, so 
 performance doesn't seem to be paramount.
No, performance is really importantbut I'm going to improve this 
later on as well... :-)

thanks.

 Thanks,

 David
  


 thanks.


 You have the same semantics of a while loop with the ability to
 break out, but the code is about your logic rather than about
 looping.
  


 thanks.



 On Sun, Nov 29, 2009 at 7:24 AM, Hannes
 hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li wrote:

 Hey Lifters,


 How is joinOtherOrders being invoked?
  


 I've some really strange things going on here. Please
 consider this
 method definition. I've put alot of print debug
 statements between
 other statements. There's a while-loop that only starts,
 when the given
 list (orders) is not empty. It stops when done is set
 to true. So far,
 so good. Than, have a look at the Lift output. I put in
 a comment,
 pointing out where the program runs into the while loop.

 What really shocks me, are these print statements :

 before done=false
 after done=true
 i += 1
 outside while
 INFO - Service request (GET) / took 121 Milliseconds
 start of joinAll!


 The loop ends with outside while and than the method
 gets called again
 immediately! But who calls it? I don't

 Any ideas?

 thanks.



  method definition
 
 --

 def joinOtherOrders: Unit = {

def joinAll(orders: List[LimitOrder]) = {

println(start of joinAll!)

var done = false

var i = 0

while (!orders.isEmpty  !done) {

println(i= + i + ,  +
 orders.isEmpty= + orders.isEmpty + ,  + done= + done)

if (this.lots.is http://this.lots.is ==
 orders(i).lots.is http://lots.is){

println(case-1)

println(this= + this + ,
 orders(i)= + orders(i))

this.open(orders(i))

done = true

}

if (this.lots.is http://this.lots.is 
 orders(i).lots.is http://lots.is){

println(case-2)

println

Re: [Lift] method call from out of nowhere

2009-11-30 Thread Hannes
It is called outside from an Actor, everytime a new item is created.

thanks.
 Where is joinOtherOrders()called within your code?

 alex

 On Sun, Nov 29, 2009 at 7:24 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 Hey Lifters,

 I've some really strange things going on here. Please consider this
 method definition. I've put alot of print debug statements between
 other statements. There's a while-loop that only starts, when the
 given
 list (orders) is not empty. It stops when done is set to true.
 So far,
 so good. Than, have a look at the Lift output. I put in a comment,
 pointing out where the program runs into the while loop.

 What really shocks me, are these print statements :

 before done=false
 after done=true
 i += 1
 outside while
 INFO - Service request (GET) / took 121 Milliseconds
 start of joinAll!


 The loop ends with outside while and than the method gets called
 again
 immediately! But who calls it? I don't

 Any ideas?

 thanks.



  method definition
 --

 def joinOtherOrders: Unit = {

def joinAll(orders: List[LimitOrder]) = {

println(start of joinAll!)

var done = false

var i = 0

while (!orders.isEmpty  !done) {

println(i= + i + ,  + orders.isEmpty= +
 orders.isEmpty + ,  + done= + done)

if (this.lots.is http://this.lots.is ==
 orders(i).lots.is http://lots.is){

println(case-1)

println(this= + this + , orders(i)= +
 orders(i))

this.open(orders(i))

done = true

}

if (this.lots.is http://this.lots.is 
 orders(i).lots.is http://lots.is){

println(case-2)

println(this= + this + , orders(i)= +
 orders(i))

orders(i).reduceLots(this.lots.is
 http://this.lots.is)

val newOrder = orders(i).cloneWith(this.lots.is
 http://this.lots.is)

newOrder.save

this.open(newOrder)

println(before done= + done)

done = true

println(after done= + done)

}

if (this.lots.is http://this.lots.is 
 orders(i).lots.is http://lots.is){

println(case-3)

println(this= + this + , orders(i)= +
 orders(i))

this.reduceLots(orders(i).lots.is http://lots.is)

val newOrder = this.cloneWith(orders(i).lots.is
 http://lots.is)

newOrder.save

newOrder.open(orders(i))

}

i += 1

println(i += 1)

}

println(outside while)

}

def findLimitOrdersById: List[LimitOrder]  =

this.findCandidates.map(x = LimitOrderMetaObj.findAll(

By(LimitOrderMetaObj.id, x)).head)

joinAll(findLimitOrdersById)

}


 -- Lift Output
 
 ---


 [INFO] Started Jetty Server
 [INFO] Starting scanner at interval of 5 seconds.
 INFO - Service request (GET)
 /comet_request/54834680365/y7kybsmuyv1g took 64 Milliseconds
 INFO - Service request (GET)
 /comet_request/85319966940/y7kybsmuyv1g took 23 Milliseconds
 INFO - Service request (GET) /favicon.ico took 86 Milliseconds
 INFO - Service request (GET)
 /comet_request/41521581405/y7kybsmuyv1g took 48 Milliseconds
 INFO - Service request (GET)
 /comet_request/93176242746/y7kybsmuyv1g took 7 Milliseconds
 INFO - Service request (GET) /favicon.ico took 38 Milliseconds
 INFO - Service request (GET) /favicon.ico took 5 Milliseconds
 INFO - Service request (GET) / took 551 Milliseconds
 INFO - Service request (GET)
 /comet_request/81361316835/y7kybsmuyv1g took 9 Milliseconds
 INFO - Service request (GET) /favicon.ico took 16 Milliseconds
 INFO - Service request (GET) / took 61 Milliseconds
 INFO - Service request (GET)
 /comet_request/76898140873/y7kybsmuyv1g took 30 Milliseconds
 INFO - Service request (GET)
 /comet_request/e8jesgmo10oq/cometAjax.js took 14 Milliseconds
 INFO - Service request (GET) / took 354 Milliseconds
 INFO - Service request (GET) / took 734 Milliseconds
 INFO - Service request (GET) / took 484 Milliseconds
 INFO - Service request (GET) /images/ajax-loader.gif took 7
 Milliseconds
 INFO - Service request

Re: [Lift] Re: method call from out of nowhere

2009-11-30 Thread Hannes
Hi Marius,

the method is called from an Actor, everytime a new order is created. I 
did override def afterCreate in my LimitOrder MetaObject.

thanks.
 In your code in what conditions  joinOtherOrders gets called ?

 Br's,
 Marius

 On Nov 29, 6:18 pm, Hannes hannes.flo...@gmx.li wrote:
   
 Hi Tim, Hannes,

 
 Firstly, I really, really wouldn't write your code like that...
   
 Things of note:
 - two defs inside defs... you usually wouldnt do this without a good reason 
 (like SHtml.submit(whatever _))
   
 The two defs only make sence together, that's why I put them together in
 one def. I think that's encapsulation... - dont use while loops. period. 
 you have a List[T], use foreach if you have a unit operation

 Yeah, that's true. But the problem is, that my logic requires to stop
 the iteration at some point. How I gonna do that with a foreach construct? 
 def joinAll(orders: List[LimitOrder]): Unit =
 
   orders.foreach(order = {
 // your logic here
   })
   
 You should look to remove a lot of that boiler plate... its looks very 
 javaish and mutable. Generally speaking, scala programmers avoid mutable 
 state like one would avoid bubonic plague.
   
 Your totally right! Its mutable, cause its changing the state of my
 objects. But that's necessary at this point. Before worrying about the 
 errors, id change your code, then take another look... its almost certainly 
 this bad organisation causing the issues.

 I agree with you, that this is not the most beautiful code I every saw,
 but I believe that the things you mentioned are not interfering with the
 problem I'm facing. At least not because of a while-loop and some inner
 local defs.

 
 Cheers, Tim
   
 thanks.

 
 On 29 Nov 2009, at 15:24, Hannes wrote:
   
 Hey Lifters,
 
 I've some really strange things going on here. Please consider this
 method definition. I've put alot of print debug statements between
 other statements. There's a while-loop that only starts, when the given
 list (orders) is not empty. It stops when done is set to true. So far,
 so good. Than, have a look at the Lift output. I put in a comment,
 pointing out where the program runs into the while loop.
 
 What really shocks me, are these print statements :
 
 before done=false  
 
 after done=true
 
 i += 1 
  
 outside while  
 
 INFO - Service request (GET) / took 121 Milliseconds   
  
 start of joinAll!  
 
 
 The loop ends with outside while and than the method gets called again
 immediately! But who calls it? I don't
 
 Any ideas?
 
 thanks.
 
  method definition
 --
 
 def joinOtherOrders: Unit = {
 
def joinAll(orders: List[LimitOrder]) = {
 
println(start of joinAll!)
 
var done = false
 
var i = 0
 
while (!orders.isEmpty  !done) {
 
println(i= + i + ,  + orders.isEmpty= + 
 orders.isEmpty + ,  + done= + done)
 
if (this.lots.is == orders(i).lots.is){
 
println(case-1)
 
println(this= + this + , orders(i)= + orders(i))
 
this.open(orders(i))
 
done = true
 
}
 
if (this.lots.is  orders(i).lots.is){
 
println(case-2)
 
println(this= + this + , orders(i)= + orders(i))
 
orders(i).reduceLots(this.lots.is)
 
val newOrder = orders(i).cloneWith(this.lots.is)
 
newOrder.save
 
this.open(newOrder)
 
println(before done= + done)
 
done = true
 
println(after done= + done)
 
}
 
if (this.lots.is  orders(i).lots.is){
 
println(case-3)
 
println(this= + this + , orders(i)= + orders(i))
 
this.reduceLots(orders(i).lots.is)
 
val newOrder = this.cloneWith(orders(i).lots.is)
 
newOrder.save
 
newOrder.open(orders(i

Re: [Lift] Re: method call from out of nowhere

2009-11-30 Thread Hannes
Timothy Perrett schrieb:
 The two defs only make sence together, that's why I put them together in
 one def. I think that's encapsulation... - dont use while loops. period. 
 you have a List[T], use foreach if you have a unit operation

 

 If you want encapsulation, because they only make sense together,
 stick them in a trait - something about this inner def for your use
 case feels very wrong.

   
 Yeah, that's true. But the problem is, that my logic requires to stop
 the iteration at some point. How I gonna do that with a foreach construct?
 

 This is where I think you should evaluate your thinking. stoping
 iteration is a java way of working... in scala i would typically
 filter the list before iterating on it:

 orders.filter(predicate).foreach(order = { ... })

 That seems to be a lot neater - my point was more go look at the
 other method options on List[T] rather than the code i show here is
 the defacto way for your use case.
   
OK, I'm going to figure out, how to transform the while-loop into a 
foreach
   
 I agree with you, that this is not the most beautiful code I every saw,
 but I believe that the things you mentioned are not interfering with the
 problem I'm facing. At least not because of a while-loop and some inner
 local defs.
 

 Are you calling this code in a try, catch, finally block by any
 chance?
   
In gets called from an Actor, everytime a new LimitOrder is created.
 Tim

 --

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


   

--

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




Re: [Lift] method call from out of nowhere

2009-11-30 Thread Hannes
Hi David,

In my LimitOrder Meta Object, I did:

override def afterCreate

to inform an Actor, everytime a new Order is created. The Actor than 
calls the joinOtherOrders method.
#
I think I understand it now. Cause I'm creating new orders inside the 
loop at some point. But still I don' t really know, why it gets called 
after the old scope of joinOtherOrders ends...

thanks.


 On Sun, Nov 29, 2009 at 7:24 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 Hey Lifters,


 How is joinOtherOrders being invoked?
  


 I've some really strange things going on here. Please consider this
 method definition. I've put alot of print debug statements between
 other statements. There's a while-loop that only starts, when the
 given
 list (orders) is not empty. It stops when done is set to true.
 So far,
 so good. Than, have a look at the Lift output. I put in a comment,
 pointing out where the program runs into the while loop.

 What really shocks me, are these print statements :

 before done=false
 after done=true
 i += 1
 outside while
 INFO - Service request (GET) / took 121 Milliseconds
 start of joinAll!


 The loop ends with outside while and than the method gets called
 again
 immediately! But who calls it? I don't

 Any ideas?

 thanks.



  method definition
 --

 def joinOtherOrders: Unit = {

def joinAll(orders: List[LimitOrder]) = {

println(start of joinAll!)

var done = false

var i = 0

while (!orders.isEmpty  !done) {

println(i= + i + ,  + orders.isEmpty= +
 orders.isEmpty + ,  + done= + done)

if (this.lots.is http://this.lots.is ==
 orders(i).lots.is http://lots.is){

println(case-1)

println(this= + this + , orders(i)= +
 orders(i))

this.open(orders(i))

done = true

}

if (this.lots.is http://this.lots.is 
 orders(i).lots.is http://lots.is){

println(case-2)

println(this= + this + , orders(i)= +
 orders(i))

orders(i).reduceLots(this.lots.is
 http://this.lots.is)

val newOrder = orders(i).cloneWith(this.lots.is
 http://this.lots.is)

newOrder.save

this.open(newOrder)

println(before done= + done)

done = true

println(after done= + done)

}

if (this.lots.is http://this.lots.is 
 orders(i).lots.is http://lots.is){

println(case-3)

println(this= + this + , orders(i)= +
 orders(i))

this.reduceLots(orders(i).lots.is http://lots.is)

val newOrder = this.cloneWith(orders(i).lots.is
 http://lots.is)

newOrder.save

newOrder.open(orders(i))

}

i += 1

println(i += 1)

}

println(outside while)

}

def findLimitOrdersById: List[LimitOrder]  =

this.findCandidates.map(x = LimitOrderMetaObj.findAll(

By(LimitOrderMetaObj.id, x)).head)

joinAll(findLimitOrdersById)

}


 -- Lift Output
 
 ---


 [INFO] Started Jetty Server
 [INFO] Starting scanner at interval of 5 seconds.
 INFO - Service request (GET)
 /comet_request/54834680365/y7kybsmuyv1g took 64 Milliseconds
 INFO - Service request (GET)
 /comet_request/85319966940/y7kybsmuyv1g took 23 Milliseconds
 INFO - Service request (GET) /favicon.ico took 86 Milliseconds
 INFO - Service request (GET)
 /comet_request/41521581405/y7kybsmuyv1g took 48 Milliseconds
 INFO - Service request (GET)
 /comet_request/93176242746/y7kybsmuyv1g took 7 Milliseconds
 INFO - Service request (GET) /favicon.ico took 38 Milliseconds
 INFO - Service request (GET) /favicon.ico took 5 Milliseconds
 INFO - Service request (GET) / took 551 Milliseconds
 INFO - Service request (GET)
 /comet_request/81361316835/y7kybsmuyv1g took 9 Milliseconds
 INFO - Service request (GET) /favicon.ico took 16 Milliseconds
 INFO - Service request (GET) / took 61 Milliseconds
 INFO - Service request (GET)
 /comet_request/76898140873/y7kybsmuyv1g took 30 Milliseconds
 INFO - Service request (GET)
 /comet_request/e8jesgmo10oq/cometAjax.js took 14

Re: [Lift] method call from out of nowhere

2009-11-30 Thread Hannes
ok, I'll do that. thanks.
 Or you can get stack trace information from Thread. I have a utility
 function getCaller that does a getStackTrace and then looks at the
 proper element of the array. (second, third? I forget)

 On Mon, Nov 30, 2009 at 12:30 AM, Alex Boisvert alex.boisv...@gmail.com 
 wrote:
   
 An easy way to determine who's calling is simply to print the call stack by
 adding the following line in your method,

 (new Exception).printStackTrace
 

--

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




Re: [Lift] method call from out of nowhere

2009-11-30 Thread Hannes
Hi David,


 On Mon, Nov 30, 2009 at 12:11 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 Hi David,

 In my LimitOrder Meta Object, I did:

 override def afterCreate

 to inform an Actor, everytime a new Order is created. The Actor
 than calls the joinOtherOrders method.
 #
 I think I understand it now. Cause I'm creating new orders inside
 the loop at some point. But still I don' t really know, why it
 gets called after the old scope of joinOtherOrders ends...


 Sounds to me like it's all in your application's logic.  As others 
 have pointed out, Thread.dumpStack will let you figure out where 
 things are being called.
I think the biggest problem is, that its necessary in my logic to inform 
the Actor, everytime a new order is created. This while-loop is an 
exception to this rule. I don't think that it would be a good idea, to 
change the behavior of how the Actor responds to messages, just to fix 
this case, or? Or is there any chance to tell a new order NOT to inform 
the Actor, even when its defined in def afterCreate ?

 Also, you might want to use recursion and pattern matching to replace 
 your while loop (which is O(n^2) btw):

 def dealWithList(in: List[Something]): Unit = in match {
   case Nil = () // nothing left to do
   case x :: _ if x.condition1 = x.doThing1
   case x :: _ if x.condition2 = x.doThing2
   case x :: xs if x.condition3 = x.doThing3 ; dealWithList(xs)
   case _ :: xs = dealWithList(xs)
 }
I thought about pattern matching as well, but in my first 
implementation, I just wanted to get it running and change it 
afterwards. Something else: I think recursion is slower than a 
while-loop as long as its not tail recursive, or?

thanks.

 You have the same semantics of a while loop with the ability to break 
 out, but the code is about your logic rather than about looping.
  


 thanks.



 On Sun, Nov 29, 2009 at 7:24 AM, Hannes hannes.flo...@gmx.li
 mailto:hannes.flo...@gmx.li wrote:

 Hey Lifters,


 How is joinOtherOrders being invoked?
  


 I've some really strange things going on here. Please
 consider this
 method definition. I've put alot of print debug statements
 between
 other statements. There's a while-loop that only starts, when
 the given
 list (orders) is not empty. It stops when done is set to
 true. So far,
 so good. Than, have a look at the Lift output. I put in a
 comment,
 pointing out where the program runs into the while loop.

 What really shocks me, are these print statements :

 before done=false
 after done=true
 i += 1
 outside while
 INFO - Service request (GET) / took 121 Milliseconds
 start of joinAll!


 The loop ends with outside while and than the method gets
 called again
 immediately! But who calls it? I don't

 Any ideas?

 thanks.



  method definition
 
 --

 def joinOtherOrders: Unit = {

def joinAll(orders: List[LimitOrder]) = {

println(start of joinAll!)

var done = false

var i = 0

while (!orders.isEmpty  !done) {

println(i= + i + ,  + orders.isEmpty= +
 orders.isEmpty + ,  + done= + done)

if (this.lots.is http://this.lots.is ==
 orders(i).lots.is http://lots.is){

println(case-1)

println(this= + this + , orders(i)= +
 orders(i))

this.open(orders(i))

done = true

}

if (this.lots.is http://this.lots.is 
 orders(i).lots.is http://lots.is){

println(case-2)

println(this= + this + , orders(i)= +
 orders(i))

orders(i).reduceLots(this.lots.is
 http://this.lots.is)

val newOrder =
 orders(i).cloneWith(this.lots.is http://this.lots.is)

newOrder.save

this.open(newOrder)

println(before done= + done)

done = true

println(after done= + done)

}

if (this.lots.is http://this.lots.is 
 orders(i).lots.is http://lots.is){

println(case-3)

println(this= + this + , orders(i)= +
 orders(i))

this.reduceLots(orders(i).lots.is
 http://lots.is)

val newOrder

Re: [Lift] Sitemap + Menu Names + Change Order

2009-11-29 Thread Hannes
Hi Heiko,

thanks for the quick and helpful answer!
The renaming was quite easy, but what do I've to write inside CRUDify.menus?

thanks.
 Hannes,

 2009/11/29 Hannes hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li


 I couldn't find anything about how to change a menu name, that is
 generated from CRUDify. 


 Overwrite CRUDify.createMenuName, etc.
  

 Furthermore, I want to change the internal order
 of CRUDify menus. I believe that its more natural to use, when the
 create item comes before the list item.


 Overwrite CRUDify.menus

 Heiko

 My job: weiglewilczek.com http://weiglewilczek.com
 My blog: heikoseeberger.name http://heikoseeberger.name
 Follow me: twitter.com/hseeberger http://twitter.com/hseeberger
 OSGi on Scala: scalamodules.org http://scalamodules.org
 Lift, the simply functional web framework: liftweb.net 
 http://liftweb.net

 --

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

--

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




Re: [Lift] Sitemap + Menu Names + Change Order

2009-11-29 Thread Hannes
Thanks!

It was the box again, I'm still not really comfortable in getting things 
out of it



 Hi Hannes,

 2009/11/29 Hannes hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li


 thanks for the quick and helpful answer!


 You're welcome ;-)
  

 The renaming was quite easy, but what do I've to write inside
 CRUDify.menus?


 Please take a look at the source code (CRUDify.scala):
   def menus: List[Menu] =
   List(showAllMenuLoc, createMenuLoc, viewMenuLoc,
editMenuLoc, deleteMenuLoc).flatMap(x = x)

 Overwrite it as you need, e.g. (create and showAll swapped):
   def menus: List[Menu] =
   List(createMenuLoc, showAllMenuLoc, viewMenuLoc,
editMenuLoc, deleteMenuLoc).flatMap(x = x)
  
 Heiko

 My job: weiglewilczek.com http://weiglewilczek.com
 My blog: heikoseeberger.name http://heikoseeberger.name
 Follow me: twitter.com/hseeberger http://twitter.com/hseeberger
 OSGi on Scala: scalamodules.org http://scalamodules.org
 Lift, the simply functional web framework: liftweb.net 
 http://liftweb.net

 --

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

--

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




[Lift] method call from out of nowhere

2009-11-29 Thread Hannes
Hey Lifters,

I've some really strange things going on here. Please consider this 
method definition. I've put alot of print debug statements between 
other statements. There's a while-loop that only starts, when the given 
list (orders) is not empty. It stops when done is set to true. So far, 
so good. Than, have a look at the Lift output. I put in a comment, 
pointing out where the program runs into the while loop.

What really shocks me, are these print statements :

before done=false   

after done=true 

i += 1  

outside while   

INFO - Service request (GET) / took 121 Milliseconds

start of joinAll!   


The loop ends with outside while and than the method gets called again 
immediately! But who calls it? I don't

Any ideas?

thanks.



 method definition 
--

def joinOtherOrders: Unit = {

def joinAll(orders: List[LimitOrder]) = {

println(start of joinAll!)

var done = false

var i = 0

while (!orders.isEmpty  !done) {

println(i= + i + ,  + orders.isEmpty= + orders.isEmpty + 
,  + done= + done)

if (this.lots.is == orders(i).lots.is){

println(case-1)

println(this= + this + , orders(i)= + orders(i))

this.open(orders(i))

done = true

}

if (this.lots.is  orders(i).lots.is){

println(case-2)

println(this= + this + , orders(i)= + orders(i))

orders(i).reduceLots(this.lots.is)

val newOrder = orders(i).cloneWith(this.lots.is)

newOrder.save

this.open(newOrder)

println(before done= + done)

done = true

println(after done= + done)

}

if (this.lots.is  orders(i).lots.is){

println(case-3)

println(this= + this + , orders(i)= + orders(i))

this.reduceLots(orders(i).lots.is)

val newOrder = this.cloneWith(orders(i).lots.is)

newOrder.save

newOrder.open(orders(i))

}

i += 1

println(i += 1)

}

println(outside while)

}

def findLimitOrdersById: List[LimitOrder]  =

this.findCandidates.map(x = LimitOrderMetaObj.findAll(

By(LimitOrderMetaObj.id, x)).head)

joinAll(findLimitOrdersById)

}


-- Lift Output 
---


[INFO] Started Jetty Server 

[INFO] Starting scanner at interval of 5 seconds.   

INFO - Service request (GET) /comet_request/54834680365/y7kybsmuyv1g took 64 
Milliseconds   
INFO - Service request (GET) /comet_request/85319966940/y7kybsmuyv1g took 23 
Milliseconds   
INFO - Service request (GET) /favicon.ico took 86 Milliseconds  

INFO - Service request (GET) /comet_request/41521581405/y7kybsmuyv1g took 48 
Milliseconds   
INFO - Service request (GET) /comet_request/93176242746/y7kybsmuyv1g took 7 
Milliseconds
INFO - Service request (GET) /favicon.ico took 38 Milliseconds  

INFO - Service request (GET) /favicon.ico took 5 Milliseconds   

INFO - Service request (GET) / took 551 Milliseconds

INFO - Service request (GET) /comet_request/81361316835/y7kybsmuyv1g took 9 
Milliseconds
INFO - Service request (GET) /favicon.ico took 16 Milliseconds  

INFO - Service request (GET) / took 61 Milliseconds 

INFO - Service request (GET) /comet_request/76898140873/y7kybsmuyv1g took 30 
Milliseconds   
INFO - Service request (GET) /comet_request/e8jesgmo10oq/cometAjax.js took 14 

Re: [Lift] method call from out of nowhere

2009-11-29 Thread Hannes
Hi Tim,
 Hannes,

 Firstly, I really, really wouldn't write your code like that...

 Things of note:
 - two defs inside defs... you usually wouldnt do this without a good reason 
 (like SHtml.submit(whatever _))
   
The two defs only make sence together, that's why I put them together in 
one def. I think that's encapsulation...
 - dont use while loops. period. you have a List[T], use foreach if you have a 
 unit operation
   
Yeah, that's true. But the problem is, that my logic requires to stop 
the iteration at some point. How I gonna do that with a foreach construct?
 def joinAll(orders: List[LimitOrder]): Unit = 
   orders.foreach(order = {
 // your logic here
   })

 You should look to remove a lot of that boiler plate... its looks very 
 javaish and mutable. Generally speaking, scala programmers avoid mutable 
 state like one would avoid bubonic plague.
   
Your totally right! Its mutable, cause its changing the state of my 
objects. But that's necessary at this point.
 Before worrying about the errors, id change your code, then take another 
 look... its almost certainly this bad organisation causing the issues.
   
I agree with you, that this is not the most beautiful code I every saw, 
but I believe that the things you mentioned are not interfering with the 
problem I'm facing. At least not because of a while-loop and some inner 
local defs.
 Cheers, Tim
   
thanks.


 On 29 Nov 2009, at 15:24, Hannes wrote:

   
 Hey Lifters,

 I've some really strange things going on here. Please consider this 
 method definition. I've put alot of print debug statements between 
 other statements. There's a while-loop that only starts, when the given 
 list (orders) is not empty. It stops when done is set to true. So far, 
 so good. Than, have a look at the Lift output. I put in a comment, 
 pointing out where the program runs into the while loop.

 What really shocks me, are these print statements :

 before done=false

 after done=true  

 i += 1   

 outside while

 INFO - Service request (GET) / took 121 Milliseconds 

 start of joinAll!



 The loop ends with outside while and than the method gets called again 
 immediately! But who calls it? I don't

 Any ideas?

 thanks.



  method definition 
 --

 def joinOtherOrders: Unit = {

def joinAll(orders: List[LimitOrder]) = {

println(start of joinAll!)

var done = false

var i = 0

while (!orders.isEmpty  !done) {

println(i= + i + ,  + orders.isEmpty= + orders.isEmpty 
 + ,  + done= + done)

if (this.lots.is == orders(i).lots.is){

println(case-1)

println(this= + this + , orders(i)= + orders(i))

this.open(orders(i))

done = true

}

if (this.lots.is  orders(i).lots.is){

println(case-2)

println(this= + this + , orders(i)= + orders(i))

orders(i).reduceLots(this.lots.is)

val newOrder = orders(i).cloneWith(this.lots.is)

newOrder.save

this.open(newOrder)

println(before done= + done)

done = true

println(after done= + done)

}

if (this.lots.is  orders(i).lots.is){

println(case-3)

println(this= + this + , orders(i)= + orders(i))

this.reduceLots(orders(i).lots.is)

val newOrder = this.cloneWith(orders(i).lots.is)

newOrder.save

newOrder.open(orders(i))

}

i += 1

println(i += 1)

}

println(outside while)

}

def findLimitOrdersById: List[LimitOrder]  =

this.findCandidates.map(x = LimitOrderMetaObj.findAll(

By(LimitOrderMetaObj.id, x)).head)

joinAll(findLimitOrdersById)

}


 -- Lift Output 
 ---


 [INFO] Started Jetty Server  

 [INFO] Starting scanner at interval of 5 seconds

Re: [Lift] Another List XYZ Menu Entry

2009-11-20 Thread Hannes
I meant, that I had general problems to find a way how to do it, not 
talking about the Lift way to do it.

So I think I need a new XHTML page where I call a snippet method, that 
displays the table. Then, from the menu item, I just link to that new 
page? Would that be the right way?

thanks.


 On Mon, Nov 16, 2009 at 8:51 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:


 Hi Lifters,

 I need a new menu entry that displays a table similar to the one, that
 is shown by the CRUDify List XYZ link. But I need to display
 different
 fields without the chance to edit or delete the items. So basically,
 just a simple table. Later on, some Comet stuff would be nice, to see
 changes on the table immediately.

 I've tried to add a new menu entry in Boot.scala, but I don't really
 know how/where the XML should come from


 What XML goes into a menu item?
  


 thanks.

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




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

 --

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

--

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




Re: [Lift] Another List XYZ Menu Entry

2009-11-20 Thread Hannes
Maybe you could give a one liner, showing how to write the menu item in 
Boot.scala.

thanks.
 On Fri, Nov 20, 2009 at 6:26 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 I meant, that I had general problems to find a way how to do it,
 not talking about the Lift way to do it.

 So I think I need a new XHTML page where I call a snippet method,
 that displays the table. Then, from the menu item, I just link to
 that new page? Would that be the right way?


 I'm not sure what you're asking.  You could do it with an xhtml page, 
 you could also build the table in code, like the CRUDify stuff does.  
 Either way works, if I understand you correctly.

  


 thanks.


 On Mon, Nov 16, 2009 at 8:51 AM, Hannes hannes.flo...@gmx.li
 mailto:hannes.flo...@gmx.li wrote:


 Hi Lifters,

 I need a new menu entry that displays a table similar to the
 one, that
 is shown by the CRUDify List XYZ link. But I need to
 display different
 fields without the chance to edit or delete the items. So
 basically,
 just a simple table. Later on, some Comet stuff would be
 nice, to see
 changes on the table immediately.

 I've tried to add a new menu entry in Boot.scala, but I don't
 really
 know how/where the XML should come from


 What XML goes into a menu item?
  


 thanks.

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




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

 --

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

 --

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




 -- 
 James A Barrows

 --

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

--

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




Re: [Lift] Another List XYZ Menu Entry

2009-11-20 Thread Hannes
I read some stuff of chapter five before, but this was the extra hint, 
that I needed...

thanks!


 On Fri, Nov 20, 2009 at 7:07 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 Maybe you could give a one liner, showing how to write the menu
 item in Boot.scala.


 A menu entry looks something like:
 Menu( Loc(helpHome, (help ::  ::Nil) - true, Help))

 The list ( help ::  :: Nil) is the path to the the page.   In this 
 case the - True says that everything underneath help is ok.

 So you could do path :: to :: my :: page :: Nil and - false

 There's a great description in section 5 of the Exploring lift PDF if 
 you need more help.


 thanks.

 On Fri, Nov 20, 2009 at 6:26 AM, Hannes hannes.flo...@gmx.li
 mailto:hannes.flo...@gmx.li wrote:

 I meant, that I had general problems to find a way how to do
 it, not talking about the Lift way to do it.

 So I think I need a new XHTML page where I call a snippet
 method, that displays the table. Then, from the menu item, I
 just link to that new page? Would that be the right way?


 I'm not sure what you're asking.  You could do it with an xhtml
 page, you could also build the table in code, like the CRUDify
 stuff does.  Either way works, if I understand you correctly.

  


 thanks.


 On Mon, Nov 16, 2009 at 8:51 AM, Hannes
 hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li wrote:


 Hi Lifters,

 I need a new menu entry that displays a table similar to
 the one, that
 is shown by the CRUDify List XYZ link. But I need to
 display different
 fields without the chance to edit or delete the items.
 So basically,
 just a simple table. Later on, some Comet stuff would be
 nice, to see
 changes on the table immediately.

 I've tried to add a new menu entry in Boot.scala, but I
 don't really
 know how/where the XML should come from


 What XML goes into a menu item?
  


 thanks.

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




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

 --

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

 --

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




 -- 
 James A Barrows

 --

 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
 mailto:liftweb@googlegroups.com.
 To unsubscribe from this group, send email to
 liftweb+unsubscr...@googlegroups.com
 mailto:liftweb+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/liftweb?hl=.

 --

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




 -- 
 James A Barrows

 --

 You received this message

[Lift] Another List XYZ Menu Entry

2009-11-16 Thread Hannes

Hi Lifters,

I need a new menu entry that displays a table similar to the one, that 
is shown by the CRUDify List XYZ link. But I need to display different 
fields without the chance to edit or delete the items. So basically, 
just a simple table. Later on, some Comet stuff would be nice, to see 
changes on the table immediately.

I've tried to add a new menu entry in Boot.scala, but I don't really 
know how/where the XML should come from

thanks.

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



[Lift] Re: New Milestone coming soon

2009-11-13 Thread Hannes
Hi David,

I read your response, but I didn't replied. Sorry. I've to figure out, 
what causes my problem.  Seems like the CometActor update or something 
doesn't work properly, in M6 it did. But I don't really know, yet.

thanks.


 On Thu, Nov 12, 2009 at 11:37 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 Hi David,

 I wrote you a message about the CometActor received shutdown
 thing. I'm almost sure, that this is related to M7, but I've no
 idea, why or what.


 Did you read my response?  This message is normal and expected.
  


 kind regards
 Tobias

 Folks,

 There are two critical issues with M7:

 * Issue 164 http://github.com/dpp/liftweb/issues#issue/164
JSON/Ajax messages do not carry Notices back to the client.
 * The Session manager is not initialized properly.
Basically, this means that sessions will be expired by the
   web container, but not by Lift and GUIDs that map to
   functions on the server side are not removed until the
   session is terminated.

 We're planning to do an M7.1 release later this week (probably
 Friday).

 If there are other *critical* defects (stuff that means you can't
 use M7 in production), please speak now.

 Thanks,

 David

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








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

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to 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: New Milestone coming soon

2009-11-12 Thread Hannes
Hi David,

I wrote you a message about the CometActor received shutdown thing. 
I'm almost sure, that this is related to M7, but I've no idea, why or what.

kind regards
Tobias
 Folks,

 There are two critical issues with M7:

 * Issue 164 http://github.com/dpp/liftweb/issues#issue/164
JSON/Ajax messages do not carry Notices back to the client.
 * The Session manager is not initialized properly.  Basically,
   this means that sessions will be expired by the web container,
   but not by Lift and GUIDs that map to functions on the server
   side are not removed until the session is terminated.

 We're planning to do an M7.1 release later this week (probably Friday).

 If there are other *critical* defects (stuff that means you can't use 
 M7 in production), please speak now.

 Thanks,

 David

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

 


--~--~-~--~~~---~--~~
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] not found: Full, Empty, Box

2009-11-06 Thread Hannes

Hey Lifters,

I just updated to scala 2.7.7 and lift 1.1-M7. Now I get the above 
compilation errors.
I couldn't find any documentation where Full, Empty and Box are located 
now...sorry to bother you with this

thanks.

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



[Lift] java.sql.SQLException | ERROR 07000

2009-10-13 Thread Hannes

Hi Lifters,

I encountered a problem after I started  tried to test my project today.

I'm almost sure that this error didn't occured before..I also 
updated to 1.1-M6 but the error is still there. Do I've to do some other 
update? I think the problem is related to some actor stuff.???

Here's some console output:
-

INFO - Service request (GET) /limitorder/list took 263 Milliseconds
INFO - Service request (GET) /images/ajax-loader.gif took 2 Milliseconds
INFO - Service request (GET) /user_mgt/logout took 21 Milliseconds
INFO - The CometActor org.tobster.comet.mar...@221f81 Received Shutdown
INFO - Service request (GET) / took 93 Milliseconds
INFO - Service request (GET) /comet_request/1bebfbc2v6fa9/cometAjax.js 
took 3 Milliseconds
INFO - Service request (GET) /images/ajax-loader.gif took 2 Milliseconds
INFO - Service request (GET) /comet_request/85510940001/1bebfbc2v6fa9 
took 16 Milliseconds
INFO - Service request (GET) /comet_request/60721905658/1bebfbc2v6fa9 
took 8714 Milliseconds
INFO - Service request (GET) /user_mgt/sign_up took 794 Milliseconds
INFO - Service request (GET) /images/ajax-loader.gif took 1 Milliseconds
INFO - Service request (POST) /user_mgt/sign_up took 14 Milliseconds
INFO - Service request (GET) / took 91 Milliseconds
INFO - Service request (GET) /images/ajax-loader.gif took 1 Milliseconds
INFO - Service request (GET) /comet_request/36437894169/1bebfbc2v6fa9 
took 8400 Milliseconds
INFO - Service request (GET) /limitorder/create took 138 Milliseconds
INFO - Service request (GET) /images/ajax-loader.gif took 3 Milliseconds
INFO - Service request (POST) /limitorder/create took 32 Milliseconds
java.sql.SQLException: At least one parameter to the current statement 
is uninitialized.
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
Source)
at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
Source)
at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
Source)
at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
Source)
at 
net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply(MetaMapper.scala:653)
at 
net.liftweb.mapper.MetaMapper$$anonfun$14$$anonfun$15.apply(MetaMapper.scala:636)
at 
net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:375)
at 
net.liftweb.mapper.DB$$anonfun$runPreparedStatement$1.apply(DB.scala:372)
at net.liftweb.util.TimeHelpers$class.calcTime(TimeHelpers.scala:241)
at net.liftweb.util.Helpers$.calcTime(Helpers.scala:29)
at net.liftweb.mapper.DB$.runPreparedStatement(DB.scala:372)
at net.liftweb.mapper.DB$.prepareStatement(DB.scala:316)
at net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:635)
at net.liftweb.mapper.MetaMapper$$anonfun$14.apply(MetaMapper.scala:630)
at net.liftweb.mapper.DB$.use(DB.scala:389)
at net.liftweb.mapper.MetaMapper$class.save(MetaMapper.scala:629)
at org.tobster.model.LimitOrderMetaObj$.save(LimitOrder.scala:201)
at net.liftweb.mapper.Mapper$$anonfun$save$1.apply(Mapper.scala:86)
at net.liftweb.mapper.Mapper$$anonfun$save$1.apply(Mapper.scala:86)
at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65)
at net.liftweb.mapper.Safe$.runSafe(Safe.scala:44)
at net.liftweb.mapper.Mapper$class.runSafe(Mapper.scala:52)
at org.tobster.model.LimitOrder.runSafe(LimitOrder.scala:21)
at net.liftweb.mapper.Mapper$class.save(Mapper.scala:85)
at org.tobster.model.LimitOrder.save(LimitOrder.scala:21)
at 
org.tobster.comet.MarketServer$.doSecurityReservation(Market.scala:44)
at 
org.tobster.comet.MarketServer$$anonfun$highPriority$1.apply(Market.scala:30)
at 
org.tobster.comet.MarketServer$$anonfun$highPriority$1.apply(Market.scala:28)
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:37)
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:37)
at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:37)
at scala.actors.Reaction.run(Reaction.scala:78)
at scala.actors.FJTask$Wrap.run(Unknown Source)
at scala.actors.FJTaskRunner.scanWhileIdling(Unknown Source)
at scala.actors.FJTaskRunner.run(Unknown Source)
Caused by: java.sql.SQLException: At least one parameter to the current 
statement is uninitialized.
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
Source)
at 

[Lift] Re: java.sql.SQLException | ERROR 07000

2009-10-13 Thread Hannes

OK, thanks. I'll have a look!

 On Tue, Oct 13, 2009 at 8:27 AM, Hannes hannes.flo...@gmx.li wrote:
   
 I'm almost sure that this error didn't occured before..I also
 updated to 1.1-M6 but the error is still there. Do I've to do some other
 update? I think the problem is related to some actor stuff.???
 

 This is a long shot,  but I think I saw something similar and it
 turned out I had an incorrect DB.addLogFunc in my Boot.   If you have
 one, maybe comment it out and see if you get the same behaviour.

 It doesn't really look related from the stack trace, but I thought I'd
 mention it just in case...

 Richard

 
   


--~--~-~--~~~---~--~~
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: Create the website and all the links are Https ?

2009-10-13 Thread Hannes

You can use Apache to secure your page with HTTPS.
 Hi all,

   How can we create the website and all the links are https?

   Just like:   www.xing.com

   That all of the operations and communications are used https.

   Thanks very much !

 Cheers,
   Neil

 
   


--~--~-~--~~~---~--~~
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: CRUDify trait in 1.1-SNAPSHOT

2009-09-11 Thread Hannes

I've got another problem with CRUDify since I updated to release 1.0.2 
(in M3 everything was fine).

error: value showAllMenuLocParams is not a member of LimitOrder with 
net.liftweb.mapper.LongKeyedMetaMapper[...LimitOrder] with 
net.liftweb.mapper.CRUDify[long, LimitOrder] with ScalaObject

override def showAllMenuLocParams =  :: super.showAllMenuLocParams

I get the same error with createMenuLocParams, too.

thanks.


 On Wed, Sep 9, 2009 at 11:30 PM, XiaomingZheng 
 xiaomingzhen...@gmail.com mailto:xiaomingzhen...@gmail.com wrote:


 really~~~


 Yes.  That's why I changed the self-type... because people kept mixing 
 CRUDify into the mapper class, not the metamapper class.
  


 On Sep 10, 2:21 pm, Naftoli Gugenheim naftoli...@gmail.com
 mailto:naftoli...@gmail.com wrote:
  You're supposed to mix CRUDify in to your singleton object, not
 the class.
 
  -
 
  XiaomingZhengxiaomingzhen...@gmail.com
 mailto:xiaomingzhen...@gmail.com wrote:
 
  when i knew the 1.1 M5 has been published, i updated the pom.xml
 of my
  liftapp project and recomplie it. And i got an error about CRUDify:
  self-type com.thesamegoal.simpleforum.model.Forum does not
 conform to
  net.liftweb.mapper.CRUDify
  [Long,com.thesamegoal.simpleforum.model.Forum]'s selftype
  net.liftweb.mapper.CRUDify
  [Long,com.thesamegoal.simpleforum.model.Forum] with
  com.thesamegoal.simpleforum.model.Forum with
  net.liftweb.mapper.KeyedMetaMapper
  [Long,com.thesamegoal.simpleforum.model.Forum]
 
  my Forum class was defined like this:
  package com.thesamegoal.simpleforum.model
  class Forum extends LongKeyedMapper[Forum] with IdPK with CRUDify
  [Long, Forum] {
  ...
 
  }
 
  so i check the lift framework framework, in 1.0 version, CRUDify is
  defined like this:
  trait CRUDify[KeyType, CrudType : KeyedMapper[KeyType, CrudType]]
  extends KeyedMetaMapper[KeyType, CrudType] {
self: CrudType =
  ...}
 
  and 1.1 CRUDify is like this:
  trait CRUDify[KeyType, CrudType : KeyedMapper[KeyType, CrudType]] {
self: CrudType with KeyedMetaMapper[KeyType, CrudType] =
  ...
 
  }
 
  this change forced me to modify my Forum class to this:
  class Forum extends LongKeyedMapper[Forum] with IdPK with
  LongKeyedMetaMapper[forum] with CRUDify[Long, Forum]
  and got the compile process succeed.
 
  but why lift version 1.1 make this change? i feel that old fashion
  defining model class with CRUDify trait is more comfortable and
  reasonable, it's simple and intuitive




 -- 
 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: CRUDify trait in 1.1-SNAPSHOT

2009-09-11 Thread Hannes

ups!

thanks anyway


 On Fri, Sep 11, 2009 at 6:01 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:


 I've got another problem with CRUDify since I updated to release 1.0.2
 (in M3 everything was fine).


 Release 1.0.2 is older than 1.1-M3.  You downgraded to release 1.0.2.  
 Some features that are available in the 1.1 Milestones are not 
 available in the 1.0 maintenance release branch.
  


 error: value showAllMenuLocParams is not a member of
 LimitOrder with
 net.liftweb.mapper.LongKeyedMetaMapper[...LimitOrder] with
 net.liftweb.mapper.CRUDify[long, LimitOrder] with ScalaObject

 override def showAllMenuLocParams =  :: super.showAllMenuLocParams

 I get the same error with createMenuLocParams, too.

 thanks.
 
 
  On Wed, Sep 9, 2009 at 11:30 PM, XiaomingZheng
  xiaomingzhen...@gmail.com mailto:xiaomingzhen...@gmail.com
 mailto:xiaomingzhen...@gmail.com
 mailto:xiaomingzhen...@gmail.com wrote:
 
 
  really~~~
 
 
  Yes.  That's why I changed the self-type... because people kept
 mixing
  CRUDify into the mapper class, not the metamapper class.
 
 
 
  On Sep 10, 2:21 pm, Naftoli Gugenheim naftoli...@gmail.com
 mailto:naftoli...@gmail.com
  mailto:naftoli...@gmail.com mailto:naftoli...@gmail.com
 wrote:
   You're supposed to mix CRUDify in to your singleton
 object, not
  the class.
  
   -
  
   XiaomingZhengxiaomingzhen...@gmail.com
 mailto:xiaomingzhen...@gmail.com
  mailto:xiaomingzhen...@gmail.com
 mailto:xiaomingzhen...@gmail.com wrote:
  
   when i knew the 1.1 M5 has been published, i updated the
 pom.xml
  of my
   liftapp project and recomplie it. And i got an error about
 CRUDify:
   self-type com.thesamegoal.simpleforum.model.Forum does not
  conform to
   net.liftweb.mapper.CRUDify
   [Long,com.thesamegoal.simpleforum.model.Forum]'s selftype
   net.liftweb.mapper.CRUDify
   [Long,com.thesamegoal.simpleforum.model.Forum] with
   com.thesamegoal.simpleforum.model.Forum with
   net.liftweb.mapper.KeyedMetaMapper
   [Long,com.thesamegoal.simpleforum.model.Forum]
  
   my Forum class was defined like this:
   package com.thesamegoal.simpleforum.model
   class Forum extends LongKeyedMapper[Forum] with IdPK with
 CRUDify
   [Long, Forum] {
   ...
  
   }
  
   so i check the lift framework framework, in 1.0 version,
 CRUDify is
   defined like this:
   trait CRUDify[KeyType, CrudType : KeyedMapper[KeyType,
 CrudType]]
   extends KeyedMetaMapper[KeyType, CrudType] {
 self: CrudType =
   ...}
  
   and 1.1 CRUDify is like this:
   trait CRUDify[KeyType, CrudType : KeyedMapper[KeyType,
 CrudType]] {
 self: CrudType with KeyedMetaMapper[KeyType, CrudType] =
   ...
  
   }
  
   this change forced me to modify my Forum class to this:
   class Forum extends LongKeyedMapper[Forum] with IdPK with
   LongKeyedMetaMapper[forum] with CRUDify[Long, Forum]
   and got the compile process succeed.
  
   but why lift version 1.1 make this change? i feel that old
 fashion
   defining model class with CRUDify trait is more
 comfortable and
   reasonable, it's simple and intuitive
 
 
 
 
  --
  Lift, the simply functional web framework http://liftweb.net
  Beginning Scala http://www.apress.com/book/view/1430219890
  Follow me: http://twitter.com/dpp
  Git some: http://github.com/dpp
 
  






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

 


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



[Lift] strange behaviour of findAll(By(...))

2009-08-07 Thread Hannes

Why does the By method not accept two integers to compare? See erro 
belowthanks!
/home/wacky/NetBeansProjects/virtualMarket/src/main/scala/org/tobster/comet/Market.scala:83:
 
error: overloaded method value apply with alternatives [O : 
net.liftweb.mapper.Mapper[O],T,Q : 
net.liftweb.mapper.KeyedMapper[T,Q]](net.liftweb.mapper.MappedForeignKey[T,O,Q],net.liftweb.util.Box[Q])net.liftweb.mapper.Cmp[O,T]
 
and [O : net.liftweb.mapper.Mapper[O],T,Q : 
net.liftweb.mapper.KeyedMapper[T,Q]](net.liftweb.mapper.MappedForeignKey[T,O,Q],Q)net.liftweb.mapper.Cmp[O,T]
 
and [O : 
net.liftweb.mapper.Mapper[O],T,U](net.liftweb.mapper.MappedField[T,O],U)(implicit
 
(U) = T)net.liftweb.mapper.Cmp[O,T] cannot be applied to (Int,Int)
def createUpdate = 
NewOrders(LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status.id, 
1)).toList)

status is an enumeration type.

object Color extends Enumeration {
val Red = Value(RED)
val Blue = Value(BLUE)
}

Its initialized like this:
var status: Color.Value = Color.Red

So why is it not possible to use it inside the By method?

This doesn't work neither, similar error message:
findAll(By(LimitOrderMetaObj.status, Color(1)))



thanks

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



[Lift] Re: find, set and save

2009-07-29 Thread Hannes

Hi Dave,

Thanks for your answer and sorry for the late reply.
 In the first filter line... do you just want to filter out the 
 LimitOrders that do not have the same tradeType foreign key reference 
 as the FK of the parameter that you pass in?
Yes, that's part of the filtering, but I need to do more stuff.

 Can you post the model opens (the LimitOrder and the other stuff) as 
 well as the logic?
I gonna do some more thinking about the logic, and paste the source later.

 For example,
  
 LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,remainingOrders(i).id)).map(_.status.set(OPEN))
  
 openOr 0L

 I'm not sure why you're doing a map and an openOr 0L... you're not 
 returning an expression.
This was the only way I knew to do that..but probably the wrong 
one.8-)

 Also, I'm not sure why you are loading an instance out of the RDBMS in 
 order to to set the status to OPEN and then just discard the 
 instance.  Does the set method on the status open have some side 
 effect that you've coded?
It was the first approach to implement the logic and since I'm still not 
very close with Lift, some ugly code came out.

 If you want to load a bunch of records, update fields on those 
 records, and save the records, I'd like to suggest the following code:
That's really helpful, I try to use that to get a better implementation!

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

   object name extends MappedPoliteString(this, 128)
   object weight extends MappedInt(this)
 }

 object Dog extends Dog with LongKeyedMetaMapper[Dog]

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

   object info extends MappedString(this, 128)
   object count extends MappedInt(this)
   object dog extends MappedLongForeignKey(this, Dog)
 }


 object MyStuff extends MyStuff with LongKeyedMetaMapper[MyStuff] {
   def mutate(in: MyStuff) {
 for {
   // find all the items where info = 'NEW' and dog != the value of 
 in's dog field
   item - MyStuff.findAll(By(MyStuff.info, NEW), 
 NotBy(MyStuff.dog, in.dog))
   // increment the count field, update the info field and save
 } item.count(item.count + 1).info(Not so NEW).save
   }
 }


thanks!


 On Wed, Jul 22, 2009 at 4:05 PM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:


 I kind of found the problem. So far, it has nothing to do with save or
 anything like that. The problem is that this line:

 val newOrders = LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status,
 NEW)).toList.filter(o2 = o2.tradeType.name
 http://o2.tradeType.name != o1.tradeType.name
 http://o1.tradeType.name)

 does not compare the name of the tradetype (TradeType has an own
 name field) in the filter method, instead name returns tradetype
 (is this the object name?). The thing is, because its a foreign key
 reference and as you told me, it needs to be accessed via

 o.tradeType.obj.map(_.name.is http://name.is) openOr 

 But now, when I want to compare two of those TradeType.name field
 (which
 are normal strings) I don't really know how to do it. I tried
 something
 like that, but it doesn't work:

 val newOrders = LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status,
 NEW)).toList.filter(o2 = {o2.tradeType.obj.map(_.name.is
 http://name.is) openOr }
 != {o1.tradeType.obj.map(_.name.is http://name.is) openOr )


 thanks.

  Howdy,
 
  You can save some memory by using findMap:
 
  def joinOrders(o1: LimitOrder): Unit = {
 /* select all orders where status=NEW and where that.tradeType !=
  order1.tradeType */
 val newOrders =
  LimitOrderMetaObj.findMap(By(LimitOrderMetaObj.status, NEW)){o2 =
  Full(o2).filter(o2.tradeType.name http://o2.tradeType.name
 http://o2.tradetype.name/ !=
  o1.tradeType.name http://o1.tradeType.name
 http://o1.tradetype.name/)}
 
  findMap applies the filtering operation as each row is pulled
 from the
  RDBMS... so you'll have fewer objects in memory.
 
  In terms of the remaining logic... I'm a little lost in your code...
  can you describe the logic?  What gets updated under which
 conditions?
 
 
  On Wed, Jul 22, 2009 at 5:35 AM, Hannes hannes.flo...@gmx.li
 mailto:hannes.flo...@gmx.li
  mailto:hannes.flo...@gmx.li mailto:hannes.flo...@gmx.li wrote:
 
 
  Hi Lifters,
 
  It seems like I'm having problems to modify items that are
 already in
  the database. What I do is, first find the item, then set a new
  value to
  it and then save it. So far so good, or?
 
  Because its a expensive filter process to find those items to
  modify, I
  made a local copy of the sub-list that contains the most
 interesting
  items. This sub-list is processed further on and when I
 finally know

[Lift] find, set and save

2009-07-22 Thread Hannes

Hi Lifters,

It seems like I'm having problems to modify items that are already in 
the database. What I do is, first find the item, then set a new value to 
it and then save it. So far so good, or?

Because its a expensive filter process to find those items to modify, I 
made a local copy of the sub-list that contains the most interesting 
items. This sub-list is processed further on and when I finally know 
which items to modify, I look those ones up in the database again and 
set the values. I hope it makes sence...

thanks

Here's the code:

def joinOrders(o1: LimitOrder): Unit = {
/* select all orders where status=NEW and where that.tradeType != 
order1.tradeType */
val newOrders = 
LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status, 
NEW)).toList.filter(o2 = o2.tradeType.name != o1.tradeType.name)

def decideByTradeType: List[LimitOrder] = {
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from lowest to highest marketPoint */
if (o1.tradeType.name == BUY)
newOrders.filter(o2 = o2.marketPoint.is = 
o1.marketPoint.is).sort((s, t) = s.marketPoint.is  t.marketPoint.is)
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from highest to lowest marketPoint */
else //because there are only two different types! Its the same 
as: if (o1.tradeType.name == SELL)
newOrders.filter(o2 = o2.marketPoint.is = 
o1.marketPoint.is).sort((s, t) = s.marketPoint.is  t.marketPoint.is)
}

var i = 0
var done = false
val remainingOrders = decideByTradeType
while (i  remainingOrders.length  !done) {
if (remainingOrders(i).lots == o1.lots) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
o1.id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
o1.id)).map(_.save) openOr 0L
done = true
}
if (remainingOrders(i).lots.is  o1.lots.is) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
o1.id)).map(_.lots.set(o1.lots.is - remainingOrders(i).lots.is)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
o1.id)).map(_.save) openOr 0L
}
if (remainingOrders(i).lots.is  o1.lots.is) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
o1.id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
o1.id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
remainingOrders(i).id)).map(_.lots.set(remainingOrders(i).lots.is - 
o1.lots.is)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id, 
remainingOrders(i).id)).map(_.save) openOr 0L
done = true
}
i = i + 1
}
  }

--~--~-~--~~~---~--~~
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: find, set and save

2009-07-22 Thread Hannes

Hi David,

Thanks for that trick! But until there I had no problems.is code ok, 
that modifies and saves the model? Cause it feels like the changes are 
not saved.

thanks
Tobias
 Howdy,

 You can save some memory by using findMap:

 def joinOrders(o1: LimitOrder): Unit = {
/* select all orders where status=NEW and where that.tradeType !=
 order1.tradeType */
val newOrders = 
 LimitOrderMetaObj.findMap(By(LimitOrderMetaObj.status, NEW)){o2 = 
 Full(o2).filter(o2.tradeType.name http://o2.tradetype.name/ != 
 o1.tradeType.name http://o1.tradetype.name/)}
  
 findMap applies the filtering operation as each row is pulled from the 
 RDBMS... so you'll have fewer objects in memory.

 In terms of the remaining logic... I'm a little lost in your code... 
 can you describe the logic?  What gets updated under which conditions? 


 On Wed, Jul 22, 2009 at 5:35 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:


 Hi Lifters,

 It seems like I'm having problems to modify items that are already in
 the database. What I do is, first find the item, then set a new
 value to
 it and then save it. So far so good, or?

 Because its a expensive filter process to find those items to
 modify, I
 made a local copy of the sub-list that contains the most interesting
 items. This sub-list is processed further on and when I finally know
 which items to modify, I look those ones up in the database again and
 set the values. I hope it makes sence...

 thanks

 Here's the code:

 def joinOrders(o1: LimitOrder): Unit = {
/* select all orders where status=NEW and where that.tradeType !=
 order1.tradeType */
val newOrders =
 LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status,
 NEW)).toList.filter(o2 = o2.tradeType.name
 http://o2.tradeType.name != o1.tradeType.name
 http://o1.tradeType.name)

def decideByTradeType: List[LimitOrder] = {
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from lowest to highest marketPoint */
if (o1.tradeType.name http://o1.tradeType.name == BUY)
newOrders.filter(o2 = o2.marketPoint.is
 http://o2.marketPoint.is =
 o1.marketPoint.is http://o1.marketPoint.is).sort((s, t) =
 s.marketPoint.is http://s.marketPoint.is  t.marketPoint.is
 http://t.marketPoint.is)
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from highest to lowest marketPoint */
else //because there are only two different types! Its the same
 as: if (o1.tradeType.name http://o1.tradeType.name == SELL)
newOrders.filter(o2 = o2.marketPoint.is
 http://o2.marketPoint.is =
 o1.marketPoint.is http://o1.marketPoint.is).sort((s, t) =
 s.marketPoint.is http://s.marketPoint.is  t.marketPoint.is
 http://t.marketPoint.is)
}

var i = 0
var done = false
val remainingOrders = decideByTradeType
while (i  remainingOrders.length  !done) {
if (remainingOrders(i).lots == o1.lots) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.save) openOr 0L
done = true
}
if (remainingOrders(i).lots.is http://lots.is 
 o1.lots.is http://o1.lots.is) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.lots.set(o1.lots.is
 http://o1.lots.is - remainingOrders(i).lots.is
 http://lots.is)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.save) openOr 0L
}
if (remainingOrders(i).lots.is http://lots.is 
 o1.lots.is http://o1.lots.is) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.lots.set(remainingOrders(i).lots.is
 http://lots.is -
 o1.lots.is http://o1.lots.is)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.save) openOr 0L

[Lift] Re: find, set and save

2009-07-22 Thread Hannes

I got a compiler error when I tried to compile:

val newOrders = LimitOrderMetaObj.findMap(By(LimitOrderMetaObj.status, 
NEW)){o2 = Full(o2).filter(o2.tradeType.name != o1.tradeType.name)}

-
error: type mismatch;
 found   : Boolean
 required: (org.tobster.model.LimitOrder) = Boolean
val newOrders = 
LimitOrderMetaObj.findMap(By(LimitOrderMetaObj.status, NEW)){o2 = 
Full(o2).filter(o2.tradeType.name != o1.tradeType.name)}

 Howdy,

 You can save some memory by using findMap:

 def joinOrders(o1: LimitOrder): Unit = {
/* select all orders where status=NEW and where that.tradeType !=
 order1.tradeType */
val newOrders = 
 LimitOrderMetaObj.findMap(By(LimitOrderMetaObj.status, NEW)){o2 = 
 Full(o2).filter(o2.tradeType.name http://o2.tradetype.name/ != 
 o1.tradeType.name http://o1.tradetype.name/)}
  
 findMap applies the filtering operation as each row is pulled from the 
 RDBMS... so you'll have fewer objects in memory.

 In terms of the remaining logic... I'm a little lost in your code... 
 can you describe the logic?  What gets updated under which conditions? 


 On Wed, Jul 22, 2009 at 5:35 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:


 Hi Lifters,

 It seems like I'm having problems to modify items that are already in
 the database. What I do is, first find the item, then set a new
 value to
 it and then save it. So far so good, or?

 Because its a expensive filter process to find those items to
 modify, I
 made a local copy of the sub-list that contains the most interesting
 items. This sub-list is processed further on and when I finally know
 which items to modify, I look those ones up in the database again and
 set the values. I hope it makes sence...

 thanks

 Here's the code:

 def joinOrders(o1: LimitOrder): Unit = {
/* select all orders where status=NEW and where that.tradeType !=
 order1.tradeType */
val newOrders =
 LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status,
 NEW)).toList.filter(o2 = o2.tradeType.name
 http://o2.tradeType.name != o1.tradeType.name
 http://o1.tradeType.name)

def decideByTradeType: List[LimitOrder] = {
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from lowest to highest marketPoint */
if (o1.tradeType.name http://o1.tradeType.name == BUY)
newOrders.filter(o2 = o2.marketPoint.is
 http://o2.marketPoint.is =
 o1.marketPoint.is http://o1.marketPoint.is).sort((s, t) =
 s.marketPoint.is http://s.marketPoint.is  t.marketPoint.is
 http://t.marketPoint.is)
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from highest to lowest marketPoint */
else //because there are only two different types! Its the same
 as: if (o1.tradeType.name http://o1.tradeType.name == SELL)
newOrders.filter(o2 = o2.marketPoint.is
 http://o2.marketPoint.is =
 o1.marketPoint.is http://o1.marketPoint.is).sort((s, t) =
 s.marketPoint.is http://s.marketPoint.is  t.marketPoint.is
 http://t.marketPoint.is)
}

var i = 0
var done = false
val remainingOrders = decideByTradeType
while (i  remainingOrders.length  !done) {
if (remainingOrders(i).lots == o1.lots) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.save) openOr 0L
done = true
}
if (remainingOrders(i).lots.is http://lots.is 
 o1.lots.is http://o1.lots.is) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.lots.set(o1.lots.is
 http://o1.lots.is - remainingOrders(i).lots.is
 http://lots.is)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.save) openOr 0L
}
if (remainingOrders(i).lots.is http://lots.is 
 o1.lots.is http://o1.lots.is) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.save) openOr 0L
LimitOrderMetaObj.find

[Lift] Re: find, set and save

2009-07-22 Thread Hannes

I kind of found the problem. So far, it has nothing to do with save or 
anything like that. The problem is that this line:

val newOrders = LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status, 
NEW)).toList.filter(o2 = o2.tradeType.name != o1.tradeType.name)

does not compare the name of the tradetype (TradeType has an own 
name field) in the filter method, instead name returns tradetype 
(is this the object name?). The thing is, because its a foreign key 
reference and as you told me, it needs to be accessed via

o.tradeType.obj.map(_.name.is) openOr 

But now, when I want to compare two of those TradeType.name field (which 
are normal strings) I don't really know how to do it. I tried something 
like that, but it doesn't work:

val newOrders = LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status, 
NEW)).toList.filter(o2 = {o2.tradeType.obj.map(_.name.is) openOr } 
!= {o1.tradeType.obj.map(_.name.is) openOr )


thanks.

 Howdy,

 You can save some memory by using findMap:

 def joinOrders(o1: LimitOrder): Unit = {
/* select all orders where status=NEW and where that.tradeType !=
 order1.tradeType */
val newOrders = 
 LimitOrderMetaObj.findMap(By(LimitOrderMetaObj.status, NEW)){o2 = 
 Full(o2).filter(o2.tradeType.name http://o2.tradetype.name/ != 
 o1.tradeType.name http://o1.tradetype.name/)}
  
 findMap applies the filtering operation as each row is pulled from the 
 RDBMS... so you'll have fewer objects in memory.

 In terms of the remaining logic... I'm a little lost in your code... 
 can you describe the logic?  What gets updated under which conditions? 


 On Wed, Jul 22, 2009 at 5:35 AM, Hannes hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:


 Hi Lifters,

 It seems like I'm having problems to modify items that are already in
 the database. What I do is, first find the item, then set a new
 value to
 it and then save it. So far so good, or?

 Because its a expensive filter process to find those items to
 modify, I
 made a local copy of the sub-list that contains the most interesting
 items. This sub-list is processed further on and when I finally know
 which items to modify, I look those ones up in the database again and
 set the values. I hope it makes sence...

 thanks

 Here's the code:

 def joinOrders(o1: LimitOrder): Unit = {
/* select all orders where status=NEW and where that.tradeType !=
 order1.tradeType */
val newOrders =
 LimitOrderMetaObj.findAll(By(LimitOrderMetaObj.status,
 NEW)).toList.filter(o2 = o2.tradeType.name
 http://o2.tradeType.name != o1.tradeType.name
 http://o1.tradeType.name)

def decideByTradeType: List[LimitOrder] = {
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from lowest to highest marketPoint */
if (o1.tradeType.name http://o1.tradeType.name == BUY)
newOrders.filter(o2 = o2.marketPoint.is
 http://o2.marketPoint.is =
 o1.marketPoint.is http://o1.marketPoint.is).sort((s, t) =
 s.marketPoint.is http://s.marketPoint.is  t.marketPoint.is
 http://t.marketPoint.is)
/* keep all orders where that.marketPoint = order1.marketPoint
 * sort the list from highest to lowest marketPoint */
else //because there are only two different types! Its the same
 as: if (o1.tradeType.name http://o1.tradeType.name == SELL)
newOrders.filter(o2 = o2.marketPoint.is
 http://o2.marketPoint.is =
 o1.marketPoint.is http://o1.marketPoint.is).sort((s, t) =
 s.marketPoint.is http://s.marketPoint.is  t.marketPoint.is
 http://t.marketPoint.is)
}

var i = 0
var done = false
val remainingOrders = decideByTradeType
while (i  remainingOrders.length  !done) {
if (remainingOrders(i).lots == o1.lots) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.save) openOr 0L
done = true
}
if (remainingOrders(i).lots.is http://lots.is 
 o1.lots.is http://o1.lots.is) {
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.status.set(OPEN)) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 remainingOrders(i).id)).map(_.save) openOr 0L
LimitOrderMetaObj.find(By(LimitOrderMetaObj.id,
 o1.id http://o1.id)).map(_.lots.set(o1.lots.is
 http://o1.lots.is - remainingOrders(i).lots.is
 http://lots.is)) openOr 0L

[Lift] Re: howto do simple calculation with MappedInt

2009-07-10 Thread Hannes

Dave,

This helped me a lot to understand things better!

thanks.

 Sorry it took so long to get to this... my inbox keeps growing... sigh.

 Anyway, Order.scala: 64 should be:


 def currentCost = Order.this.lots * 
 (Order.this.marketPlace.obj.map(_.lotValue.is) openOr 0 )

 The marketplace field is a foreign key reference... so you have to get 
 the row that's represented by the foreign key (.obj) which is a 
 Box[MarketPlace] and then get the lotValue field from the marketplace.

 I'm enclosing the revised (compiling) files.

 Thanks,

 David

 On Sun, Jul 5, 2009 at 6:31 AM, Tobias Daub hannes.flo...@gmx.li 
 mailto:hannes.flo...@gmx.li wrote:

 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
  mailto: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
   mailto: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
   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 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
   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)
  
  
  
  
 

[Lift] Set MappedLongForeignKey defaultValue...

2009-07-09 Thread Hannes

Hey Lifters,

I wanna set the defaultValue for this object:

object status extends MappedLongForeignKey(this, OrderStateMetaObj){
override def defaultValue = 
OrderStateMetaObj.find(By(OrderStateMetaObj.name, NEW)) openOr 0L
  }

The problem is, that the referenced OrderState object doesn't exist at 
the time when the application is started first. I thought the openOr 
would do the job, but I'm getting this error and don't know how to get 
further...

type mismatch;
 found   : Any
 required: Long
override def defaultValue = 
OrderStateMetaObj.find(By(OrderStateMetaObj.name, NEW)) openOr 0L

  
^
one error found


Am I right, that Any is returned because there is no OrderState object 
found?


thanks.

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