[Lift] How to use Mapper and record framework
Hi, Guys i am new to Lift. I want to use mapper and record framework. I have following case: 1. Table with two column [id,name] ...// I have MySQL DB 2. i want to fire select query on above table 3. Display above result on GUI How can i do this with mapper and record: I done with Boot.scala chages as per steps mentioned in Exploring Lift: Scala-based Web Framework book but i am not able to create mapper or record class ...how can i do this and put query on top of this. Also where can i get detail information about mapper and record framework as above book is not sufficient for this Thanks in advance.. -Pravin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Asynchronous Javascript problem
Excellent, thanks David. On Jul 30, 1:17 am, David Pollak feeder.of.the.be...@gmail.com wrote: You can put a little JavaScript on the page which contains a function that you can call... for example: define a JsonHandler: object PointHandler extends JsonHandler { def apply(in: Any): JsCmd = in match { case JsonCmd(setPoint, _, yourData, _) = /// do something with yourData Noop } } Now, build a stable function to send to the browser: Script(Function(sendPointToServer, point, PointHandler.call(setPoint, JsVal(point You'll have a JavaScript function, sendPointToServer that you cal with the point and the rest is automatic. Thanks, David On Wed, Jul 29, 2009 at 2:27 PM, Channing Walton channingwal...@mac.comwrote: Hi, I'm working on an app which has a google map which users can use to search for locations, and on which I want to place markers. The asynchronous call is a call to google's geocoder service which takes a string to search for from an input field, and a callback function that the position will be passed to: geocoder.getLatLng(address,showAddress); function showAddress(point) { if (!point) { alert(address + not found); } else { map.setCenter(point, 13); } } So the issue here is that after map.setCenter I want to make an ajax call to retrieve marker data from the server using the 'point'. I would like to use lift's javascript abstraction to build this but I'm struggling to see how to do it given the asynchronous call. Any ideas? -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Simple Javascript question(from a lift snippet of course...)
Well assume you snippet returns a NodeSeq: import net.liftweb.http._ import js._ import JE._ import JsCmds._ def myFunc(xml: NodeSeq): NodeSeq = { ... resultingNode ++ head{Script(OnLoad(Call(myStartupFunction)))}/ head } In the above example we are returning a head node as well which will be merged by Lift automatically in the real page head. Then I'm using Lift's JavaScript abstractions to call on load function myStartupFunction. Instead of head{Script(OnLoad(Call(myStartupFunction)))}/head you can also use head script type=text/javascript charset=utf-8{ Unparsed( jQuery(document).ready(function() { myStartupFunction(); }) ) } /head Br's, Marius On Jul 30, 8:13 am, DFectuoso santiago1...@gmail.com wrote: This is probably trivial but can't seem to find the lifty way... without hand rolling javascript What is the best way to generate(in the snippet) a javascript command to be run on the window.onload event? Thank you very much you divine and infinite source or lift knowledge AKA lift google group =) --~--~-~--~~~---~--~~ 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: Automatic background AJAX: best way to do it?
On 07/28/2009 07:28 PM, David Pollak wrote: I'd do the REST API thing. The mechanisms that Lift has for handling API calls from the browser are numerous, but they are associated with a session (you can do ajaxCall or a S.buildJsonFunc). Oh cool. When I listened to the podcast interview and heard about fast-pathing AJAX calls, I realized that this was exactly what I wanted, and that there wasn't a need to create a separate URL space just to accomodate this page update functionality--at least, not explicitly in the sense of what I meant by API. Neat. Thanks for the method pointers, too, that helped me focus my reading a bit. So here's what I have. I have this JS code as an interface to the geolocation API: function Location() { this.lat = 0; this.lon = 0; this.update = function(lat, lon) { this.lat = lat; this.lon = lon; this.onUpdate(lat, lon); }; this.onUpdate = function(lat, lon) {}; } var loc = new Location(); Next I wrote a snippet which needs to set loc.onUpdate to a function that calls into Lift to update the page. I have: class Geolocation { def updatePosition(pos:String):JsCmd = Alert(Got an update: +pos) def update(in:NodeSeq):NodeSeq = script type=text/javascript loc.onUpdate = function(lat, lon) { {SHtml.ajaxCall(JsObj(lat - JsVar(lat), lon - JsVar(lon)), updatePosition _)._2} }; /script } Two issues here. First, how do I get those braces around the JS function containing the ajaxCall into my HTML? Seems like there should be a way to escape braces so I can include them in NodeSeq, but \{ didn't seem to do it. I'm also quite new to JS as well, so perhaps there's a better way to set that callback. All I can come up with is changing the callback signature to accept an object rather than individual values so perhaps I can set it directly to the Lift-generated function, but I think I'd rather have raw values for individual position components for now. 2. Ideally, I'd like for the JsObj to be an actual Map[String, Float]. Is there a way to do this? An included JSON parser that'd convert the string to a type I specify, perhaps? (assuming I'd have to give some sort of hint for Float vs. other numeric types, anyway) Thanks. Wow, this really makes AJAX development something I'd actually enjoy doing. :) --~--~-~--~~~---~--~~ 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: Simple Javascript question(from a lift snippet of course...)
Thank you very much! Good to find the lifty way; time to refactor some code =) On Jul 29, 11:43 pm, marius d. marius.dan...@gmail.com wrote: Well assume you snippet returns a NodeSeq: import net.liftweb.http._ import js._ import JE._ import JsCmds._ def myFunc(xml: NodeSeq): NodeSeq = { ... resultingNode ++ head{Script(OnLoad(Call(myStartupFunction)))}/ head } In the above example we are returning a head node as well which will be merged by Lift automatically in the real page head. Then I'm using Lift's JavaScript abstractions to call on load function myStartupFunction. Instead of head{Script(OnLoad(Call(myStartupFunction)))}/head you can also use head script type=text/javascript charset=utf-8{ Unparsed( jQuery(document).ready(function() { myStartupFunction(); }) ) } /head Br's, Marius On Jul 30, 8:13 am, DFectuoso santiago1...@gmail.com wrote: This is probably trivial but can't seem to find the lifty way... without hand rolling javascript What is the best way to generate(in the snippet) a javascript command to be run on the window.onload event? Thank you very much you divine and infinite source or lift knowledge AKA lift google group =) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: How to use Mapper and record framework
Dear Pravin. Your requests address very basic behaviour of the framework, and you should not experience any problem in adapting examples from the aforementioned book. Even simpler you could follow the Todo example in Getting Started with Lift accessible from liftweb site (http://liftweb.net/docs/ getting_started/mod_master.html). Related to persistency at the moment you should concentrate on using Mapper. Creating your model object is a breeze. Create a MyItem.scala file with the following entities (your project should have a model package to contain this stuff) class MyItem extends LongKeyedMapper[MyItem] with IdPK { def getSingleton = MyItem object name extends MappedPoliteString(this,64) } object MyItem extends MyItem with LongKeyedMetaMapper[MyItem] Modify the Schemifier line in Boot.scala to add your MetaMapper object Schemifier.schemify(true, Log.infoF _, User, MyItem) ... and now you can start having fun in creating the next web killer app using Lift. Regards Giuseppe On 30 Lug, 07:52, pravin pravinka...@gmail.com wrote: Hi, Guys i am new to Lift. I want to use mapper and record framework. I have following case: 1. Table with two column [id,name] ...// I have MySQL DB 2. i want to fire select query on above table 3. Display above result on GUI How can i do this with mapper and record: I done with Boot.scala chages as per steps mentioned in Exploring Lift: Scala-based Web Framework book but i am not able to create mapper or record class ...how can i do this and put query on top of this. Also where can i get detail information about mapper and record framework as above book is not sufficient for this Thanks in advance.. -Pravin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Help on Build from source
On Wed, Jul 29, 2009 at 10:22 PM, nile black nile.bl...@gmail.com wrote: Thanks everyone for your help and replies! It builds successful in my new clean colinux vm. Does it also build on your Windows box? It should now... and if it doesn't I didn't nail all the _root_ causes. Nile Black On Wed, Jul 29, 2009 at 10:11 PM, Timothy Perrett timo...@getintheloop.eu wrote: FYI, David MacIver recently wrote a blog about exactly how package imports work :-) http://www.drmaciver.com/2009/07/how-packages-work-in-scala/ Its interesting reading so perhaps that will help Nile. Cheers, Tim On Jul 29, 3:06 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Nile, Scala imports are relative unless the path of the import is prefixed by _root_. This behavior is the subject of fierce discussion on the Scala list. What does relative mean? It's like this: import net.liftweb._ import http._ // imports net.liftweb.http._ The problem is that if you have a JAR with some net.java.blah package in it, the Scala compiler will look to resolve java.concurrent._ as net.java.concurrent._ We've generally tried to be explicit about using _root_ for all our imports, etc., but some lazy good for nothing Lift committers (I'm thinking about me), don't always follow the rule... and this has led to the pain you are experiencing. So, I don't know how Maven uses your environment variables, but that's the thing that's poking at the issue. I did some work to make the import paths in Lift absolute. I'll spend time today finishing the cleanup. Thanks, David On Tue, Jul 28, 2009 at 10:52 PM, nile black nile.bl...@gmail.com wrote: Hi,Everyone i try to fix the problem eg: [WARNING] D:\user\liftweb\lift-util\src\main\scala\net\liftweb\util\ConcurrentLock.sc ala:16: error: value util is not a member of package net.java [WARNING] import java.util.concurrent.locks._ i use import _root_.java.util.concurrent.locks._ instead of import java.util.concurrent.locks._ the error disappear! it works. but my question is what's difference between with or without _root_??? Nile Black On Wed, Jul 29, 2009 at 1:07 PM, nile black nile.bl...@gmail.com wrote: [WARNING] D:\user\liftweb\lift-util\src\main\scala\net\liftweb\util\ConcurrentLock.sc ala:16: error: value util is not a member of package net.java [WARNING] import java.util.concurrent.locks._ -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- 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: Jersey + Lift, whats the story?
2009/7/17 Timothy Perrett timo...@getintheloop.eu: Hey guys, I've been taking a look at Jersey and how it operates with Lift by way of the recent integration that cropped up on dev.java.net... Though it did start here first! :) http://www.nabble.com/using-Lift-templates-stand-alone-inside-other-frameworks-like-JAXRS--td23177478.html#a23558689 BTW it was only when there was lukewarm response on the fork I created at github that I popped it into Jersey instead. Though David did most of the heavy lifting hacking Lift to make templates reusable outside of Lift's normal servlet+controller layer From my perspective, I see how having a standard RS service framework could be helpful, but it appears to bypass important lift concepts like SiteMap etc so I'm just wondering what the benefit of using such a layer would be over using DispatchPF etc to create REST services or serving xml fragments for templates? (I have no idea about Jersey apart from the basic docs ive read, so if im missing a major benefit id love to hear discuss) As David said there are strengths and weaknesses to both approaches. I see them as alternatives really; use one approach or the other or mix them if required. My main motivation of the original Jersey - Lift integration was to enable JAXRS folks to reuse Scala/Lift code for templating instead of the joy that is JSP/JSP EL/JSTL/custom tag files/(SiteMesh|Tiles). I'd always assumed the SiteMap and JAXRS were kinda separate parts of the URI space. Though having said that I've just noticed that using Jersey + Lift trunk together in an application is currently broken unless there is some kind of SiteMap defined :). I wonder if one day we can kinda get Jersey to expose its own SiteMap (of sorts) into Lift's SiteMap? -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] JSON form with
I think the current implementation of the JSON form is broken. If you put an in a text field and try to submit it via a JSON form it doesn't get handled correctly. To be precise the formToJSON function in jlift.js doesn't work, and again to be more precise the params method is broken / not fit for purpose. The params method (line 249) calls s.join() and then returns but it doesn't escape the character (it also uses = but doesn't escape that). If the params function does what I think it is supposed to do which is split paramters for a URL then it should really call encodeURI on the values. That aside I don't think the formToJSON function should be using the param function. It gets a JSON object from jQuery serializeArray makes it into a string split by and = then goes and splits based on and = again building up some JSON (as a string) then parses the JSON. Why not operate on the JSON from jQuery from the start. e.g. formToJSON : function(formId) { json = jQuery(# + formId).serializeArray(); ret = {} for (var i in json) { var obj = json[i] ret[obj.name] = obj.value } return ret; } This does work differently from before since it won't call functions like params does but I don't think jQuery's serializeArray puts functions in the object it returns so that is not needed. James --~--~-~--~~~---~--~~ 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: JSON form with
Thank you James for your input. I hope I'll be able to look into it today. Br's, Marius On Jul 30, 4:42 pm, James Kearney ghostf...@googlemail.com wrote: I think the current implementation of the JSON form is broken. If you put an in a text field and try to submit it via a JSON form it doesn't get handled correctly. To be precise the formToJSON function in jlift.js doesn't work, and again to be more precise the params method is broken / not fit for purpose. The params method (line 249) calls s.join() and then returns but it doesn't escape the character (it also uses = but doesn't escape that). If the params function does what I think it is supposed to do which is split paramters for a URL then it should really call encodeURI on the values. That aside I don't think the formToJSON function should be using the param function. It gets a JSON object from jQuery serializeArray makes it into a string split by and = then goes and splits based on and = again building up some JSON (as a string) then parses the JSON. Why not operate on the JSON from jQuery from the start. e.g. formToJSON : function(formId) { json = jQuery(# + formId).serializeArray(); ret = {} for (var i in json) { var obj = json[i] ret[obj.name] = obj.value } return ret; } This does work differently from before since it won't call functions like params does but I don't think jQuery's serializeArray puts functions in the object it returns so that is not needed. James --~--~-~--~~~---~--~~ 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] ajaxCall jlift.js and json2.js
I wanted to use ajaxCall on a page but it didn't seem to be working due to javascript issues. Eventually I found that I needed to include script type=text/javascript src=classpath/jlift.js / in the page. I just wanted to check that you need to manually include these on every page that uses ajax or should it be included automatically and I have messed up the configuration some how. Thanks, James --~--~-~--~~~---~--~~ 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: Jersey + Lift, whats the story?
2009/7/30 James Strachan james.strac...@gmail.com: 2009/7/17 Timothy Perrett timo...@getintheloop.eu: Hey guys, I've been taking a look at Jersey and how it operates with Lift by way of the recent integration that cropped up on dev.java.net... Though it did start here first! :) http://www.nabble.com/using-Lift-templates-stand-alone-inside-other-frameworks-like-JAXRS--td23177478.html#a23558689 BTW it was only when there was lukewarm response on the fork I created at github that I popped it into Jersey instead. Though David did most of the heavy lifting hacking Lift to make templates reusable outside of Lift's normal servlet+controller layer From my perspective, I see how having a standard RS service framework could be helpful, but it appears to bypass important lift concepts like SiteMap etc so I'm just wondering what the benefit of using such a layer would be over using DispatchPF etc to create REST services or serving xml fragments for templates? (I have no idea about Jersey apart from the basic docs ive read, so if im missing a major benefit id love to hear discuss) As David said there are strengths and weaknesses to both approaches. I see them as alternatives really; use one approach or the other or mix them if required. My main motivation of the original Jersey - Lift integration was to enable JAXRS folks to reuse Scala/Lift code for templating instead of the joy that is JSP/JSP EL/JSTL/custom tag files/(SiteMesh|Tiles). I'd always assumed the SiteMap and JAXRS were kinda separate parts of the URI space. Though having said that I've just noticed that using Jersey + Lift trunk together in an application is currently broken unless there is some kind of SiteMap defined :). Strike that - pilot error! I'd broken the web.xml in that application to disable Jersey's filter, DOH :). Jersey + Lift works fine with 1.1-SNAPSHOT and 1.1-M3 of Lift. I wonder if one day we can kinda get Jersey to expose its own SiteMap (of sorts) into Lift's SiteMap? It would certainly be useful to reuse Lift's Menu rendering when using a Lift template to render a JAXRS resource bean; am sure that would not be too hard to fix. We might want to support adding resource beans to the menus too -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Mapper and Primary Keys
Oops, you're right, I just glossed over that. Using that I now get an error when I try to use a pre-existing primary key: scala Cat.create.mac(00:1d:c9:00:04:9f).save ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'CATS_PK' defined on 'CATS'. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups (Unknown Source) at org.apache.derby.impl.sql.execu... I have just one more question: is this normal for save to throw an exception here? I understand its benefits but I find the situation less 'exceptional' than just a failure to save. I guess this was a choice Derby made, not Lift... Peter PS I updated the fork to reflect the working code: http://github.com/pr1001/lift_1_1_sample/tree/master On Jul 29, 7:44 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Did you look at all the overridden methods on the Cat primary key in the example? You have to override the method that defines the column in the RDBMS to define the column as UNIQUE NOT NULL. On Wed, Jul 29, 2009 at 5:24 PM, Peter Robinett pe...@bubblefoundry.comwrote: Ahh, here we go: INFO - CREATE TABLE users (id BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY , firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR (48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw VARCHAR (48) , password_slt VARCHAR(20) , textarea VARCHAR(2048) , superuser SMALLINT , validated SMALLINT , uniqueid VARCHAR(32)) INFO - ALTER TABLE users ADD CONSTRAINT users_PK PRIMARY KEY(id) INFO - CREATE TABLE cats (name VARCHAR(128) , mac VARCHAR(17) , weight INTEGER) INFO - ALTER TABLE cats ADD CONSTRAINT cats_PK PRIMARY KEY(mac) ERROR 42831: 'MAC' cannot be a column of a primary key or unique key because it can contain null values. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.sql.compile.TableElementList.checkForNullColumns (Unknown Source) at org.apache.derby.impl.sql.compile.TableElementList.validate (Unknown Source) at org.apache.derby.impl.sql.co... I have a defaultValue, so I'm not sure why it thinks the column can be null. Perhaps because it's lazy? override lazy val defaultValue = randomString(maxLen) Peter On Jul 29, 4:51 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jul 29, 2009 at 4:35 PM, Peter Robinett pe...@bubblefoundry.com wrote: Thanks, David, I am now able to save the mac address. I am, however, able to create multiple rows in the database with the same mac address, suggesting that that the uniqueness of the primary key is not being enforced. This surprised me, as MappedStringIndex extends MappedUniqueId. Does something else need to be changed? Please send me the output of what Schemifier does when it creates the database Thanks all for your help! Peter On Jul 29, 3:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I had to add a property on MappedField for dbGenerated_? which has to be set to false. Here's the change set and the revised, working (wait for an hour for Hudson to build the new code) version. On Wed, Jul 29, 2009 at 1:26 PM, Peter Robinett pe...@bubblefoundry.com wrote: Hi all, My sample code is here: http://github.com/pr1001/lift_1_1_sample/tree/master I hadn't been overriding def dirty_?(b: Boolean) but I see why I need to. With everyone's suggestions, here is how I try to set the MAC address: $ mvn scala:console scala new bootstrap.liftweb.Boot().boot scala import com.liftcode.model._ import com.liftcode.model._ scala val c = Cat.create.mac(00:1d:c9:00:04:9f) c: com.liftcode.model.Cat = com.liftcode.model.Cat= {name=,mac=00:1d:c9:00:04:9f,weight=0} scala c.dirty_? res1: Boolean = true scala c.mac.dirty_? res2: Boolean = true scala c.save res3: Boolean = true scala Cat.findAll() res4: List[com.liftcode.model.Cat] = List(com.liftcode.model.Cat= {name=,mac=,weight=0}) Peter On Jul 29, 12:42 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Did you try to override def dirty_? and def dirty_?(b: Boolean), and in the latter set your own private variable and read it in dirty_? (the getter)? - Peter Robinettpe...@bubblefoundry.com wrote: Hi Derek, I'm afraid I'm not sure how to do this, since _dirty_? is a private var in MappedField: /** * Is the field dirty */ private var _dirty_? = false /** * Is the field dirty (has it been changed since the
[Lift] Re: Weekly Article Request
Awesome! Thanks for the hard work guys. Sorry, I haven't sent another list out. I moved last weekend and I still don't have internet in my house. I'll try to send another list in the next couple of days. -Xavi On Thu, Jul 30, 2009 at 12:51 AM, David Pollakfeeder.of.the.be...@gmail.com wrote: Mine articles are done. On Wed, Jul 22, 2009 at 8:37 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jul 22, 2009 at 3:22 AM, Xavi Ramirez xavi@gmail.com wrote: Hello, My name is Xavi and I've volunteered as the wiki garden. Every week I'll post a couple of articles topics that we should work on. Here are my picks for this week. Articles we should write: How to parse and create JSON How to use to create a login system using OpenID How to hide and show Admin content HowTo get/store session data dpp owns the above Lift's Rendering Pipeline (here's helpful post http://groups.google.com/group/liftweb/msg/1f156eeec71da397) Articles we should update: http://wiki.liftweb.net/index.php/SetUp_jEdit http://wiki.liftweb.net/index.php/HowTo_start_a_new_liftwebapp dpp owns the above http://wiki.liftweb.net/index.php/How_to_localize Please don't feel limited to the pages I mentioned above. Feel free to edit/create any page you like. If you need an account, just ask and I'll create one for you. Also if there's an article you'd like to see written or improved, please let us know! Thanks, Xavi -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Weekly Article Request
Xavi, Have you got links for the new pages... seems like it would make a complete picture then for the archives :-) Cheers, Tim On Jul 30, 4:23 pm, Xavi Ramirez xavi@gmail.com wrote: Awesome! Thanks for the hard work guys. Sorry, I haven't sent another list out. I moved last weekend and I still don't have internet in my house. I'll try to send another list in the next couple of days. -Xavi On Thu, Jul 30, 2009 at 12:51 AM, David Pollakfeeder.of.the.be...@gmail.com wrote: Mine articles are done. On Wed, Jul 22, 2009 at 8:37 AM, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jul 22, 2009 at 3:22 AM, Xavi Ramirez xavi@gmail.com wrote: Hello, My name is Xavi and I've volunteered as the wiki garden. Every week I'll post a couple of articles topics that we should work on. Here are my picks for this week. Articles we should write: How to parse and create JSON How to use to create a login system using OpenID How to hide and show Admin content HowTo get/store session data dpp owns the above Lift's Rendering Pipeline (here's helpful post http://groups.google.com/group/liftweb/msg/1f156eeec71da397) Articles we should update: http://wiki.liftweb.net/index.php/SetUp_jEdit http://wiki.liftweb.net/index.php/HowTo_start_a_new_liftwebapp dpp owns the above http://wiki.liftweb.net/index.php/How_to_localize Please don't feel limited to the pages I mentioned above. Feel free to edit/create any page you like. If you need an account, just ask and I'll create one for you. Also if there's an article you'd like to see written or improved, please let us know! Thanks, Xavi -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: ajaxCall jlift.js and json2.js
James, Correct, you do indeed need to include this in a page where you want to use json forms etc... Cheers, Tim On Jul 30, 3:53 pm, James Kearney ghostf...@googlemail.com wrote: I wanted to use ajaxCall on a page but it didn't seem to be working due to javascript issues. Eventually I found that I needed to include script type=text/javascript src=classpath/jlift.js / in the page. I just wanted to check that you need to manually include these on every page that uses ajax or should it be included automatically and I have messed up the configuration some how. Thanks, James --~--~-~--~~~---~--~~ 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: JSON form with
James, I just committed the fix based on your approach. Please give it a try. Br's, Marius On Jul 30, 4:53 pm, marius d. marius.dan...@gmail.com wrote: Thank you James for your input. I hope I'll be able to look into it today. Br's, Marius On Jul 30, 4:42 pm, James Kearney ghostf...@googlemail.com wrote: I think the current implementation of the JSON form is broken. If you put an in a text field and try to submit it via a JSON form it doesn't get handled correctly. To be precise the formToJSON function in jlift.js doesn't work, and again to be more precise the params method is broken / not fit for purpose. The params method (line 249) calls s.join() and then returns but it doesn't escape the character (it also uses = but doesn't escape that). If the params function does what I think it is supposed to do which is split paramters for a URL then it should really call encodeURI on the values. That aside I don't think the formToJSON function should be using the param function. It gets a JSON object from jQuery serializeArray makes it into a string split by and = then goes and splits based on and = again building up some JSON (as a string) then parses the JSON. Why not operate on the JSON from jQuery from the start. e.g. formToJSON : function(formId) { json = jQuery(# + formId).serializeArray(); ret = {} for (var i in json) { var obj = json[i] ret[obj.name] = obj.value } return ret; } This does work differently from before since it won't call functions like params does but I don't think jQuery's serializeArray puts functions in the object it returns so that is not needed. James --~--~-~--~~~---~--~~ 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] H2 mapper problem
I am using an H2 database for my lift app. If I start with a clean database and let schemifier create the tables, the tables get created ok, but then I get a java.util.NoSuchElementException: key not found: fsite_users where fsite_users is my User table. The table is created and the app runs fine after ward. If I set schemifier to only validate the db, I get the same error, so it seems to me like it's the code that tries to verify the schema is where the problem lies. I thought it might be a case issue, so I tried it with all uppercase table names, but I got the same problem. I also tried this with various versions of lift. Any Ideas? OS: Ubuntu 9.04 Scala: 2.7.5 Lift: 1.1-SNAPSHOT H2: 1.1.116 Here is the log: [info] == jetty-run == 2009-07-30 12:10:29.875::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [info] jetty-7.0.0.pre5 [info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet INFO - CREATE TABLE fsite_users (id BIGINT NOT NULL AUTO_INCREMENT , firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw VARCHAR(48) , password_slt VARCHAR(20) , superuser BOOLEAN , validated BOOLEAN , uniqueid VARCHAR(32)) INFO - CREATE TABLE fsite_user_ext_sess (id BIGINT NOT NULL AUTO_INCREMENT , experation BIGINT , userid VARCHAR(64) , cookieid VARCHAR(32)) INFO - CREATE TABLE fsite_flm_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , hidden BOOLEAN , active BOOLEAN) INFO - CREATE TABLE fsite_flm_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT) INFO - CREATE TABLE fsite_flm_owners (id BIGINT NOT NULL AUTO_INCREMENT , user_id BIGINT , hidden BOOLEAN , commissioner BOOLEAN , team_id BIGINT) INFO - CREATE TABLE fsite_sports (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT) INFO - CREATE TABLE fsite_sport_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , sport_id BIGINT , abbr VARCHAR(12) , currentseason INTEGER) INFO - CREATE TABLE fsite_sport_players (id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , firstname VARCHAR(32) , lastname VARCHAR(32) , namesuffix VARCHAR(3) , middlename VARCHAR(32)) INFO - CREATE TABLE fsite_sport_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , abbr VARCHAR(12)) ERROR - Failed to Boot java.util.NoSuchElementException: key not found: fsite_users at scala.collection.Map$class.default(Map.scala:169) at scala.collection.mutable.HashMap.default(HashMap.scala:33) at scala.collection.Map$class.apply(Map.scala:80) at scala.collection.mutable.HashMap.apply(HashMap.scala:33) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$$using (Schemifier.scala:43) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 189) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 184) at scala.List.flatMap(List.scala:1132) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$ $ensureColumns(Schemifier.scala:183) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at scala.List.foldLeft(List.scala:1066) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:54) at net.liftweb.mapper.DB$.use(DB.scala:317) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36) at bootstrap.liftweb.Boot.boot(Boot.scala:62) 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:597) at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply (ClassHelpers.scala:408) at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply (ClassHelpers.scala:406) at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply (LiftRules.scala:1096) at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply (LiftRules.scala:1096) at net.liftweb.util.Full.map(Box.scala:330) at net.liftweb.http.DefaultBootstrap$.boot(LiftRules.scala:1096) at net.liftweb.http.LiftFilter.bootLift(LiftServlet.scala:556) at net.liftweb.http.LiftFilter.init(LiftServlet.scala:530) at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java: 97) at
[Lift] Re: Mapper and Primary Keys
On Thu, Jul 30, 2009 at 8:16 AM, Peter Robinett pe...@bubblefoundry.comwrote: Oops, you're right, I just glossed over that. Using that I now get an error when I try to use a pre-existing primary key: scala Cat.create.mac(00:1d:c9:00:04:9f).save ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'CATS_PK' defined on 'CATS'. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups (Unknown Source) at org.apache.derby.impl.sql.execu... I have just one more question: is this normal for save to throw an exception here? I understand its benefits but I find the situation less 'exceptional' than just a failure to save. I guess this was a choice Derby made, not Lift... This is a correct choice. If you are trying to insert a second record with an identical primary key should generate an exception. You could try: Cat.find(foo) openOr Cat.create.mac(foo) This will find an existing record or create a new one. Peter PS I updated the fork to reflect the working code: http://github.com/pr1001/lift_1_1_sample/tree/master On Jul 29, 7:44 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Did you look at all the overridden methods on the Cat primary key in the example? You have to override the method that defines the column in the RDBMS to define the column as UNIQUE NOT NULL. On Wed, Jul 29, 2009 at 5:24 PM, Peter Robinett pe...@bubblefoundry.com wrote: Ahh, here we go: INFO - CREATE TABLE users (id BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY , firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR (48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw VARCHAR (48) , password_slt VARCHAR(20) , textarea VARCHAR(2048) , superuser SMALLINT , validated SMALLINT , uniqueid VARCHAR(32)) INFO - ALTER TABLE users ADD CONSTRAINT users_PK PRIMARY KEY(id) INFO - CREATE TABLE cats (name VARCHAR(128) , mac VARCHAR(17) , weight INTEGER) INFO - ALTER TABLE cats ADD CONSTRAINT cats_PK PRIMARY KEY(mac) ERROR 42831: 'MAC' cannot be a column of a primary key or unique key because it can contain null values. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.sql.compile.TableElementList.checkForNullColumns (Unknown Source) at org.apache.derby.impl.sql.compile.TableElementList.validate (Unknown Source) at org.apache.derby.impl.sql.co... I have a defaultValue, so I'm not sure why it thinks the column can be null. Perhaps because it's lazy? override lazy val defaultValue = randomString(maxLen) Peter On Jul 29, 4:51 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jul 29, 2009 at 4:35 PM, Peter Robinett pe...@bubblefoundry.com wrote: Thanks, David, I am now able to save the mac address. I am, however, able to create multiple rows in the database with the same mac address, suggesting that that the uniqueness of the primary key is not being enforced. This surprised me, as MappedStringIndex extends MappedUniqueId. Does something else need to be changed? Please send me the output of what Schemifier does when it creates the database Thanks all for your help! Peter On Jul 29, 3:36 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I had to add a property on MappedField for dbGenerated_? which has to be set to false. Here's the change set and the revised, working (wait for an hour for Hudson to build the new code) version. On Wed, Jul 29, 2009 at 1:26 PM, Peter Robinett pe...@bubblefoundry.com wrote: Hi all, My sample code is here: http://github.com/pr1001/lift_1_1_sample/tree/master I hadn't been overriding def dirty_?(b: Boolean) but I see why I need to. With everyone's suggestions, here is how I try to set the MAC address: $ mvn scala:console scala new bootstrap.liftweb.Boot().boot scala import com.liftcode.model._ import com.liftcode.model._ scala val c = Cat.create.mac(00:1d:c9:00:04:9f) c: com.liftcode.model.Cat = com.liftcode.model.Cat= {name=,mac=00:1d:c9:00:04:9f,weight=0} scala c.dirty_? res1: Boolean = true scala c.mac.dirty_? res2: Boolean = true scala c.save res3: Boolean = true scala Cat.findAll() res4: List[com.liftcode.model.Cat] = List(com.liftcode.model.Cat= {name=,mac=,weight=0}) Peter On Jul 29, 12:42 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Did you try to override def dirty_? and def dirty_?(b: Boolean), and in
[Lift] Re: H2 mapper problem
Please create a ticket with a reproduceable example at http://github.com/dpp/liftweb/issues It might be best to fork http://github.com/dpp/lift_1_1_sample/tree/master in order to create a reproduceable example. On Thu, Jul 30, 2009 at 10:47 AM, Tim N tnell...@gmail.com wrote: I am using an H2 database for my lift app. If I start with a clean database and let schemifier create the tables, the tables get created ok, but then I get a java.util.NoSuchElementException: key not found: fsite_users where fsite_users is my User table. The table is created and the app runs fine after ward. If I set schemifier to only validate the db, I get the same error, so it seems to me like it's the code that tries to verify the schema is where the problem lies. I thought it might be a case issue, so I tried it with all uppercase table names, but I got the same problem. I also tried this with various versions of lift. Any Ideas? OS: Ubuntu 9.04 Scala: 2.7.5 Lift: 1.1-SNAPSHOT H2: 1.1.116 Here is the log: [info] == jetty-run == 2009-07-30 12:10:29.875::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [info] jetty-7.0.0.pre5 [info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet INFO - CREATE TABLE fsite_users (id BIGINT NOT NULL AUTO_INCREMENT , firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw VARCHAR(48) , password_slt VARCHAR(20) , superuser BOOLEAN , validated BOOLEAN , uniqueid VARCHAR(32)) INFO - CREATE TABLE fsite_user_ext_sess (id BIGINT NOT NULL AUTO_INCREMENT , experation BIGINT , userid VARCHAR(64) , cookieid VARCHAR(32)) INFO - CREATE TABLE fsite_flm_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , hidden BOOLEAN , active BOOLEAN) INFO - CREATE TABLE fsite_flm_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT) INFO - CREATE TABLE fsite_flm_owners (id BIGINT NOT NULL AUTO_INCREMENT , user_id BIGINT , hidden BOOLEAN , commissioner BOOLEAN , team_id BIGINT) INFO - CREATE TABLE fsite_sports (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT) INFO - CREATE TABLE fsite_sport_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , sport_id BIGINT , abbr VARCHAR(12) , currentseason INTEGER) INFO - CREATE TABLE fsite_sport_players (id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , firstname VARCHAR(32) , lastname VARCHAR(32) , namesuffix VARCHAR(3) , middlename VARCHAR(32)) INFO - CREATE TABLE fsite_sport_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , abbr VARCHAR(12)) ERROR - Failed to Boot java.util.NoSuchElementException: key not found: fsite_users at scala.collection.Map$class.default(Map.scala:169) at scala.collection.mutable.HashMap.default(HashMap.scala:33) at scala.collection.Map$class.apply(Map.scala:80) at scala.collection.mutable.HashMap.apply(HashMap.scala:33) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$$using (Schemifier.scala:43) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 189) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 184) at scala.List.flatMap(List.scala:1132) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$ $ensureColumns(Schemifier.scala:183) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at scala.List.foldLeft(List.scala:1066) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:54) at net.liftweb.mapper.DB$.use(DB.scala:317) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36) at bootstrap.liftweb.Boot.boot(Boot.scala:62) 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:597) at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply (ClassHelpers.scala:408) at net.liftweb.util.ClassHelpers$$anonfun$createInvoker$1.apply (ClassHelpers.scala:406) at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply (LiftRules.scala:1096) at net.liftweb.http.DefaultBootstrap$$anonfun$boot$1.apply (LiftRules.scala:1096)
[Lift] Re: Jersey + Lift, whats the story?
On Thu, Jul 30, 2009 at 8:13 AM, James Strachan james.strac...@gmail.comwrote: 2009/7/30 James Strachan james.strac...@gmail.com: 2009/7/17 Timothy Perrett timo...@getintheloop.eu: Hey guys, I've been taking a look at Jersey and how it operates with Lift by way of the recent integration that cropped up on dev.java.net... Though it did start here first! :) http://www.nabble.com/using-Lift-templates-stand-alone-inside-other-frameworks-like-JAXRS--td23177478.html#a23558689 BTW it was only when there was lukewarm response on the fork I created at github that I popped it into Jersey instead. Though David did most of the heavy lifting hacking Lift to make templates reusable outside of Lift's normal servlet+controller layer From my perspective, I see how having a standard RS service framework could be helpful, but it appears to bypass important lift concepts like SiteMap etc so I'm just wondering what the benefit of using such a layer would be over using DispatchPF etc to create REST services or serving xml fragments for templates? (I have no idea about Jersey apart from the basic docs ive read, so if im missing a major benefit id love to hear discuss) As David said there are strengths and weaknesses to both approaches. I see them as alternatives really; use one approach or the other or mix them if required. My main motivation of the original Jersey - Lift integration was to enable JAXRS folks to reuse Scala/Lift code for templating instead of the joy that is JSP/JSP EL/JSTL/custom tag files/(SiteMesh|Tiles). I'd always assumed the SiteMap and JAXRS were kinda separate parts of the URI space. Though having said that I've just noticed that using Jersey + Lift trunk together in an application is currently broken unless there is some kind of SiteMap defined :). Strike that - pilot error! I'd broken the web.xml in that application to disable Jersey's filter, DOH :). Jersey + Lift works fine with 1.1-SNAPSHOT and 1.1-M3 of Lift. I wonder if one day we can kinda get Jersey to expose its own SiteMap (of sorts) into Lift's SiteMap? There's a way to dynamically create submenus based on a function in SiteMap. We could wire that up to Jersey's mechanisms to expose dynamic stuff via SiteMap. Also, a lot of Lift's dispatch stuff is based on PartialFunction. PartialFunction is just apply and isDefinedAt... so we can build partial functions based on the data supplied by Java frameworks and dynamically dispatch from the underlying stuff. It would certainly be useful to reuse Lift's Menu rendering when using a Lift template to render a JAXRS resource bean; am sure that would not be too hard to fix. We might want to support adding resource beans to the menus too -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.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] Odd XML parsing issue
Not sure what I have messed up here but if I have a hardcoded link in a template page where the href includes query params the lift runtime stacktraces. As an example a href=http://www.yahoo.com? a=4b=5Test/a blows up - see below. Removing the b=5 and all is well. The doctype is: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; xmlns:lift=http://liftweb.net/; Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009. -- Ewan The stacktrace... div style=border: 1px red solidError locating template /templates- hidden/default.html.br / Message: br / pre java.util.NoSuchElementException scala.RandomAccessSeq$$anon$13.next (RandomAccessSeq.scala:165) scala.xml.parsing.MarkupParser$class.normalizeAttributeValue (MarkupParser.scala:1191) net.liftweb.util.PCDataXmlParser.normalizeAttributeValue (PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.xAttributeValue (MarkupParser.scala:334) net.liftweb.util.PCDataXmlParser.xAttributeValue (PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala: 106) scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365) net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200) net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:179) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply (PCDataMarkupParser.scala:179) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply (PCDataMarkupParser.scala:178) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.util.PCDataXmlParser$.apply(PCDataMarkupParser.scala:178) net.liftweb.http.TemplateFinder$.findAnyTemplate(LiftSession.scala: 1231) net.liftweb.http.LiftSession.findTemplate(LiftSession.scala:727) net.liftweb.http.LiftSession.findAndMerge(LiftSession.scala:1098) net.liftweb.builtin.snippet.Surround$$anonfun$render$1$$anonfun$apply
[Lift] Re: Odd XML parsing issue
URLs in XML need to be XML Encoded... so try a href=http://www.yahoo.com?a=4amp;b=5;Test/a ---Mark On Thu, Jul 30, 2009 at 10:53 AM, Ewanehar...@gmail.com wrote: Not sure what I have messed up here but if I have a hardcoded link in a template page where the href includes query params the lift runtime stacktraces. As an example a href=http://www.yahoo.com? a=4b=5Test/a blows up - see below. Removing the b=5 and all is well. The doctype is: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; xmlns:lift=http://liftweb.net/; Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009. -- Ewan The stacktrace... div style=border: 1px red solidError locating template /templates- hidden/default.html.br / Message: br / pre java.util.NoSuchElementException scala.RandomAccessSeq$$anon$13.next (RandomAccessSeq.scala:165) scala.xml.parsing.MarkupParser$class.normalizeAttributeValue (MarkupParser.scala:1191) net.liftweb.util.PCDataXmlParser.normalizeAttributeValue (PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.xAttributeValue (MarkupParser.scala:334) net.liftweb.util.PCDataXmlParser.xAttributeValue (PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala: 106) scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365) net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200) net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:179) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply (PCDataMarkupParser.scala:179) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply (PCDataMarkupParser.scala:178) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.util.PCDataXmlParser$.apply(PCDataMarkupParser.scala:178)
[Lift] Re: Odd XML parsing issue
But that looks exactly like I have it... On Jul 30, 7:02 pm, Mark McBride mark.mcbr...@gmail.com wrote: URLs in XML need to be XML Encoded... so try a href=http://www.yahoo.com?a=4b=5;Test/a ---Mark On Thu, Jul 30, 2009 at 10:53 AM, Ewanehar...@gmail.com wrote: Not sure what I have messed up here but if I have a hardcoded link in a template page where the href includes query params the lift runtime stacktraces. As an example a href=http://www.yahoo.com? a=4b=5Test/a blows up - see below. Removing the b=5 and all is well. The doctype is: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; xmlns:lift=http://liftweb.net/; Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009. -- Ewan The stacktrace... div style=border: 1px red solidError locating template /templates- hidden/default.html.br / Message: br / pre java.util.NoSuchElementException scala.RandomAccessSeq$$anon$13.next (RandomAccessSeq.scala:165) scala.xml.parsing.MarkupParser$class.normalizeAttributeValue (MarkupParser.scala:1191) net.liftweb.util.PCDataXmlParser.normalizeAttributeValue (PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.xAttributeValue (MarkupParser.scala:334) net.liftweb.util.PCDataXmlParser.xAttributeValue (PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala: 106) scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365) net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200) net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:179) net.liftweb.util.Full.flatMap(Box.scala:332) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2.apply (PCDataMarkupParser.scala:179)
[Lift] Re: Odd XML parsing issue
Fat fingered the paste... change to amp; On Thu, Jul 30, 2009 at 11:15 AM, Ewanehar...@gmail.com wrote: But that looks exactly like I have it... On Jul 30, 7:02 pm, Mark McBride mark.mcbr...@gmail.com wrote: URLs in XML need to be XML Encoded... so try a href=http://www.yahoo.com?a=4b=5;Test/a ---Mark On Thu, Jul 30, 2009 at 10:53 AM, Ewanehar...@gmail.com wrote: Not sure what I have messed up here but if I have a hardcoded link in a template page where the href includes query params the lift runtime stacktraces. As an example a href=http://www.yahoo.com? a=4b=5Test/a blows up - see below. Removing the b=5 and all is well. The doctype is: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; xmlns:lift=http://liftweb.net/; Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009. -- Ewan The stacktrace... div style=border: 1px red solidError locating template /templates- hidden/default.html.br / Message: br / pre java.util.NoSuchElementException scala.RandomAccessSeq$$anon$13.next (RandomAccessSeq.scala:165) scala.xml.parsing.MarkupParser$class.normalizeAttributeValue (MarkupParser.scala:1191) net.liftweb.util.PCDataXmlParser.normalizeAttributeValue (PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.xAttributeValue (MarkupParser.scala:334) net.liftweb.util.PCDataXmlParser.xAttributeValue (PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala: 106) scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365) net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200) net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:179) net.liftweb.util.Full.flatMap(Box.scala:332)
[Lift] radio input trouble
I am trying to follow the radio input example in the Lift book(s), but I cannot get it to work. Firstly, the example in the book uses this call to the SHtml.radio function SHtml.radio(colorMap.keys.toList, Empty, myColor = colorMap(_)) Using Lift 1.1-SNAPSHOT and Scala 2.7.5 This gives me the error: missing parameter type for expanded function ((x$1) = colorMap(x$1)) colour - radio(colorMap.keys.toList, Empty, myColor = colorMap(_) ) So I change my code to the below: ... var myColor : Color = _ val colorMap = Map(Red - Color.red, White - Color.white, Blue - Color.blue) def renew(xhtml : NodeSeq) : NodeSeq = { bind(form, xhtml, colour - radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ) ) } ... But this yields the following error: overloaded method value - with alternatives [T : net.liftweb.util.Bindable](T with net.liftweb.util.Bindable) net.liftweb.util.Helpers.TheBindableBindParam[T] and (Boolean) net.liftweb.util.Helpers.BooleanBindParam and (Long) net.liftweb.util.Helpers.LongBindParam and (Int) net.liftweb.util.Helpers.IntBindParam and (Symbol) net.liftweb.util.Helpers.SymbolBindParam and (Option [scala.xml.NodeSeq])net.liftweb.util.Helpers.OptionBindParam and (net.liftweb.util.Box[scala.xml.NodeSeq]) net.liftweb.util.Helpers.BoxBindParam and ((scala.xml.NodeSeq) = scala.xml.NodeSeq)net.liftweb.util.Helpers.FuncBindParam and (Seq [scala.xml.Node])net.liftweb.util.Helpers.TheBindParam and (scala.xml.Node)net.liftweb.util.Helpers.TheBindParam and (scala.xml.Text)net.liftweb.util.Helpers.TheBindParam and (scala.xml.NodeSeq)net.liftweb.util.Helpers.TheBindParam and (String) net.liftweb.util.Helpers.TheStrBindParam cannot be applied to (net.liftweb.http.SHtml.ChoiceHolder[String]) colour - radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ) Seems like the bind function doesn't like the ChoiceHolder[String] param (?) What am I doing wrong?! --~--~-~--~~~---~--~~ 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: H2 mapper problem
This issue has been entered. (40) I was able to narrow it down to only being a problem if a user/ password are specified. I'm not sure if a user/password are needed in embedded mode, but I filed the issue anyway. Thanks On Jul 30, 12:51 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Please create a ticket with a reproduceable example athttp://github.com/dpp/liftweb/issues It might be best to forkhttp://github.com/dpp/lift_1_1_sample/tree/masterin order to create a reproduceable example. On Thu, Jul 30, 2009 at 10:47 AM, Tim N tnell...@gmail.com wrote: I am using an H2 database for my lift app. If I start with a clean database and let schemifier create the tables, the tables get created ok, but then I get a java.util.NoSuchElementException: key not found: fsite_users where fsite_users is my User table. The table is created and the app runs fine after ward. If I set schemifier to only validate the db, I get the same error, so it seems to me like it's the code that tries to verify the schema is where the problem lies. I thought it might be a case issue, so I tried it with all uppercase table names, but I got the same problem. I also tried this with various versions of lift. Any Ideas? OS: Ubuntu 9.04 Scala: 2.7.5 Lift: 1.1-SNAPSHOT H2: 1.1.116 Here is the log: [info] == jetty-run == 2009-07-30 12:10:29.875::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [info] jetty-7.0.0.pre5 [info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet INFO - CREATE TABLE fsite_users (id BIGINT NOT NULL AUTO_INCREMENT , firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw VARCHAR(48) , password_slt VARCHAR(20) , superuser BOOLEAN , validated BOOLEAN , uniqueid VARCHAR(32)) INFO - CREATE TABLE fsite_user_ext_sess (id BIGINT NOT NULL AUTO_INCREMENT , experation BIGINT , userid VARCHAR(64) , cookieid VARCHAR(32)) INFO - CREATE TABLE fsite_flm_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , hidden BOOLEAN , active BOOLEAN) INFO - CREATE TABLE fsite_flm_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT) INFO - CREATE TABLE fsite_flm_owners (id BIGINT NOT NULL AUTO_INCREMENT , user_id BIGINT , hidden BOOLEAN , commissioner BOOLEAN , team_id BIGINT) INFO - CREATE TABLE fsite_sports (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT) INFO - CREATE TABLE fsite_sport_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , sport_id BIGINT , abbr VARCHAR(12) , currentseason INTEGER) INFO - CREATE TABLE fsite_sport_players (id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , firstname VARCHAR(32) , lastname VARCHAR(32) , namesuffix VARCHAR(3) , middlename VARCHAR(32)) INFO - CREATE TABLE fsite_sport_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , abbr VARCHAR(12)) ERROR - Failed to Boot java.util.NoSuchElementException: key not found: fsite_users at scala.collection.Map$class.default(Map.scala:169) at scala.collection.mutable.HashMap.default(HashMap.scala:33) at scala.collection.Map$class.apply(Map.scala:80) at scala.collection.mutable.HashMap.apply(HashMap.scala:33) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$$using (Schemifier.scala:43) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 189) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 184) at scala.List.flatMap(List.scala:1132) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$ $ensureColumns(Schemifier.scala:183) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at scala.List.foldLeft(List.scala:1066) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:54) at net.liftweb.mapper.DB$.use(DB.scala:317) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36) at bootstrap.liftweb.Boot.boot(Boot.scala:62) 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:597)
[Lift] Getting Started tutorial - not understanding some syntax
Hi, I feel I must apologise for this post ... I've only been doing scala for a week, and lift for 3 days, but I'm stuck. I'm coming from an experienced java background, just struggling with some scala constructs. I feel I understand the basics of lambda and function literals - but I'm blown away by some of the syntax in the lift Getting Started tutorial. For example, given : val mylist = Array(1,2,3) mylist..foreach(v = println(v) Here I understand where v comes from - its each int in the list. In the tutorial (http://liftweb.net/docs/getting_started/ mod_master.html) there is a function desc (Listing 15) : private def desc(td: ToDo, reDraw: () = JsCmd) = swappable(span{td.desc}/span, span{ajaxText(td.desc, v = {td.desc(v).save; reDraw()})} /span) For my own brain to try and break it down, I have : private def desc(td: ToDo, reDraw: () = JsCmd) = { val myFunctionLiteral = (xxx: String) = {td.desc(xxx).save; println(!Desc function : + xxx); reDraw()} swappable(span{td.desc}/span, span{ajaxText(td.desc, myFunctionLiteral)}/span) } This is called from the doList method : private def doList(reDraw: () = JsCmd)(html: NodeSeq): NodeSeq = toShow. flatMap(td = bind(todo, html, desc - desc(td, reDraw) )) I understand where the ToDo object td is coming from, and how the reDraw thing works, and how they are passed to the desc function, but what I don't understand at all is where the val xxx in myFunctionLiteral comes from ? How is it passed into the function ? Is it currying ? I'm sorry for such a vague question, I'm totally at sea here. Thankyou for reading this, and for any help you may provide ! Ben --~--~-~--~~~---~--~~ 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: radio input trouble
How about : SHtml.radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ).flatMap(_.xhtml) I haven't tested but SHtml.radio rturns a ChoiceHolde which contains a Seq[ChoiceItem[T]]] ... and ChoiceItem has an xhtml member Br's, Marius On Jul 30, 10:49 pm, george geo...@mattandgeorge.com wrote: I am trying to follow the radio input example in the Lift book(s), but I cannot get it to work. Firstly, the example in the book uses this call to the SHtml.radio function SHtml.radio(colorMap.keys.toList, Empty, myColor = colorMap(_)) Using Lift 1.1-SNAPSHOT and Scala 2.7.5 This gives me the error: missing parameter type for expanded function ((x$1) = colorMap(x$1)) colour - radio(colorMap.keys.toList, Empty, myColor = colorMap(_) ) So I change my code to the below: ... var myColor : Color = _ val colorMap = Map(Red - Color.red, White - Color.white, Blue - Color.blue) def renew(xhtml : NodeSeq) : NodeSeq = { bind(form, xhtml, colour - radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ) )} ... But this yields the following error: overloaded method value - with alternatives [T : net.liftweb.util.Bindable](T with net.liftweb.util.Bindable) net.liftweb.util.Helpers.TheBindableBindParam[T] and (Boolean) net.liftweb.util.Helpers.BooleanBindParam and (Long) net.liftweb.util.Helpers.LongBindParam and (Int) net.liftweb.util.Helpers.IntBindParam and (Symbol) net.liftweb.util.Helpers.SymbolBindParam and (Option [scala.xml.NodeSeq])net.liftweb.util.Helpers.OptionBindParam and (net.liftweb.util.Box[scala.xml.NodeSeq]) net.liftweb.util.Helpers.BoxBindParam and ((scala.xml.NodeSeq) = scala.xml.NodeSeq)net.liftweb.util.Helpers.FuncBindParam and (Seq [scala.xml.Node])net.liftweb.util.Helpers.TheBindParam and (scala.xml.Node)net.liftweb.util.Helpers.TheBindParam and (scala.xml.Text)net.liftweb.util.Helpers.TheBindParam and (scala.xml.NodeSeq)net.liftweb.util.Helpers.TheBindParam and (String) net.liftweb.util.Helpers.TheStrBindParam cannot be applied to (net.liftweb.http.SHtml.ChoiceHolder[String]) colour - radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ) Seems like the bind function doesn't like the ChoiceHolder[String] param (?) What am I doing wrong?! --~--~-~--~~~---~--~~ 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] Wymeditor or FCKEditor
Has anyone tried to use wymeditor or FCKEditor in a lift page? I cannot get these plugins to work even thought they are based on JQuery. --~--~-~--~~~---~--~~ 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: Wymeditor or FCKEditor
Please specify the problems you are seeing. Br's, Marius On Jul 30, 11:24 pm, Avo Reid avor...@cox.net wrote: Has anyone tried to use wymeditor or FCKEditor in a lift page? I cannot get these plugins to work even thought they are based on JQuery. --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
Hello Ben! the following: val square = (x:Int) = x * x val square is the equivalent of a final reference in Java. (x : Int) = x * x This constructs a Function instance that takes an Int and returns that Int squared. The equivalent Java code would be something like: interface FunctionR,P //We're ignoring variance here, as to not confuse { public R call(P p); } final FunctionInteger,Integer square = new FunctionInteger,Integer() { public Integer call(Integer i) { return i * i; } } And then you can do: square.call(2) // 4 So, back to Scala: val square = (x : Int) = x * x square(2) // 4 On Thu, Jul 30, 2009 at 9:37 PM, ben b...@primrose.org.uk wrote: Hi, I feel I must apologise for this post ... I've only been doing scala for a week, and lift for 3 days, but I'm stuck. I'm coming from an experienced java background, just struggling with some scala constructs. I feel I understand the basics of lambda and function literals - but I'm blown away by some of the syntax in the lift Getting Started tutorial. For example, given : val mylist = Array(1,2,3) mylist..foreach(v = println(v) Here I understand where v comes from - its each int in the list. In the tutorial (http://liftweb.net/docs/getting_started/ mod_master.htmlhttp://liftweb.net/docs/getting_started/%0Amod_master.html ) there is a function desc (Listing 15) : private def desc(td: ToDo, reDraw: () = JsCmd) = swappable(span{td.desc}/span, span{ajaxText(td.desc, v = {td.desc(v).save; reDraw()})} /span) For my own brain to try and break it down, I have : private def desc(td: ToDo, reDraw: () = JsCmd) = { val myFunctionLiteral = (xxx: String) = {td.desc(xxx).save; println(!Desc function : + xxx); reDraw()} swappable(span{td.desc}/span, span{ajaxText(td.desc, myFunctionLiteral)}/span) } This is called from the doList method : private def doList(reDraw: () = JsCmd)(html: NodeSeq): NodeSeq = toShow. flatMap(td = bind(todo, html, desc - desc(td, reDraw) )) I understand where the ToDo object td is coming from, and how the reDraw thing works, and how they are passed to the desc function, but what I don't understand at all is where the val xxx in myFunctionLiteral comes from ? How is it passed into the function ? Is it currying ? I'm sorry for such a vague question, I'm totally at sea here. Thankyou for reading this, and for any help you may provide ! Ben -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang --~--~-~--~~~---~--~~ 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: Asynchronous Javascript problem
Hi, I had to replace JsVal(point) with JsVar(point), but when I run it up, I get ReferenceError: Can't find variable: F542198622797IUJ in the browser console. The function in the page looks like this: function sendPointToServer(point) { F542198622797IUJ({'command': 'setPoint', 'params':point}); } I guess I am missing something else? --~--~-~--~~~---~--~~ 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: radio input trouble
Thanks marius for pointing me in the right direction. I nearly got there :) Both of the following work: SHtml.radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ).toForm // Or if you want to override the XHTML output SHtml.radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ).flatMap(c = (span{c.xhtml} {c.key.toString}/span)) Is there a better way to override XHTML output of the ChoiceHolder? Could it be done once somewhere for the whole application? On Jul 30, 9:26 pm, marius d. marius.dan...@gmail.com wrote: How about : SHtml.radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ).flatMap(_.xhtml) I haven't tested but SHtml.radiorturns a ChoiceHolde which contains a Seq[ChoiceItem[T]]] ... and ChoiceItem has an xhtml member Br's, Marius On Jul 30, 10:49 pm, george geo...@mattandgeorge.com wrote: I am trying to follow theradioinputexample in the Lift book(s), but I cannot get it to work. Firstly, the example in the book uses this call to the SHtml.radio function SHtml.radio(colorMap.keys.toList, Empty, myColor = colorMap(_)) Using Lift 1.1-SNAPSHOT and Scala 2.7.5 This gives me the error: missing parameter type for expanded function ((x$1) = colorMap(x$1)) colour -radio(colorMap.keys.toList, Empty, myColor = colorMap(_) ) So I change my code to the below: ... var myColor : Color = _ val colorMap = Map(Red - Color.red, White - Color.white, Blue - Color.blue) def renew(xhtml : NodeSeq) : NodeSeq = { bind(form, xhtml, colour -radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ) )} ... But this yields the following error: overloaded method value - with alternatives [T : net.liftweb.util.Bindable](T with net.liftweb.util.Bindable) net.liftweb.util.Helpers.TheBindableBindParam[T] and (Boolean) net.liftweb.util.Helpers.BooleanBindParam and (Long) net.liftweb.util.Helpers.LongBindParam and (Int) net.liftweb.util.Helpers.IntBindParam and (Symbol) net.liftweb.util.Helpers.SymbolBindParam and (Option [scala.xml.NodeSeq])net.liftweb.util.Helpers.OptionBindParam and (net.liftweb.util.Box[scala.xml.NodeSeq]) net.liftweb.util.Helpers.BoxBindParam and ((scala.xml.NodeSeq) = scala.xml.NodeSeq)net.liftweb.util.Helpers.FuncBindParam and (Seq [scala.xml.Node])net.liftweb.util.Helpers.TheBindParam and (scala.xml.Node)net.liftweb.util.Helpers.TheBindParam and (scala.xml.Text)net.liftweb.util.Helpers.TheBindParam and (scala.xml.NodeSeq)net.liftweb.util.Helpers.TheBindParam and (String) net.liftweb.util.Helpers.TheStrBindParam cannot be applied to (net.liftweb.http.SHtml.ChoiceHolder[String]) colour -radio(colorMap.keys.toList, Empty, (a:String) = myColor = colorMap(a) ) Seems like the bind function doesn't like the ChoiceHolder[String] param (?) What am I doing wrong?! --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
Viktor, that was a great explanation, im sure ben will apraciate that kind of teaching =) A follow up question that just made me wonder, what is the diference between val square = (x : Int) = x * x and def square(x:Int):Int = x * x ? On Jul 30, 1:49 pm, Viktor Klang viktor.kl...@gmail.com wrote: Hello Ben! the following: val square = (x:Int) = x * x val square is the equivalent of a final reference in Java. (x : Int) = x * x This constructs a Function instance that takes an Int and returns that Int squared. The equivalent Java code would be something like: interface FunctionR,P //We're ignoring variance here, as to not confuse { public R call(P p); } final FunctionInteger,Integer square = new FunctionInteger,Integer() { public Integer call(Integer i) { return i * i; } } And then you can do: square.call(2) // 4 So, back to Scala: val square = (x : Int) = x * x square(2) // 4 On Thu, Jul 30, 2009 at 9:37 PM, ben b...@primrose.org.uk wrote: Hi, I feel I must apologise for this post ... I've only been doing scala for a week, and lift for 3 days, but I'm stuck. I'm coming from an experienced java background, just struggling with some scala constructs. I feel I understand the basics of lambda and function literals - but I'm blown away by some of the syntax in the lift Getting Started tutorial. For example, given : val mylist = Array(1,2,3) mylist..foreach(v = println(v) Here I understand where v comes from - its each int in the list. In the tutorial (http://liftweb.net/docs/getting_started/ mod_master.htmlhttp://liftweb.net/docs/getting_started/%0Amod_master.html ) there is a function desc (Listing 15) : private def desc(td: ToDo, reDraw: () = JsCmd) = swappable(span{td.desc}/span, span{ajaxText(td.desc, v = {td.desc(v).save; reDraw()})} /span) For my own brain to try and break it down, I have : private def desc(td: ToDo, reDraw: () = JsCmd) = { val myFunctionLiteral = (xxx: String) = {td.desc(xxx).save; println(!Desc function : + xxx); reDraw()} swappable(span{td.desc}/span, span{ajaxText(td.desc, myFunctionLiteral)}/span) } This is called from the doList method : private def doList(reDraw: () = JsCmd)(html: NodeSeq): NodeSeq = toShow. flatMap(td = bind(todo, html, desc - desc(td, reDraw) )) I understand where the ToDo object td is coming from, and how the reDraw thing works, and how they are passed to the desc function, but what I don't understand at all is where the val xxx in myFunctionLiteral comes from ? How is it passed into the function ? Is it currying ? I'm sorry for such a vague question, I'm totally at sea here. Thankyou for reading this, and for any help you may provide ! Ben -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang --~--~-~--~~~---~--~~ 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: Odd XML parsing issue
thx that fixed it - I'd forgotten it was xhtml and not plain html. On Jul 30, 7:45 pm, Mark McBride mark.mcbr...@gmail.com wrote: Fat fingered the paste... change to amp; On Thu, Jul 30, 2009 at 11:15 AM, Ewanehar...@gmail.com wrote: But that looks exactly like I have it... On Jul 30, 7:02 pm, Mark McBride mark.mcbr...@gmail.com wrote: URLs in XML need to be XML Encoded... so try a href=http://www.yahoo.com?a=4b=5;Test/a ---Mark On Thu, Jul 30, 2009 at 10:53 AM, Ewanehar...@gmail.com wrote: Not sure what I have messed up here but if I have a hardcoded link in a template page where the href includes query params the lift runtime stacktraces. As an example a href=http://www.yahoo.com? a=4b=5Test/a blows up - see below. Removing the b=5 and all is well. The doctype is: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; xmlns:lift=http://liftweb.net/; Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009. -- Ewan The stacktrace... div style=border: 1px red solidError locating template /templates- hidden/default.html.br / Message: br / pre java.util.NoSuchElementException scala.RandomAccessSeq$$anon$13.next (RandomAccessSeq.scala:165) scala.xml.parsing.MarkupParser$class.normalizeAttributeValue (MarkupParser.scala:1191) net.liftweb.util.PCDataXmlParser.normalizeAttributeValue (PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.xAttributeValue (MarkupParser.scala:334) net.liftweb.util.PCDataXmlParser.xAttributeValue (PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala: 106) scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365) net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200) net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
[Lift] Re: Getting Started tutorial - not understanding some syntax
On Thu, Jul 30, 2009 at 11:02 PM, DFectuoso santiago1...@gmail.com wrote: Viktor, that was a great explanation, im sure ben will apraciate that kind of teaching =) Well, thank you. A follow up question that just made me wonder, what is the diference between val square = (x : Int) = x * x This creates a final reference to a new function instance and def square(x:Int):Int = x * x This creates a method Now, you can transform a method into a function by adding an underscore after it, like this: def square(x : Int) = x * x val sq = square _ //--- notice the underscore. (I always think of it as detaching the method from an instance) This is what the Scala REPL says: scala def square(x : Int) = x * x square: (Int)Int scala val vsquare = (x : Int) = x * x vsquare: (Int) = Int = function scala val v2square = square _ v2square: (Int) = Int = function scala square(2) res0: Int = 4 scala vsquare(2) res1: Int = 4 scala v2square(2) res2: Int = 4 ? On Jul 30, 1:49 pm, Viktor Klang viktor.kl...@gmail.com wrote: Hello Ben! the following: val square = (x:Int) = x * x val square is the equivalent of a final reference in Java. (x : Int) = x * x This constructs a Function instance that takes an Int and returns that Int squared. The equivalent Java code would be something like: interface FunctionR,P //We're ignoring variance here, as to not confuse { public R call(P p); } final FunctionInteger,Integer square = new FunctionInteger,Integer() { public Integer call(Integer i) { return i * i; } } And then you can do: square.call(2) // 4 So, back to Scala: val square = (x : Int) = x * x square(2) // 4 On Thu, Jul 30, 2009 at 9:37 PM, ben b...@primrose.org.uk wrote: Hi, I feel I must apologise for this post ... I've only been doing scala for a week, and lift for 3 days, but I'm stuck. I'm coming from an experienced java background, just struggling with some scala constructs. I feel I understand the basics of lambda and function literals - but I'm blown away by some of the syntax in the lift Getting Started tutorial. For example, given : val mylist = Array(1,2,3) mylist..foreach(v = println(v) Here I understand where v comes from - its each int in the list. In the tutorial (http://liftweb.net/docs/getting_started/ mod_master.html http://liftweb.net/docs/getting_started/%0Amod_master.html ) there is a function desc (Listing 15) : private def desc(td: ToDo, reDraw: () = JsCmd) = swappable(span{td.desc}/span, span{ajaxText(td.desc, v = {td.desc(v).save; reDraw()})} /span) For my own brain to try and break it down, I have : private def desc(td: ToDo, reDraw: () = JsCmd) = { val myFunctionLiteral = (xxx: String) = {td.desc(xxx).save; println(!Desc function : + xxx); reDraw()} swappable(span{td.desc}/span, span{ajaxText(td.desc, myFunctionLiteral)}/span) } This is called from the doList method : private def doList(reDraw: () = JsCmd)(html: NodeSeq): NodeSeq = toShow. flatMap(td = bind(todo, html, desc - desc(td, reDraw) )) I understand where the ToDo object td is coming from, and how the reDraw thing works, and how they are passed to the desc function, but what I don't understand at all is where the val xxx in myFunctionLiteral comes from ? How is it passed into the function ? Is it currying ? I'm sorry for such a vague question, I'm totally at sea here. Thankyou for reading this, and for any help you may provide ! Ben -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
Hi Viktor, Thanks for your reply. I do understand the simple examples, like the one you were kind enough to post. My problem is that I just can't seem to break through from the simple examples to the code in the Getting Started tutorial To elaborate, given the following in a scala console : scala val square = (x : Int) = x * x square: (Int) = Int = function scala square(2) res5: Int = 4 I can easily (in my mind) see how that function literal works - ie function square takes an int and apply(s) a square on the value passed in. In my mind I can see where x is coming from - its clearly the value 2 passed in the operation square(2) - but I just don't get where the string xxx (in the code posted (from the tutorial - see Listing 15) is actually coming from ... there never seems to be the string passed to the function ! --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
(If I've understood your question correctly) the definition of ajaxText is as follows: def ajaxText(value: String, func: String = JsCmd): Elem = ajaxText_*(value, Empty, SFuncHolder(func)) So what you're doing is that you're sending a callback function to ajaxText, and it will be called with a String later. On Thu, Jul 30, 2009 at 11:03 PM, ben b...@primrose.org.uk wrote: Hi Viktor, Thanks for your reply. I do understand the simple examples, like the one you were kind enough to post. My problem is that I just can't seem to break through from the simple examples to the code in the Getting Started tutorial To elaborate, given the following in a scala console : scala val square = (x : Int) = x * x square: (Int) = Int = function scala square(2) res5: Int = 4 I can easily (in my mind) see how that function literal works - ie function square takes an int and apply(s) a square on the value passed in. In my mind I can see where x is coming from - its clearly the value 2 passed in the operation square(2) - but I just don't get where the string xxx (in the code posted (from the tutorial - see Listing 15) is actually coming from ... there never seems to be the string passed to the function ! -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
Hi, Thanks for patience (and for the interesting subpost on the diff between val def) ! OK, the callback thing you suggested is starting to clear the mist ... I found this article : http://www.ibm.com/developerworks/java/library/j-scala01228.html I've not had time to read it fully yet, as its getting late over here in the UK, but it looks like what I'm after. I'll have a proper read tomorrow. Thanks again for your time. Ben --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
Here's a short example: val add = (a : Int, b : Int) = a + b val sub = (a : Int, b : Int) = a - b val div = (a : Int, b : Int) = a / b val mul = (a : Int, b : Int) = a * b //This is a method that takes an Int a, an Int b and a function that takes 2 Ints and produces an Int def doMath(a : Int, b : Int, arith : (Int,Int) = Int) = arith(a,b) scala doMath(1,2,add) res1: Int = 3 scala doMath(1,2,sub) res2: Int = -1 scala doMath(2,1,div) res3: Int = 2 scala doMath(1,2,mul) res4: Int = 2 On Thu, Jul 30, 2009 at 11:36 PM, ben b...@primrose.org.uk wrote: Hi, Thanks for patience (and for the interesting subpost on the diff between val def) ! OK, the callback thing you suggested is starting to clear the mist ... I found this article : http://www.ibm.com/developerworks/java/library/j-scala01228.html I've not had time to read it fully yet, as its getting late over here in the UK, but it looks like what I'm after. I'll have a proper read tomorrow. Thanks again for your time. Ben -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
But you can also create and pass a function inline: scala doMath(1,2,(a : Int, b : Int) = a ^ b) res5: Int = 3 On Thu, Jul 30, 2009 at 11:43 PM, Viktor Klang viktor.kl...@gmail.comwrote: Here's a short example: val add = (a : Int, b : Int) = a + b val sub = (a : Int, b : Int) = a - b val div = (a : Int, b : Int) = a / b val mul = (a : Int, b : Int) = a * b //This is a method that takes an Int a, an Int b and a function that takes 2 Ints and produces an Int def doMath(a : Int, b : Int, arith : (Int,Int) = Int) = arith(a,b) scala doMath(1,2,add) res1: Int = 3 scala doMath(1,2,sub) res2: Int = -1 scala doMath(2,1,div) res3: Int = 2 scala doMath(1,2,mul) res4: Int = 2 On Thu, Jul 30, 2009 at 11:36 PM, ben b...@primrose.org.uk wrote: Hi, Thanks for patience (and for the interesting subpost on the diff between val def) ! OK, the callback thing you suggested is starting to clear the mist ... I found this article : http://www.ibm.com/developerworks/java/library/j-scala01228.html I've not had time to read it fully yet, as its getting late over here in the UK, but it looks like what I'm after. I'll have a proper read tomorrow. Thanks again for your time. Ben -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang --~--~-~--~~~---~--~~ 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: Wymeditor or FCKEditor
I used TinyMCE and it integrated pretty well. It has a jQuery plugin that makes it pretty jQuery-ish: $(#my-textarea) .tinymce({ script_url: /classpath/tiny_mce/ tiny_mce.js, ... }); -Ross On Jul 30, 2009, at 4:47 PM, marius d. wrote: Please specify the problems you are seeing. Br's, Marius On Jul 30, 11:24 pm, Avo Reid avor...@cox.net wrote: Has anyone tried to use wymeditor or FCKEditor in a lift page? I cannot get these plugins to work even thought they are based on JQuery. --~--~-~--~~~---~--~~ 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: Getting Started tutorial - not understanding some syntax
On Thu, Jul 30, 2009 at 12:37 PM, ben b...@primrose.org.uk wrote: Hi, I feel I must apologise for this post ... I've only been doing scala for a week, and lift for 3 days, but I'm stuck. I'm coming from an experienced java background, just struggling with some scala constructs. I feel I understand the basics of lambda and function literals - but I'm blown away by some of the syntax in the lift Getting Started tutorial. For example, given : val mylist = Array(1,2,3) mylist..foreach(v = println(v) Here I understand where v comes from - its each int in the list. In the tutorial (http://liftweb.net/docs/getting_started/ mod_master.htmlhttp://liftweb.net/docs/getting_started/%0Amod_master.html ) there is a function desc (Listing 15) : private def desc(td: ToDo, reDraw: () = JsCmd) = swappable(span{td.desc}/span, span{ajaxText(td.desc, v = {td.desc(v).save; reDraw()})} /span) For my own brain to try and break it down, I have : private def desc(td: ToDo, reDraw: () = JsCmd) = { val myFunctionLiteral = (xxx: String) = {td.desc(xxx).save; println(!Desc function : + xxx); reDraw()} swappable(span{td.desc}/span, span{ajaxText(td.desc, myFunctionLiteral)}/span) } This is called from the doList method : private def doList(reDraw: () = JsCmd)(html: NodeSeq): NodeSeq = toShow. flatMap(td = bind(todo, html, desc - desc(td, reDraw) )) I understand where the ToDo object td is coming from, and how the reDraw thing works, and how they are passed to the desc function, but what I don't understand at all is where the val xxx in myFunctionLiteral comes from ? Your myFuncionLiteral is passed as a parameter to ajaxText. When the ajaxText box is submitted by the user, your function is applied to the String typed by the user. This is a common pattern in Lift... associate a function on the server with an HTML element on the client. That way, Lift abstracts away the HTTP request/response cycle and allows you to focus on what happens when the user does something? How is it passed into the function ? Is it currying ? I'm sorry for such a vague question, I'm totally at sea here. Thankyou for reading this, and for any help you may provide ! Ben -- 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: H2 mapper problem
On Thu, Jul 30, 2009 at 12:51 PM, Tim N tnell...@gmail.com wrote: This issue has been entered. (40) I was able to narrow it down to only being a problem if a user/ password are specified. I'm not sure if a user/password are needed in embedded mode, but I filed the issue anyway. Cool and in the future, please use this forum (not private messages on GitHub or other means) to alert the Lift team of things. Thanks On Jul 30, 12:51 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Please create a ticket with a reproduceable example athttp:// github.com/dpp/liftweb/issues It might be best to forkhttp:// github.com/dpp/lift_1_1_sample/tree/masterin order to create a reproduceable example. On Thu, Jul 30, 2009 at 10:47 AM, Tim N tnell...@gmail.com wrote: I am using an H2 database for my lift app. If I start with a clean database and let schemifier create the tables, the tables get created ok, but then I get a java.util.NoSuchElementException: key not found: fsite_users where fsite_users is my User table. The table is created and the app runs fine after ward. If I set schemifier to only validate the db, I get the same error, so it seems to me like it's the code that tries to verify the schema is where the problem lies. I thought it might be a case issue, so I tried it with all uppercase table names, but I got the same problem. I also tried this with various versions of lift. Any Ideas? OS: Ubuntu 9.04 Scala: 2.7.5 Lift: 1.1-SNAPSHOT H2: 1.1.116 Here is the log: [info] == jetty-run == 2009-07-30 12:10:29.875::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [info] jetty-7.0.0.pre5 [info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet INFO - CREATE TABLE fsite_users (id BIGINT NOT NULL AUTO_INCREMENT , firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw VARCHAR(48) , password_slt VARCHAR(20) , superuser BOOLEAN , validated BOOLEAN , uniqueid VARCHAR(32)) INFO - CREATE TABLE fsite_user_ext_sess (id BIGINT NOT NULL AUTO_INCREMENT , experation BIGINT , userid VARCHAR(64) , cookieid VARCHAR(32)) INFO - CREATE TABLE fsite_flm_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , hidden BOOLEAN , active BOOLEAN) INFO - CREATE TABLE fsite_flm_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT) INFO - CREATE TABLE fsite_flm_owners (id BIGINT NOT NULL AUTO_INCREMENT , user_id BIGINT , hidden BOOLEAN , commissioner BOOLEAN , team_id BIGINT) INFO - CREATE TABLE fsite_sports (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT) INFO - CREATE TABLE fsite_sport_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , sport_id BIGINT , abbr VARCHAR(12) , currentseason INTEGER) INFO - CREATE TABLE fsite_sport_players (id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , firstname VARCHAR(32) , lastname VARCHAR(32) , namesuffix VARCHAR(3) , middlename VARCHAR(32)) INFO - CREATE TABLE fsite_sport_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , abbr VARCHAR(12)) ERROR - Failed to Boot java.util.NoSuchElementException: key not found: fsite_users at scala.collection.Map$class.default(Map.scala:169) at scala.collection.mutable.HashMap.default(HashMap.scala:33) at scala.collection.Map$class.apply(Map.scala:80) at scala.collection.mutable.HashMap.apply(HashMap.scala:33) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$$using (Schemifier.scala:43) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 189) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 184) at scala.List.flatMap(List.scala:1132) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$ $ensureColumns(Schemifier.scala:183) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at scala.List.foldLeft(List.scala:1066) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:54) at net.liftweb.mapper.DB$.use(DB.scala:317) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36) at bootstrap.liftweb.Boot.boot(Boot.scala:62) at
[Lift] Re: Asynchronous Javascript problem
On Thu, Jul 30, 2009 at 1:51 PM, Channing Walton channingwal...@mac.comwrote: Hi, I had to replace JsVal(point) with JsVar(point), but when I run it up, I get ReferenceError: Can't find variable: F542198622797IUJ in the browser console. The function in the page looks like this: function sendPointToServer(point) { F542198622797IUJ({'command': 'setPoint', 'params':point}); } I guess I am missing something else? Are you putting the result of: Script(Function(sendPointToServer, point, PointHandler.call(setPoint, JsVal(point Anywhere on your page? -- 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: Getting Started tutorial - not understanding some syntax
On Thu, Jul 30, 2009 at 2:02 PM, DFectuoso santiago1...@gmail.com wrote: Viktor, that was a great explanation, im sure ben will apraciate that kind of teaching =) A follow up question that just made me wonder, what is the diference between val square = (x : Int) = x * x and def square(x:Int):Int = x * x Scala has two core things: Objects and Methods. In the first example, we create an instance of an object which implements the Function1[Int, Int]. You can call the apply() method on square either by using square.apply(2) or square(2). The latter syntax is expanded to the former by the compiler. The second example is a method definition. The method is defined on a class and called on an instance of the class. Methods can take type parameters. Functions have their type parameter defined at instantiation time. ? On Jul 30, 1:49 pm, Viktor Klang viktor.kl...@gmail.com wrote: Hello Ben! the following: val square = (x:Int) = x * x val square is the equivalent of a final reference in Java. (x : Int) = x * x This constructs a Function instance that takes an Int and returns that Int squared. The equivalent Java code would be something like: interface FunctionR,P //We're ignoring variance here, as to not confuse { public R call(P p); } final FunctionInteger,Integer square = new FunctionInteger,Integer() { public Integer call(Integer i) { return i * i; } } And then you can do: square.call(2) // 4 So, back to Scala: val square = (x : Int) = x * x square(2) // 4 On Thu, Jul 30, 2009 at 9:37 PM, ben b...@primrose.org.uk wrote: Hi, I feel I must apologise for this post ... I've only been doing scala for a week, and lift for 3 days, but I'm stuck. I'm coming from an experienced java background, just struggling with some scala constructs. I feel I understand the basics of lambda and function literals - but I'm blown away by some of the syntax in the lift Getting Started tutorial. For example, given : val mylist = Array(1,2,3) mylist..foreach(v = println(v) Here I understand where v comes from - its each int in the list. In the tutorial (http://liftweb.net/docs/getting_started/ mod_master.html http://liftweb.net/docs/getting_started/%0Amod_master.html ) there is a function desc (Listing 15) : private def desc(td: ToDo, reDraw: () = JsCmd) = swappable(span{td.desc}/span, span{ajaxText(td.desc, v = {td.desc(v).save; reDraw()})} /span) For my own brain to try and break it down, I have : private def desc(td: ToDo, reDraw: () = JsCmd) = { val myFunctionLiteral = (xxx: String) = {td.desc(xxx).save; println(!Desc function : + xxx); reDraw()} swappable(span{td.desc}/span, span{ajaxText(td.desc, myFunctionLiteral)}/span) } This is called from the doList method : private def doList(reDraw: () = JsCmd)(html: NodeSeq): NodeSeq = toShow. flatMap(td = bind(todo, html, desc - desc(td, reDraw) )) I understand where the ToDo object td is coming from, and how the reDraw thing works, and how they are passed to the desc function, but what I don't understand at all is where the val xxx in myFunctionLiteral comes from ? How is it passed into the function ? Is it currying ? I'm sorry for such a vague question, I'm totally at sea here. Thankyou for reading this, and for any help you may provide ! Ben -- Viktor Klang Rogue Scala-head Blog: klangism.blogspot.com Twttr: viktorklang -- 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] Transactions with Mappers
Is it possible, can someone point me to an example. Cheers Jono --~--~-~--~~~---~--~~ 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] New Mapped Fields (MappedTimestamp and MappedMac)
Hi all, As some of you may have noticed, I have been playing around with timestamps[1] and mac addresses[2] in my models. I really like Mapper's specialized fields, both to make it easier for people to read model definitions and to better ensure that only valid values are used along all levels of the service, from the persistence to the presentation layers. So, I would like to propose an effort to develop more specialized fields, starting with MappedTimestamp and MappedMac. I talked to David today and he is willing to provide some advice. Hopefully this will prove a useful way for me to improve my Scala knowledge and contribute to Lift. Focusing just on the two mapped fields I mentioned, do you have any comments how that should be implemented? My thinking is that MappedTimestamp would be stored as a java.util.date and MappedMac as a String, converting both of them to Longs for the database in the interest of saving space. Are there any other mapped fields you'd like to see? I'll add that I think using the units compiler plugin[3] looks cool[4] but probably would be considered to create an unacceptable dependency. Peter Robinett [1]: http://groups.google.com/group/liftweb/browse_thread/thread/b4bdedfb7c935917 [2]: http://groups.google.com/group/liftweb/browse_thread/thread/41650fc1eb0098bd [3]: https://lampsvn.epfl.ch/trac/scala/browser/compiler-plugins/units/trunk [4]: http://www.michaelnygard.com/blog/2009/05/units_of_measure_in_scala.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: New Mapped Fields (MappedTimestamp and MappedMac)
On 07/30/2009 07:53 PM, Peter Robinett wrote: Are there any other mapped fields you'd like to see? I'll be needing a MappedMap in one of my upcoming projects, basically a way of associating keyword/value pairs with my models. I'd really rather avoid the extra overhead of creating models and associations for these pairs, especially since they are never needed outside of the model itself. In the older Merb incarnation of this project, I just dumped the data to JSON and stored it in a text field on the object, kinda a poor man's document database if you will. :) --~--~-~--~~~---~--~~ 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 Mapped Fields (MappedTimestamp and MappedMac)
I've been working on implementing a better Date solution in my apps, and the best one I have found is to use a Long to store the instant in millis, then pass that down the line in response, let JavaScript do all the conversions to display and validations for submission client- side, and then send back millis in a request. It's just an world-wide instant in time, after all, with no time zone (UTC), and I can do all my date math easily with millis. True, it's not human-readable in the database, but so what? True, relying on JS may not be a universal solution, but how many users don't have JavaScript turned on? This approach would fit in well with your idea, being a Long, but I see no need to bring in the Date object at all. Even if you want to let the Java Date do any work, it can still use the millis perfectly, and mySQL strips off the milli-portion of its timestamp data type anyway, which is why it's useless. Walks like a Date, talks like a Date, but it's a milli... On Jul 30, 5:53 pm, Peter Robinett pe...@bubblefoundry.com wrote: Hi all, As some of you may have noticed, I have been playing around with timestamps[1] and mac addresses[2] in my models. I really like Mapper's specialized fields, both to make it easier for people to read model definitions and to better ensure that only valid values are used along all levels of the service, from the persistence to the presentation layers. So, I would like to propose an effort to develop more specialized fields, starting with MappedTimestamp and MappedMac. I talked to David today and he is willing to provide some advice. Hopefully this will prove a useful way for me to improve my Scala knowledge and contribute to Lift. Focusing just on the two mapped fields I mentioned, do you have any comments how that should be implemented? My thinking is that MappedTimestamp would be stored as a java.util.date and MappedMac as a String, converting both of them to Longs for the database in the interest of saving space. Are there any other mapped fields you'd like to see? I'll add that I think using the units compiler plugin[3] looks cool[4] but probably would be considered to create an unacceptable dependency. Peter Robinett [1]:http://groups.google.com/group/liftweb/browse_thread/thread/b4bdedfb7... [2]:http://groups.google.com/group/liftweb/browse_thread/thread/41650fc1e... [3]:https://lampsvn.epfl.ch/trac/scala/browser/compiler-plugins/units/trunk [4]:http://www.michaelnygard.com/blog/2009/05/units_of_measure_in_scala.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] AJAX form with returned NodeSeq
Hey, all, I want to create a form that on submission executes some serverside code that returns a NodeSeq, and then updates the page with that xml. It seems like some combination of AjaxForm and SetHtml should do what I want, but I can't seem to get the server to send a response to the client that can be used to update the html. Is there a lifty way of doing this? Thanks -Cale --~--~-~--~~~---~--~~ 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: Wymeditor or FCKEditor
Adding either editor into default.html template according to examples does not work. In the case of Ckeditor the ckeditor.js file throws exceptions where sample run outside lift page does not. On Jul 30, 4:47 pm, marius d. marius.dan...@gmail.com wrote: Please specify the problems you are seeing. Br's, Marius On Jul 30, 11:24 pm, Avo Reid avor...@cox.net wrote: Has anyone tried to usewymeditoror FCKEditor in a lift page? I cannot get these plugins to work even thought they are based on JQuery. --~--~-~--~~~---~--~~ 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: Wymeditor or FCKEditor
On Thu, Jul 30, 2009 at 7:39 PM, Avo Reid avor...@cox.net wrote: Adding either editor into default.html template according to examples does not work. In the case of Ckeditor the ckeditor.js file throws exceptions where sample run outside lift page does not. It's likely that the editors are not emitting well formed XHTML and that's causing the problems. Please run one or both in Firefox using Firebug and let's see if the exceptions are happening in some assignment to innerHTML. On Jul 30, 4:47 pm, marius d. marius.dan...@gmail.com wrote: Please specify the problems you are seeing. Br's, Marius On Jul 30, 11:24 pm, Avo Reid avor...@cox.net wrote: Has anyone tried to usewymeditoror FCKEditor in a lift page? I cannot get these plugins to work even thought they are based on JQuery. -- 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: Transactions with Mappers
DB.use(DefaultConnectionIdentifier) { ... your transaction goes here } On Thu, Jul 30, 2009 at 5:46 PM, Jonathan Ferguson j...@spiralarm.comwrote: Is it possible, can someone point me to an example. Cheers Jono -- 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: AJAX form with returned NodeSeq
On Thu, Jul 30, 2009 at 7:28 PM, Calen Pennington calen.penning...@gmail.com wrote: Hey, all, I want to create a form that on submission executes some serverside code that returns a NodeSeq, and then updates the page with that xml. It seems like some combination of AjaxForm and SetHtml should do what I want, but I can't seem to get the server to send a response to the client that can be used to update the html. Is there a lifty way of doing this? ajaxButton(bPress me/b, () = SetHtml(myspan, spanThe time is {new java.util.Date}/span)) Thanks -Cale -- 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: Stamped Trait question
Thank you very much. It works great now :) On 30 Jul., 04:43, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jul 29, 2009 at 5:54 PM, fbettag fr...@bett.ag wrote: Now the last and final question: how would i go about and add this to the trait: object test extends MappedBoolean(this) ? You can't add this to a MetaMapper trait, it must be part of a trait that's mixed into the Mapper. Look for the implementation of IdPK and you'll have the right pattern. i tried: private val thisTyped = this.asInstanceOf[A] object published extends MappedBoolean(thisTyped) and just this and self. Any ideas? On 30 Jul., 02:46, fbettag fr...@bett.ag wrote: And the final version: trait Stamped[A : LongKeyedMapper[A] with IdPK] extends KeyedMetaMapper[Long, A] { self: A with MetaMapper[A] with KeyedMapper[Long, A] = override def afterSave = (createLog(_: A, create)) :: super.afterSave override def afterUpdate = (createLog(_: A, update)) :: super.afterUpdate override def afterDelete = (createLog(_: A, delete)) :: super.afterDelete private def createLog(obj: A, action: String) = { val log = new ActionLog log.action(action).klass(obj.getClass.toString).record( obj.id).save } } On 30 Jul., 02:19, fbettag fr...@bett.ag wrote: Okay i got this so far, only one tiny thing i can't get to work now: trait Stamped[A : LongKeyedMapper[A]] extends KeyedMetaMapper[Long, A] { self: A with MetaMapper[A] with KeyedMapper[Long, A] = private val thisTyped = this.asInstanceOf[MapperType] override def afterSave = createSaveLog _ :: super.afterSave override def afterUpdate = createUpdateLog _ :: super.afterSave override def afterDelete = createDeleteLog _ :: super.afterSave private def createSaveLog(obj: A) = createLog(obj, create) private def createUpdateLog(obj: A) = createLog(obj, update) private def createDeleteLog(obj: A) = createLog(obj, delete) private def createLog(obj: A, action: String) { val log = new ActionLog log.action(action).klass(obj.getClass.toString).record( obj.id).save } } The problem relies in the last method called. log.action... at obj.id. Where do i have to define that A (obj) is with IdPK? After that this should be working. Ah one scala syntax question. why can't i call createLog(_, create) at the List? On 30 Jul., 01:22, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jul 29, 2009 at 4:21 PM, fbettag fr...@bett.ag wrote: Btw. the docs for KeyedMapper don't work.. http://scala-tools.org/scaladocs/liftweb/1.0/net/liftweb/mapper/Keyed... when i click on KeyType or OwnerType it gives me a 404.. This is a limitation of vscaladoc... sorry. On 30 Jul., 00:55, David Pollak feeder.of.the.be...@gmail.com wrote: It's not pretty, but: trait MyLogger[A : KeyedMapper[K, A], K] extends KeyedMetaMapper[K,A] { self: A with MetaMapper[A] with KeyedMapper[K, A] = override def afterSave = doSomething _ :: super.afterSave private def doSomething(in: A) { println(Got +in) } } On Wed, Jul 29, 2009 at 3:35 PM, fbettag fr...@bett.ag wrote: Hm. i changed it to this: trait Stamped[OwnerType : Mapper[OwnerType] with IdPK] { self: MetaMapper[OwnerType] = private val thisTyped = this.asInstanceOf[MapperType] override def afterSave: List[Any] = { createActionLog(create, this.getClass.toString, thisTyped.id) return List(None) } def afterUpdate: List[Any] = { createActionLog(update, this.getClass.toString, thisTyped.id) return List(None) } def beforeDelete: List[Any] = { createActionLog(delete, this.getClass.toString, thisTyped.id) return List(None) } private def createActionLog(action: String, klass: String, obj: Long) { val log = new ActionLog log.action(action).klass(klass).record(obj).save } } and i extend the object now and not the class. still i get these: src/main/scala/ag/bett/lift/cms/lib/Stamped.scala:12: error: method afterSave overrides nothing override def afterSave: List[Any] = { ^ method afterSave in trait Stamped of type = List[Any] needs `override' modifier object Content extends Content with
[Lift] Re: Wymeditor or FCKEditor
Here is some more specific code I should be able to include wymeditor.js in a lift page and add the following. The wymeditor doesn't come up it faults and a textarea comes up. If I include the same code in a non lift web page, even like a menu item in the sitemap to a page outside of the lift website the code works. div class=column span-24 id=editor h1WYMeditor integration example/h1 pa href=http://www.wymeditor.org/;WYMeditor/a is a web-based XHTML WYSIWYM editor./p form method=post action= textarea class=wymeditorlt;pgt;Hello, World!lt;/ pgt;/textarea input type=submit class=wymupdate / /form /div On Jul 30, 4:47 pm, marius d. marius.dan...@gmail.com wrote: Please specify the problems you are seeing. Br's, Marius On Jul 30, 11:24 pm, Avo Reid avor...@cox.net wrote: Has anyone tried to usewymeditoror FCKEditor in a lift page? I cannot get these plugins to work even thought they are based on JQuery. --~--~-~--~~~---~--~~ 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: Wymeditor or FCKEditor
Lift, by default, serves with a mime type of application/xhtml+xml (except to IE). This puts browsers into a very strict mode for parsing and it means that scripts may not use write to change the DOM. So, what/where is the exception? Are you serving the static page as text/html or application/xhtml+xml ? When I browse to http://files.wymeditor.org/wymeditor/trunk/src/examples/01-basic.html it's served as text/html On Thu, Jul 30, 2009 at 7:52 PM, Avo Reid avor...@cox.net wrote: Here is some more specific code I should be able to include wymeditor.js in a lift page and add the following. The wymeditor doesn't come up it faults and a textarea comes up. If I include the same code in a non lift web page, even like a menu item in the sitemap to a page outside of the lift website the code works. div class=column span-24 id=editor h1WYMeditor integration example/h1 pa href=http://www.wymeditor.org/;WYMeditor/a is a web-based XHTML WYSIWYM editor./p form method=post action= textarea class=wymeditorlt;pgt;Hello, World!lt;/ pgt;/textarea input type=submit class=wymupdate / /form /div On Jul 30, 4:47 pm, marius d. marius.dan...@gmail.com wrote: Please specify the problems you are seeing. Br's, Marius On Jul 30, 11:24 pm, Avo Reid avor...@cox.net wrote: Has anyone tried to usewymeditoror FCKEditor in a lift page? I cannot get these plugins to work even thought they are based on JQuery. -- 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: H2 mapper problem
I think I had the same problem, and if I recall correctly it was because lift wants to use the schema with the same name as the user. Create this schema with the H2 console. I think my code actually uses ;schema=... in the url. - Tim Ntnell...@gmail.com wrote: This issue has been entered. (40) I was able to narrow it down to only being a problem if a user/ password are specified. I'm not sure if a user/password are needed in embedded mode, but I filed the issue anyway. Thanks On Jul 30, 12:51 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Please create a ticket with a reproduceable example athttp://github.com/dpp/liftweb/issues It might be best to forkhttp://github.com/dpp/lift_1_1_sample/tree/masterin order to create a reproduceable example. On Thu, Jul 30, 2009 at 10:47 AM, Tim N tnell...@gmail.com wrote: I am using an H2 database for my lift app. If I start with a clean database and let schemifier create the tables, the tables get created ok, but then I get a java.util.NoSuchElementException: key not found: fsite_users where fsite_users is my User table. The table is created and the app runs fine after ward. If I set schemifier to only validate the db, I get the same error, so it seems to me like it's the code that tries to verify the schema is where the problem lies. I thought it might be a case issue, so I tried it with all uppercase table names, but I got the same problem. I also tried this with various versions of lift. Any Ideas? OS: Ubuntu 9.04 Scala: 2.7.5 Lift: 1.1-SNAPSHOT H2: 1.1.116 Here is the log: [info] == jetty-run == 2009-07-30 12:10:29.875::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [info] jetty-7.0.0.pre5 [info] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet INFO - CREATE TABLE fsite_users (id BIGINT NOT NULL AUTO_INCREMENT , firstname VARCHAR(32) , lastname VARCHAR(32) , email VARCHAR(48) , locale VARCHAR(16) , timezone VARCHAR(32) , password_pw VARCHAR(48) , password_slt VARCHAR(20) , superuser BOOLEAN , validated BOOLEAN , uniqueid VARCHAR(32)) INFO - CREATE TABLE fsite_user_ext_sess (id BIGINT NOT NULL AUTO_INCREMENT , experation BIGINT , userid VARCHAR(64) , cookieid VARCHAR(32)) INFO - CREATE TABLE fsite_flm_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , hidden BOOLEAN , active BOOLEAN) INFO - CREATE TABLE fsite_flm_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT) INFO - CREATE TABLE fsite_flm_owners (id BIGINT NOT NULL AUTO_INCREMENT , user_id BIGINT , hidden BOOLEAN , commissioner BOOLEAN , team_id BIGINT) INFO - CREATE TABLE fsite_sports (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT) INFO - CREATE TABLE fsite_sport_leagues (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , sport_id BIGINT , abbr VARCHAR(12) , currentseason INTEGER) INFO - CREATE TABLE fsite_sport_players (id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , firstname VARCHAR(32) , lastname VARCHAR(32) , namesuffix VARCHAR(3) , middlename VARCHAR(32)) INFO - CREATE TABLE fsite_sport_teams (name VARCHAR(32) , id BIGINT NOT NULL AUTO_INCREMENT , league_id BIGINT , abbr VARCHAR(12)) ERROR - Failed to Boot java.util.NoSuchElementException: key not found: fsite_users at scala.collection.Map$class.default(Map.scala:169) at scala.collection.mutable.HashMap.default(HashMap.scala:33) at scala.collection.Map$class.apply(Map.scala:80) at scala.collection.mutable.HashMap.apply(HashMap.scala:33) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$$anonfun$6$$anonfun$apply$7.apply (Schemifier.scala:189) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$$using (Schemifier.scala:43) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 189) at net.liftweb.mapper.Schemifier$$anonfun$6.apply(Schemifier.scala: 184) at scala.List.flatMap(List.scala:1132) at net.liftweb.mapper.Schemifier$.net$liftweb$mapper$Schemifier$ $ensureColumns(Schemifier.scala:183) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1$$anonfun$2.apply (Schemifier.scala:61) at scala.List.foldLeft(List.scala:1066) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:61) at net.liftweb.mapper.Schemifier$$anonfun$schemify$1.apply (Schemifier.scala:54) at net.liftweb.mapper.DB$.use(DB.scala:317) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:53) at net.liftweb.mapper.Schemifier$.schemify(Schemifier.scala:36) at bootstrap.liftweb.Boot.boot(Boot.scala:62) at
[Lift] Re: Odd XML parsing issue
Maybe he meant to write it out as an entity (-amp-;) and the email software or the browser made it back into an ampersand. - Ewanehar...@gmail.com wrote: But that looks exactly like I have it... On Jul 30, 7:02 pm, Mark McBride mark.mcbr...@gmail.com wrote: URLs in XML need to be XML Encoded... so try a href=http://www.yahoo.com?a=4b=5;Test/a ---Mark On Thu, Jul 30, 2009 at 10:53 AM, Ewanehar...@gmail.com wrote: Not sure what I have messed up here but if I have a hardcoded link in a template page where the href includes query params the lift runtime stacktraces. As an example a href=http://www.yahoo.com? a=4b=5Test/a blows up - see below. Removing the b=5 and all is well. The doctype is: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; xmlns:lift=http://liftweb.net/; Running Liftversion1.1-SNAPSHOT built on Thu Jul 30 18:14:47 BST 2009. -- Ewan The stacktrace... div style=border: 1px red solidError locating template /templates- hidden/default.html.br / Message: br / pre java.util.NoSuchElementException scala.RandomAccessSeq$$anon$13.next (RandomAccessSeq.scala:165) scala.xml.parsing.MarkupParser$class.normalizeAttributeValue (MarkupParser.scala:1191) net.liftweb.util.PCDataXmlParser.normalizeAttributeValue (PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.xAttributeValue (MarkupParser.scala:334) net.liftweb.util.PCDataXmlParser.xAttributeValue (PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser.xAttributes(PCDataMarkupParser.scala: 106) scala.xml.parsing.MarkupParser$class.xTag(MarkupParser.scala:365) net.liftweb.util.PCDataXmlParser.xTag(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:667) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.element1(MarkupParser.scala:682) net.liftweb.util.PCDataXmlParser.element1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content1(MarkupParser.scala:481) net.liftweb.util.PCDataXmlParser.content1(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.content(MarkupParser.scala:505) net.liftweb.util.PCDataXmlParser.content(PCDataMarkupParser.scala:91) scala.xml.parsing.MarkupParser$class.document(MarkupParser.scala:200) net.liftweb.util.PCDataXmlParser.document(PCDataMarkupParser.scala:91) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply$5$ $anonfun$apply$6.apply(PCDataMarkupParser.scala:181) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:40) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.ControlHelpers$class.tryo(ControlHelpers.scala:55) net.liftweb.util.Helpers$.tryo(Helpers.scala:29) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply $5.apply(PCDataMarkupParser.scala:181) net.liftweb.util.PCDataXmlParser$$anonfun$apply$2$$anonfun$apply
[Lift] Re: Simple Javascript question(from a lift snippet of course...)
Related question - if there are multiple head sections buried in different places in the xml are they all removed and combined? - marius d.marius.dan...@gmail.com wrote: Well assume you snippet returns a NodeSeq: import net.liftweb.http._ import js._ import JE._ import JsCmds._ def myFunc(xml: NodeSeq): NodeSeq = { ... resultingNode ++ head{Script(OnLoad(Call(myStartupFunction)))}/ head } In the above example we are returning a head node as well which will be merged by Lift automatically in the real page head. Then I'm using Lift's JavaScript abstractions to call on load function myStartupFunction. Instead of head{Script(OnLoad(Call(myStartupFunction)))}/head you can also use head script type=text/javascript charset=utf-8{ Unparsed( jQuery(document).ready(function() { myStartupFunction(); }) ) } /head Br's, Marius On Jul 30, 8:13 am, DFectuoso santiago1...@gmail.com wrote: This is probably trivial but can't seem to find the lifty way... without hand rolling javascript What is the best way to generate(in the snippet) a javascript command to be run on the window.onload event? Thank you very much you divine and infinite source or lift knowledge AKA lift google group =) --~--~-~--~~~---~--~~ 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: Automatic background AJAX: best way to do it?
Does doubling the brace escape it? Also you could build the string parts outside of the xml and then embed them. - Nolan Darilekno...@thewordnerd.info wrote: On 07/28/2009 07:28 PM, David Pollak wrote: I'd do the REST API thing. The mechanisms that Lift has for handling API calls from the browser are numerous, but they are associated with a session (you can do ajaxCall or a S.buildJsonFunc). Oh cool. When I listened to the podcast interview and heard about fast-pathing AJAX calls, I realized that this was exactly what I wanted, and that there wasn't a need to create a separate URL space just to accomodate this page update functionality--at least, not explicitly in the sense of what I meant by API. Neat. Thanks for the method pointers, too, that helped me focus my reading a bit. So here's what I have. I have this JS code as an interface to the geolocation API: function Location() { this.lat = 0; this.lon = 0; this.update = function(lat, lon) { this.lat = lat; this.lon = lon; this.onUpdate(lat, lon); }; this.onUpdate = function(lat, lon) {}; } var loc = new Location(); Next I wrote a snippet which needs to set loc.onUpdate to a function that calls into Lift to update the page. I have: class Geolocation { def updatePosition(pos:String):JsCmd = Alert(Got an update: +pos) def update(in:NodeSeq):NodeSeq = script type=text/javascript loc.onUpdate = function(lat, lon) { {SHtml.ajaxCall(JsObj(lat - JsVar(lat), lon - JsVar(lon)), updatePosition _)._2} }; /script } Two issues here. First, how do I get those braces around the JS function containing the ajaxCall into my HTML? Seems like there should be a way to escape braces so I can include them in NodeSeq, but \{ didn't seem to do it. I'm also quite new to JS as well, so perhaps there's a better way to set that callback. All I can come up with is changing the callback signature to accept an object rather than individual values so perhaps I can set it directly to the Lift-generated function, but I think I'd rather have raw values for individual position components for now. 2. Ideally, I'd like for the JsObj to be an actual Map[String, Float]. Is there a way to do this? An included JSON parser that'd convert the string to a type I specify, perhaps? (assuming I'd have to give some sort of hint for Float vs. other numeric types, anyway) Thanks. Wow, this really makes AJAX development something I'd actually enjoy doing. :) --~--~-~--~~~---~--~~ 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 Mapped Fields (MappedTimestamp and MappedMac)
Maybe I'm missing something that was said, but why can't MappedTimestamp extend MappedDate(Time)? Or better yet, provide a trait to mix in with either of the above? - Peter Robinettpe...@bubblefoundry.com wrote: Hi all, As some of you may have noticed, I have been playing around with timestamps[1] and mac addresses[2] in my models. I really like Mapper's specialized fields, both to make it easier for people to read model definitions and to better ensure that only valid values are used along all levels of the service, from the persistence to the presentation layers. So, I would like to propose an effort to develop more specialized fields, starting with MappedTimestamp and MappedMac. I talked to David today and he is willing to provide some advice. Hopefully this will prove a useful way for me to improve my Scala knowledge and contribute to Lift. Focusing just on the two mapped fields I mentioned, do you have any comments how that should be implemented? My thinking is that MappedTimestamp would be stored as a java.util.date and MappedMac as a String, converting both of them to Longs for the database in the interest of saving space. Are there any other mapped fields you'd like to see? I'll add that I think using the units compiler plugin[3] looks cool[4] but probably would be considered to create an unacceptable dependency. Peter Robinett [1]: http://groups.google.com/group/liftweb/browse_thread/thread/b4bdedfb7c935917 [2]: http://groups.google.com/group/liftweb/browse_thread/thread/41650fc1eb0098bd [3]: https://lampsvn.epfl.ch/trac/scala/browser/compiler-plugins/units/trunk [4]: http://www.michaelnygard.com/blog/2009/05/units_of_measure_in_scala.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: User validation by admin
I'm not clear what you're suggesting. Currently there are two methods. sendValidationEmail takes a user and sends him an email. signup has a nested function, testSignup, which (1) sets validated based on skipEmailValidation, and resets uniqueId; (2) if skipEmailValidation log in; otherwise sendEmailValidation. Are you saying to make testSignup an overridable method? Wouldn't something finer-grained be better? - David Pollakfeeder.of.the.be...@gmail.com wrote: Sounds like a worthy addition. I'd suggest that rather that doing more flags that you create a validation function that people can replace with whatever they want... by default that function looks at the current skipEmailValidation flag. On Tue, Jul 28, 2009 at 1:07 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: Hi. I would like to customize the way that user registration is validated by email. For example, require the admin to validate users. Here are some possible approaches: 1. Set skipEmailValidation to true and build the mechanism from scratch in the subclass. 2. Override signup, and implement it similar but different. 3. Add a flag to lift to leave the user NOT validated, but not to send the email. Then either send the email manually, or provide a way for the admin to validate users. 4. Provide a hook to directly specify who the email should go to. What do people think? -- 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: User questions
Should I add a variable to MetaMegaProtoUser var loginRedirect: Box[String], and change login so that if it's Full it will redirect there instead of homePage? (It could reset it to Empty too.) - Naftoli Gugenheimnaftoli...@gmail.com wrote: Using MegaProtoUser, how do you: 1. Have logging in redirect to the page that redirected to log in? 2. Automatically log in using cookies? 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: User questions
Also I could add a method called logInFirst which would return a TestAccess that if the user is logged in returns Empty, and if not sets loginRedirect and returns Full(RedirectResponse(User.loginPageURL)). I am currently using such a TestAccess in one of the top menus (minus the nonexistent lognRedirect). If there's a better way tell me! - Naftoli Gugenheimnaftoli...@gmail.com wrote: Using MegaProtoUser, how do you: 1. Have logging in redirect to the page that redirected to log in? 2. Automatically log in using cookies? 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: Asynchronous Javascript problem
Are you putting the result of: Script(Function(sendPointToServer, point, PointHandler.call(setPoint, JsVal(point Anywhere on your page? I believe so, the page has a snippet: lift:mapSnippet.mapFunctions/ which looks like this: def mapFunctions(xhtml : NodeSeq) : NodeSeq = { val node = Script(Function(sendPointToServer, List(point), PointHandler.call(setPoint, JsVar(point node ++ head{Script(OnLoad(Call(initialize)))}/head } and in the page I see: function sendPointToServer(point) { F542198622797IUJ({'command': 'setPoint', 'params':point}); } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---