[Lift] Re: Yahoo Lift error
I'm getting it in Firebug when I try to use AJAX. It was working fine a month or two ago. Here's the code that calls the AJAX. It adds or deletes a venue from an event. def getVenuesBlock: NodeSeq = { val items = Model.createNamedQuery[Venue](findAllVenues).findAll val ev = Model.createNamedQuery[Event](findEventById, id - event.id).findOne.openOr(new Event()) val allItems = items.toList.map((x: Venue) = { (x.id.toString, x.name) }) val currentItems = JPA.setToWrapper(ev.venues).toList.map( (x: Venue) = {(x.id.toString, x.name)} ) val unusedItems = (allItems -- currentItems) div class=venuesBlock div{ if (currentItems.isEmpty) emNone/em else JPA.setToWrapper(ev.venues).toList.map( (x: Venue) = { div id={venues + x.id.toString}{ SHtml.ajaxButton(-, () = { val item = Model.getReference[Venue](classOf[Venue], x.id) val ev = Model.getReference[Event](classOf[Event], event.id) ev.venues.remove(item) Model.merge(ev) Model.flush() SetHtml(venuesBlock, getVenuesBlock) }, (title, Remove this venue), (class, removeButton) ) }{x.name}/div } ) }/div { if (unusedItems.isEmpty) Text() else div id=addVenue{ SHtml.ajaxForm( pinput type=submit value=+ class=addButton title=Add this venue/ { SHtml.select(unusedItems, Empty, (id: String) = { val item = Model.getReference[Venue](classOf[Venue], id.toLong) val ev = Model.getReference[Event](classOf[Event], event.id) ev.venues.add(item) Model.merge(ev) Model.flush() SetHtml(venuesBlock, getVenuesBlock) }, (id, selectVenue) ) } /p ) }/div } /div } David Pollak wrote: Are you getting it in the console... in the browser... where? What are you doing to get the message? On Fri, May 22, 2009 at 9:31 PM, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: Any idea why I'm getting this: YAHOO.lift is undefined lift_actualAjaxCall(F1048611400615MAS=true, function(), function())liftAjax.js (line 134) lift_doAjaxCycle()liftAjax.js (line 105) lift_ajaxHandler(F1048611400615MAS=true, null, null)liftAjax.js (line 16) onclick(click clientX=132, clientY=431)g95xgMP4...YfQ%3D%3D (line 2) [Break on this error] url = YAHOO.lift.buildURI(addPageName('/...nSuccess(res);}, failure : onFailure }); Chas. -- 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: Some questions about menu MetaMegaProtoUser
Thanks for the rapid feedback. A few comments below On Fri, May 22, 2009 at 6:12 PM, David Pollak feeder.of.the.be...@gmail.com wrote: [...] def onLoginPage: Boolean = S.request.flatMap(_.location.map(_.name == Login)) openOr false override def screenWrap: Box[NodeSeq] = Full(if (onLoginPage) lift:surround with=login_template at=contentlift:bind //lift:surround else lift:surround with=default at=contentlift:bind //lift:surround) Ahh didn't realize screenWrap was dynamically evaluated. Nice. Being new to Scala I spent some time trying to decode: def onLoginPage = S.request.flatMap(_.location.map(_.name == Login)) openOr false Am I correct in that it basically evaluates S.request.location.name == Login with proper handling of Empty/Full boxes? If yes, is there a good rule of thumb when to use flatMap/map or do I just need more Scala time before this becomes natural? 2) I would like to have a primary navigation menu at the top, and each primary menu item should have some secondary and tertiary menu items shown at the left. Only the secondary/tertiary items for the currently selected primary menu item should be visible. I believe I can render the primary menu items using a LocGroup, but how do I render the current subitems on the left sidebar? Getting the top level menu items: def topMenuItems: List[MenuItem] = S.request.toList.flatMap(_.buildMenu.lines) Works like a charm. Getting the secondary menu items: def secondaryMenuItems: Seq[MenuItem] = for { req - S.request.toList line - req.buildMenu.lines kid - line.kids } yield kid While this does get all the current secondary menu items, I need all the current secondary menu items as well as their children (and their children) since I'll be handling the structure client side. I tried various combinations and hacking of the Menu snippet but can't seem to render all the children. Part of the problem is probably that I don't really know the Menu/MenuItem/Loc structure very well and the Scaladocs are.somewhat lacking :-) I'll keep trying to decipher the source to come up with something, but any further insights will be appreciated /Jeppe --~--~-~--~~~---~--~~ 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: Robust and clear ways to do performant JDBC?
Yes, I helped with the code! On Sat, May 23, 2009 at 9:28 PM, Timothy Perrett timo...@getintheloop.euwrote: To what degree are you wanting to re-invent the wheel? Derek has done amazing work with JPA and Scala - the resulting output being scala-jpa and the jpa archetypes for lift. Are you familiar with them? Cheers, Tim On 23/05/2009 11:56, Oliver Lambert olambo...@gmail.com wrote: JPA is a ORM tool. I think it would be great if someone would create a Scala solution using JPA as the starting point - any takers? --~--~-~--~~~---~--~~ 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 Lift Actor code
David, this is extremely interesting. Given the points you outlined this makes perfect sense to move from scala.actors - however, if come the 2.8 release EPFL fix the actors library so that it then becomes acceptable to use within lift again, would you want to move back to it? IMO, and as you said in your mail, you (or indeed we) have no interest in maintaing our own actors implementation and it seems like it would be most optiomal to use the EPFL implementation when it becomes appropriate to. Cheers, Tim On May 23, 6:19 am, David Pollak feeder.of.the.be...@gmail.com wrote: Folks, It is not lightly that I've made the decision to write an alternative Actor library and move the Lift code base from the Scala Actors to Lift Actors (working name). I want to spend a little time talking about the steps that led to the decision as well as the impact that it will have on Lift code. Since November, I've been chasing a series of memory leaks in the Actor library. Philipp Haller from EPFL has been responsive in addressing the individual memory leaks, but the issue seems to be one of whack-a-mole... each time one memory leak is fixed, another one appears. Further, the existing Actor architecture does not lend itself to the kind of Actor usage cycle that we find in Lift apps. Specifically: - Lift creates/destroys an Actor for each Comet request. This rapid creation/destruction of Actors caused memory back-ups, and the existing Actor code seems to be oriented to long running Actors rather than Actors with Object-length lifespans. - The FJ libraries used for Actor scheduling have problems on multi-core machines and are also a source of memory retention issues. - Replacing the FJ libraries with a scheduler based on java.util.concurrent exposes race/deadlock conditions related to the fact that some parts of the Actor processing (e.g., testing mailbox items against partial functions while the Actor itself is synchronized) - The Actors require external threads to function and it's not possible to create external threads in the Google App Engine (making Actor-based functionality including CometActors non-functioning in GAE apps) - Actors are fragile when exceptions are thrown - Actors have running and not running states (as compared with objects which can always respond to message sends). In practice, managing the running and not running states is as hard as managing memory in C. - There are hidden actors associated with each thread which display the above fragility and state management issues - And as a practical matter, I've got a couple of applications that are going into production over the next few weeks and cannot wait for the various fixes to make it into Scala 2.8 and the hacks and work-arounds that I've done to the 2.7.4 Actor libraries became too complex for my comfort. I have written a simple Actor class that is focused on message sending and processing of messages asynchronously. This means there's a single operation that you can perform on Actors, the message send operation. Actors can be specicialized (they only access messages of a certain type). In order to receive a response from an Actor, you can pass in a Future as part of the message and that Future may be satisfied asynchronously. This means that a sender of a message need not be an Actor and that the Actor recipient of a message cannot determine the sender of a message. Actors have two bits of internal state: a mailbox and a flag indicating that the Actor is currently processing messages in its mailbox. The amount of synchronization of Actors is minimal (on inserting messages into the mailbox, on removing messages from the mailbox, and on changing state to/from processing messages.) An Actor instance must provide a messageHandler method which returns a PartialFunction that is used to pattern match against the messages in the mailbox. The instance may also provide an optional exception handler that is called if an Exception is thrown during the handling of a message. The Actor is guaranteed to only be processing one message at a time and the Actor is guaranteed not to be in a monitor (synchronized) during the processing of messages. An Actor is guaranteed to maintain the order of the messages in its mailbox, however, messages that do not currently match the messageHandler will be retained in the order that they were received in the event that the messageHandler changes and they can be processed. The Lift Actors will, by default, use the java.util.concurrent library for thread pooling, although I have worked out a mechanism for thread-piggy-backing such that if the Actors are running in GAE, they need not use any additional thread (this will enable Lift's comet support in GAE.) There will also be a scheduler (much like the existing ActorPing) which will send a message to an Actor at some time in the
[Lift] Re: Robust and clear ways to do performant JDBC?
Lol! Sorry oliver... I remember now :) What did you have in mind for ³scala solution using JPA²? Is this not what we have already? Cheers, Tim On 23/05/2009 12:33, Oliver Lambert olambo...@gmail.com wrote: Yes, I helped with the code! On Sat, May 23, 2009 at 9:28 PM, Timothy Perrett timo...@getintheloop.eu wrote: To what degree are you wanting to re-invent the wheel? Derek has done amazing work with JPA and Scala - the resulting output being scala-jpa and the jpa archetypes for lift. Are you familiar with them? Cheers, Tim On 23/05/2009 11:56, Oliver Lambert olambo...@gmail.com wrote: JPA is a ORM tool. I think it would be great if someone would create a Scala solution using JPA as the starting point - any takers? --~--~-~--~~~---~--~~ 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: Robust and clear ways to do performant JDBC?
When I want to have user defined types, I have to write them as a Hibernate hack to JPA - Id rather not be wedded to Hibernate.When I get a collection out of a returned entity, I have to use JCL to wrap it. I'd rather, have everything in Scala collections. When I have a read only entity, I'd like it to be immutable. In fact, maybe all entities should be, but thats probably too hard. I'm just taking about the lower layer of JPA that Derek's stuff hooks into - its OK for Java, it kind of sucks for Scala. Just my thoughts, don't expect anyone to agree. cheers Oliver On Sat, May 23, 2009 at 9:41 PM, Timothy Perrett timo...@getintheloop.euwrote: Lol! Sorry oliver... I remember now :) What did you have in mind for “scala solution using JPA”? Is this not what we have already? Cheers, Tim On 23/05/2009 12:33, Oliver Lambert olambo...@gmail.com wrote: Yes, I helped with the code! On Sat, May 23, 2009 at 9:28 PM, Timothy Perrett timo...@getintheloop.eu wrote: To what degree are you wanting to re-invent the wheel? Derek has done amazing work with JPA and Scala - the resulting output being scala-jpa and the jpa archetypes for lift. Are you familiar with them? Cheers, Tim On 23/05/2009 11:56, Oliver Lambert olambo...@gmail.com wrote: JPA is a ORM tool. I think it would be great if someone would create a Scala solution using JPA as the starting point - any takers? --~--~-~--~~~---~--~~ 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: Robust and clear ways to do performant JDBC?
Interesting... Have you seen jorge's scala utils? Perhaps we could do some magic with that to manage translations between java.util.list etc to native scala types...? Cheers, Tim Sent from my iPhone On 23 May 2009, at 12:58, Oliver Lambert olambo...@gmail.com wrote: When I want to have user defined types, I have to write them as a Hibernate hack to JPA - Id rather not be wedded to Hibernate. When I get a collection out of a returned entity, I have to use JCL to wrap it. I'd rather, have everything in Scala collections. When I have a read only entity, I'd like it to be immutable. In fact, maybe all entities should be, but thats probably too hard. I'm just taking about the lower layer of JPA that Derek's stuff hooks into - its OK for Java, it kind of sucks for Scala. Just my thoughts, don't expect anyone to agree. cheers Oliver On Sat, May 23, 2009 at 9:41 PM, Timothy Perrett timo...@getintheloop.eu wrote: Lol! Sorry oliver... I remember now :) What did you have in mind for “scala solution using JPA”? Is this not what we have already? Cheers, Tim On 23/05/2009 12:33, Oliver Lambert olambo...@gmail.com wrote: Yes, I helped with the code! On Sat, May 23, 2009 at 9:28 PM, Timothy Perrett timo...@getintheloop.eu wrote: To what degree are you wanting to re-invent the wheel? Derek has done amazing work with JPA and Scala - the resulting output being scala- jpa and the jpa archetypes for lift. Are you familiar with them? Cheers, Tim On 23/05/2009 11:56, Oliver Lambert olambo...@gmail.com wrote: JPA is a ORM tool. I think it would be great if someone would create a Scala solution using JPA as the starting point - any takers? --~--~-~--~~~---~--~~ 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] LiftRules.unloadHooks problem
After banging my head trying to get Jetty to shutdown cleanly having been playing with actors I came across this entry in the wiki http://wiki.liftweb.net/index.php/FAQ#How_do_I_execute_code_when_my_application_is_unloaded.3F which suggests adding your own function to LiftRules.unloadHooks except LiftRules.unloadHooks += myUnloader _ does not compile due to reassignment to val but LiftRules.unloadHooks.append(myUnloader) does. Has my lack of Scala experience got the better of me again or has the api changed since the wiki entry was added? -- Ewan --~--~-~--~~~---~--~~ 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: project stockholm
On Sat, May 23, 2009 at 2:34 AM, Jostein Stuhaug jost...@solidsystem.nowrote: Off topic, but I could not help myself. Speaking of off topic, too bad there's not a Nobel Geek Prize... :-) The Nobel Peace Prize is in fact awarded in Oslo, all the others are given out in Stockholm. But I guess it's not the peace prize you are aiming for... Keep up the good work though, who knows what might happen.. Regards, Jostein. Charles F. Munat wrote: Dynamite! Meredith Gregory wrote: Charles, Stockholm's feature set competes with Microsoft's Oslo; but Stockholm is where you receive the Nobel Prize. Best wishes, --greg On Thu, May 21, 2009 at 8:02 PM, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: Because of Stockholm Syndrome? Meredith Gregory wrote: All, i've been working in earnest on a little open source project for DSL generation git%20clone%20git://github.com/leithaus/stockholm.git%20 http://github.com/leithaus/stockholm.git%20 that my wife suggested i call stockholm (whom am i to argue). At this point it's just about syntax, not execution. From a BNF file you generate * a web-hosted parser/repl * the abstract syntax class of the parser support visitor pattern traversal * a set of subclasses that map the abstract syntax to store o right now i've got SQL via a JPA layer o shortly i will also have an XML persistence layer via DBXML Slightly burdensome dependencies * i use BNFC which means you need Haskell + Happy + Alex installed on your system. (On a mac this is port install Haskell, port install Happy, port install Alex.) * When the XML persistence comes on line there will be a dependency on DBXML. * Neither of these dependencies play nicely with maven. i've got some strategies for workin around this for the parser generator, but not for the XML persistence layer. In a not too distant release i will add some support for specifying and generating operational semantics via techniques borrowed from Peter Sewell's Ott. Best wishes, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: LiftRules.unloadHooks problem
On Fri, May 22, 2009 at 11:31 PM, Ewan ehar...@gmail.com wrote: After banging my head trying to get Jetty to shutdown cleanly having been playing with actors I came across this entry in the wiki http://wiki.liftweb.net/index.php/FAQ#How_do_I_execute_code_when_my_application_is_unloaded.3F which suggests adding your own function to LiftRules.unloadHooks except LiftRules.unloadHooks += myUnloader _ does not compile due to reassignment to val but LiftRules.unloadHooks.append(myUnloader) does. Has my lack of Scala experience got the better of me again or has the api changed since the wiki entry was added? Yeah, the API changed pretty radically in November and December of last year. We've had a bunch of ill-fated attempts to find a wiki gardener... someone who will go through the wiki, find stuff that needs changing and make a list or enter tickets into our GitHub ticket system. With a list of needed changes, there are a fair number of us who can make those changes. -- Ewan -- 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: Some questions about menu MetaMegaProtoUser
On Sat, May 23, 2009 at 4:20 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: Thanks for the rapid feedback. A few comments below On Fri, May 22, 2009 at 6:12 PM, David Pollak feeder.of.the.be...@gmail.com wrote: [...] def onLoginPage: Boolean = S.request.flatMap(_.location.map(_.name == Login)) openOr false override def screenWrap: Box[NodeSeq] = Full(if (onLoginPage) lift:surround with=login_template at=contentlift:bind //lift:surround else lift:surround with=default at=contentlift:bind //lift:surround) Ahh didn't realize screenWrap was dynamically evaluated. Nice. Being new to Scala I spent some time trying to decode: def onLoginPage = S.request.flatMap(_.location.map(_.name == Login)) openOr false If you were writing code with a high McCabe number it would look like: def onLoginPage = { val boolBox: Box[Boolean] = if (S.request.isDefined) { val req = S.request.open_! // note never use open_! unless you know the Box is Full if (req.location.isDefined) { val loc = req.location.open_! Full(loc.name == Login) } else Empty } else Empty if (boolBox.isDefined) boolBox.open_! else false } You can also write the code in a for comprehension: def onLoginPage = { val bb = for { req - S.request loc - req.location } yield loc.name == Login bb openOr false } Am I correct in that it basically evaluates S.request.location.name == Login with proper handling of Empty/Full boxes? If yes, is there a good rule of thumb when to use flatMap/map or do I just need more Scala time before this becomes natural? When you are dealing with Box/Option, its good to either use map/flatMap or the for comprehension (which is syntactic sugar for map/flatMap) Getting the secondary menu items: def secondaryMenuItems: Seq[MenuItem] = for { req - S.request.toList line - req.buildMenu.lines kid - line.kids } yield kid While this does get all the current secondary menu items, I need all the current secondary menu items as well as their children (and their children) since I'll be handling the structure client side. I tried various combinations and hacking of the Menu snippet but can't seem to render all the children. Part of the problem is probably that I don't really know the Menu/MenuItem/Loc structure very well and the Scaladocs are.somewhat lacking :-) I'll keep trying to decipher the source to come up with something, but any further insights will be appreciated Each MenuItem has a kids property which is the submenus. You can recurse into the kids on display. The net.liftweb.http.snippet.Menu.scala code has examples of this. Thanks, David /Jeppe -- 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: New Lift Actor code
On Sat, May 23, 2009 at 7:39 AM, Martin Ellis ellis@gmail.com wrote: On Sat, May 23, 2009 at 6:19 AM, David Pollak feeder.of.the.be...@gmail.com wrote: I am happy to share the Lift Actor code with EPFL and if it makes it into the Scala distribution as SimpleActors or something similar, I'm totally cool with that. I'm not interested in owning or maintaining an Actor library. I am however, dedicated to making sure that Lift apps can run in production for months (or even years) without retaining memory or having other problems that can impact the stability of applications. The cool thing about this is that it provides solid evidence that Scala - as a language - does satisfy the aim of being be a scalable language. Yes, this is absolutely right. It also points up what I missed in my original posting... the amazing value of the Scala Actors which include: - First, and most important to Lift, a conceptual framework for doing concurrency. Without the Actor model, Lift would not have such a rich model for building interactive applications. - A design that keeps true to the Erlang Actor model in that it supports linking, run states, and other things that make an OTP style library possible. (Hey Jonas, where's that OTP library?) - A design that has evolved from simply supporting send/wait-for-response (!?) to send and immediately receive Future and other cool features. - Blocking until Futures are satisfied without consuming a thread if the Future was within a react-based Actor. - An implementation that worked well in JDK 1.4. Many of the current memory and scheduling issues are a result of the fact that Scala's Actors worked on JDK 1.4, back when 1.4 was the target for the Scala distribution. Scala is a language that supports multiple Actor libraries, just as it supports multiple collections libraries. There are no built-in collections classes in Scala. All collections are implemented at the library level. And just as there were defects in some on the Scala collections classes that David MacIver fixed, there are existing defects in the Actor libraries. Just as there are specialized Map() collections that are appearing for Scala that maximize performance for particular data types and/or key distributions, we are creating a specialized Actor library that's optimized for the kind of use that we see in Lift and web apps in general. This is a testament to Scala's flexibility and to the foresight of including such a powerful concurrency library, Actors, as part of the distribution. But for those two things, Lift would not be nearly as cool as it is. So, please do not read this thread as a repudiation of the Scala Actor library, please read it as an expansion of what is possible within Scala. Thanks, David I'm referring to the fact that Scala actors are not part of the core language. They're just a library that can be replaced with a different library, which can also to provide the 'feel' of native language support for objects of that type. It's such a fundamental part of the language design that Programming in Scala talks about it in Chapter 1, Section 1. It's timely that you sent the email so soon after the link to the Guy Steele Growing a Language OOPSLA presentation (of which I am still in awe) went around on twitter. http://video.google.com/videoplay?docid=-8860158196198824415 I guess this demonstrates that Scala provides the features for growth that Steele says are needed for languages to be successful in the long term, and that he would have liked Java to have. Awesome. Nice, clear explanation, by the way. Should avoid any any NIH allegations on the diggs and reddits of the world ;o) Martin -- 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] Problems with redirect after login and protected pages
Hi. I want to protect all pages in the app (except login :-) so if you try to access a page, you get to the login page and after successful login, you get redirected back to the requested page. I'm combining the ideas from http://groups.google.com/group/liftweb/browse_thread/thread/5d724fa1ab66a352/f27134216c81fc91 and http://groups.google.com/group/liftweb/browse_thread/thread/5d724fa1ab66a352/f27134216c81fc91 I'm running 1.1-SNAPSHOT and extending the basic example with the following: Boot.scala val entries = Menu(Loc(Home, List(index), Home, Loc.EarlyResponse( () = Full(RedirectResponse(/user_mgt/login)). filter(ignore = !User.loggedIn_?))) ) :: User.sitemap And User.scala object loginReferer extends SessionVar(/) override def homePage = { var ret = loginReferer.is loginReferer.remove() ret } override def login = { Log.info(Before Logging in S:+S + , loggedIn:+User.loggedIn_? + ref:+loginReferer.is+ S.ref: +S.referer) for (r - S.referer if loginReferer.is == /) loginReferer.set(r) super.login } Here are the issues: - When I hit http://localhost:8080/ I get to the login page ok, after login I get the homepage but with an error: already logged in. Please logout first. - If I try to access another page, I always gets redirected to the home page after login (with the same error) It seems the problems are caused by an empty referrer as seen in the logs below. This makes sense since the original request to / doesn't contain a referer, the redirect doesn't either. So the question is: is there a better way to capture the original page the user was requesting? Since the redirect happens in the EarlyResponse I was wondering if it was possible to just tack it on as a parameter in the RedirectReponse. But is there a better way? /Jeppe Navigate to / INFO - Service request (GET) / took 249 Milliseconds INFO - Before login - ref:/, S.ref: Empty INFO - Service request (GET) /user_mgt/login;jsessionid=e7pkao54lhcm took 156 Milliseconds INFO - Service request (GET) /images/ajax-loader.gif took 0 Milliseconds INFO - Service request (GET) /favicon.ico took 0 Milliseconds Enter login credentials INFO - Before login - ref:/, S.ref: Full(http://localhost:8080/user_mgt/login;jsessionid=e7pkao54lhcm) INFO - Service request (POST) /user_mgt/login took 172 Milliseconds INFO - Service request (GET) /user_mgt/login;jsessionid=e7pkao54lhcm took 0 Milliseconds INFO - Service request (GET) / took 31 Milliseconds --~--~-~--~~~---~--~~ 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: Problems with redirect after login and protected pages
On Sat, May 23, 2009 at 6:22 PM, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Hi. I want to protect all pages in the app (except login :-) so if you try to access a page, you get to the login page and after successful login, you get redirected back to the requested page. I'm combining the ideas from [...] It seems the problems are caused by an empty referrer as seen in the logs below. This makes sense since the original request to / doesn't contain a referer, the redirect doesn't either. So the question is: is there a better way to capture the original page the user was requesting? Since the redirect happens in the EarlyResponse I was wondering if it was possible to just tack it on as a parameter in the RedirectReponse. But is there a better way? Reply to self: This seems to work: override def login = { for {r - S.request ret - r.param(returnTo) if loginReferer.is == /} loginReferer.set(ret) super.login } val loggedIn = Loc.EarlyResponse( () = Full(RedirectResponse(/profile//login?returnTo=+S.uri)).filter(ignore = !User.loggedIn_?)) /Jeppe --~--~-~--~~~---~--~~ 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 Lift Actor code
First, and most important to Lift, a conceptual framework for doing concurrency. Without the Actor model, Lift would not have such a rich model for building interactive applications. A design that keeps true to the Erlang Actor model in that it supports linking, run states, and other things that make an OTP style library possible. (Hey Jonas, where's that OTP library?) Here it is the repo: http://github.com/jboner/scala-otp/tree/master Or do you mean that it has not happened much there for a while? I certainly plan to expand it quite a lot, even have some code I could make its way into it eventually. -- Jonas Bonér twitter: @jboner blog:http://jonasboner.com work: http://crisp.se work: http://scalablesolutions.se code: http://github.com/jboner --~--~-~--~~~---~--~~ 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] Can't find scala jar
I used the lift-archetype-jpa-blank archetype to build a new Lift app, then tried to compile and run it. I get an error from Maven that says it can't find scala 2.7.4: [ERROR] BUILD ERROR [INFO] - [INFO] Failed to resolve artifact. Missing: -- 1) org.scala-lang:scala-library:jar:2.7.4 Does one need to download and install the library jar, or is there something wrong here? Thanks, Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: truncated urls
done http://github.com/dpp/liftweb/issues/#issue/23 --~--~-~--~~~---~--~~ 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: Can't find scala jar
Can't find the compiler jar, either. I installed both locally, and now when I run the app I get this: [INFO] Starting jetty 6.1.16 ... 2009-05-23 14:49:09.691::INFO: jetty-6.1.16 2009-05-23 14:49:09.877::INFO: No Transaction manager found - if your webapp requires one, please configure one. 2009-05-23 14:49:10.304::WARN: failed LiftFilter java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects Am I screwing things up here, or is there some problem with the archetype? Thanks! Chas. Charles F. Munat wrote: I used the lift-archetype-jpa-blank archetype to build a new Lift app, then tried to compile and run it. I get an error from Maven that says it can't find scala 2.7.4: [ERROR] BUILD ERROR [INFO] - [INFO] Failed to resolve artifact. Missing: -- 1) org.scala-lang:scala-library:jar:2.7.4 Does one need to download and install the library jar, or is there something wrong here? Thanks, Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't find scala jar
Nope. Still can't find it. David Pollak wrote: Try: rm -rf ~/.m2 mvn -clean install Thanks, David On Sat, May 23, 2009 at 2:55 PM, Charles F. Munat c...@munat.com mailto:c...@munat.com wrote: Can't find the compiler jar, either. I installed both locally, and now when I run the app I get this: [INFO] Starting jetty 6.1.16 ... 2009-05-23 14:49:09.691::INFO: jetty-6.1.16 2009-05-23 14:49:09.877::INFO: No Transaction manager found - if your webapp requires one, please configure one. 2009-05-23 14:49:10.304::WARN: failed LiftFilter java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects Am I screwing things up here, or is there some problem with the archetype? Thanks! Chas. Charles F. Munat wrote: I used the lift-archetype-jpa-blank archetype to build a new Lift app, then tried to compile and run it. I get an error from Maven that says it can't find scala 2.7.4: [ERROR] BUILD ERROR [INFO] - [INFO] Failed to resolve artifact. Missing: -- 1) org.scala-lang:scala-library:jar:2.7.4 Does one need to download and install the library jar, or is there something wrong here? Thanks, Chas. -- 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] jpa blank archetype
Another weird thing about the JPA blank archetype: there is an index.html file that calls the default template, but the templates-hidden folder is missing (along with the default template). Chas. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't find scala jar
Here is more detail on this error: 2009-05-23 15:41:20.856::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [INFO] Context path = / [INFO] Tmp directory = determined at runtime [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml [INFO] Web overrides = none [INFO] Starting jetty 6.1.16 ... 2009-05-23 15:41:20.981::INFO: jetty-6.1.16 2009-05-23 15:41:21.197::INFO: No Transaction manager found - if your webapp requires one, please configure one. 2009-05-23 15:41:21.513::WARN: failed LiftFilter java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects at net.liftweb.http.LiftRules$.init(LiftRules.scala:184) at net.liftweb.http.LiftRules$.clinit(LiftRules.scala) at net.liftweb.http.LiftFilter.init(LiftServlet.scala:574) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653) at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466) at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:222) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132) at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441) at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383) at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210) at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) at org.apache.maven.cli.MavenCli.main(MavenCli.java:287) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Charles F. Munat wrote: Can't find the compiler jar, either. I installed both locally, and now when I run the app I get this: [INFO] Starting jetty 6.1.16 ... 2009-05-23 14:49:09.691::INFO: jetty-6.1.16 2009-05-23 14:49:09.877::INFO: No Transaction manager found - if your webapp requires one, please configure one. 2009-05-23 14:49:10.304::WARN: failed LiftFilter java.lang.VerifyError: (class: net/liftweb/util/EmptyBox, method: open_$bang signature: ()Ljava/lang/Object;) Can only throw Throwable objects Am I
[Lift] Re: Some questions about menu MetaMegaProtoUser
On Sat, May 23, 2009 at 5:54 PM, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Sat, May 23, 2009 at 4:52 PM, David Pollak feeder.of.the.be...@gmail.com wrote: Getting the secondary menu items: def secondaryMenuItems: Seq[MenuItem] = for { req - S.request.toList line - req.buildMenu.lines kid - line.kids } yield kid While this does get all the current secondary menu items, I need all the current secondary menu items as well as their children (and their children) since I'll be handling the structure client side. I tried various combinations and hacking of the Menu snippet but can't seem to render all the children. Part of the problem is probably that I don't really know the Menu/MenuItem/Loc structure very well and the Scaladocs are.somewhat lacking :-) I'll keep trying to decipher the source to come up with something, but any further insights will be appreciated Each MenuItem has a kids property which is the submenus. You can recurse into the kids on display. The net.liftweb.http.snippet.Menu.scala code has examples of this. I'm on it already ..and seem stuck. I have the following menu structure M1 M1.1 M1.1.1 M1.1.2 M1.2 M2 M2 etc. I can't seem to get all the third level items (M1.1.1, M1.1.2) unless the active page is M1.1. Even if I put in lift:Menu.builder expandAll=true/, they're only shown if I select M1.1. The code above which yields kid, outputs M1.1 and M1.2 when M1 is selected. When looking at the data, at seems like the kid.kids for M1.1 is empty unless I'm on page M1.1. What am I missing? /Jeppe --~--~-~--~~~---~--~~ 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] The new LiftActor code is live
Folks, The new LiftActor-based Lift is live in the new_actor branch in the repository. I'm running the new code on http://demo.liftweb.net If all goes well, I'll cut the main Lift branch over to the new code on Wednesday. Thanks, David -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Namespace prefix error.
I am keep on getting the following error. Please help me. I have read enough blogs to solve this... stll clueless for my limited knowledge. error on line 81 at column 35: Namespace prefix question on subject is not defined error on line 86 at column 26: Namespace prefix question on detail is not defined lift:QS.add form=post table tr td colspan=2question:subjectTo Do/question:subject/td 19 /tr tr tdDescription:/td tdquestion:detailTo Do/question:detail/td 19 /tr tr tdnbsp;/td tdquestion:submit buttonNew/button /question:submit/td /tr /table /lift:QS.add -- in my QS,scala def add(form: NodeSeq) : NodeSeq = { var question: Question = new Question def checkAndSave(): Unit = { if(question.save) { println(Saved) S.redirectTo(thank-you) } } bind(question, form, subject - SHtml.text(question.subject, question.subject(_)), detail - SHtml.text(question.detail, question.detail(_)), submit - SHtml.submit(New, checkAndSave)) } Mohan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Namespace prefix error.
I guess my previous post didn't reach. I have tried enough to my lift knowledge, but need someone's help. error on line 81 at column 35: Namespace prefix question on subject is not defined error on line 86 at column 26: Namespace prefix question on detail is not defined My snippet in QS.Scala. lift:QS.add form=post table tr td colspan=2question:subjectTo Do/question:subject/td 19 /tr tr tdDescription:/td tdquestion:detailTo Do/question:detail/td 19 /tr tr tdnbsp;/td tdquestion:submit buttonNew/button /question:submit/td /tr /table /lift:QS.add lift:QS.add form=post table tr td colspan=2question:subjectTo Do/question:subject/td 19 /tr tr tdDescription:/td tdquestion:detailTo Do/question:detail/td 19 /tr tr tdnbsp;/td tdquestion:submit buttonNew/button /question:submit/td /tr /table /lift:QS.add Mohan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---