[Lift] Re: More dynamic Lift
What's the advantage of this sort of setup over using JavaRebel? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] conflicting slf4j versions when using M3 with smile
Smile (a scala memcached client) is pulling in slf4j-jdk14-1.5.2.jar, and lift-util is pulling in slf4j-log4j12-1.5.11.jar. What is the best way to deal with this conflict? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: conflicting slf4j versions when using M3 with smile
OK, did that (like so in sbt): override def ivyXML = dependencies dependency org=net.lag name=smile rev=0.8.12 exclude module=slf4j-jdk14/ /dependency /dependencies I'm also getting this error when running my app from within sbt just javarebel (possibly this isn't a big issue, but the error is disconcerting): SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/harryh/foursquare.web/ lib_managed/compile/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/ StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/harryh/foursquare.web/target/ webapp/WEB-INF/lib/slf4j-log4j12-1.5.11.jar!/org/slf4j/impl/ StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. On Mar 4, 2:33 pm, Indrajit Raychaudhuri indraj...@gmail.com wrote: You can modify smile dependency declaration to exclude slf4j-jdk14 as thus: dependency groupIdnet.lag/groupId artifactIdsmile/artifactId exclusions exclusion groupIdorg.slf4j/groupId artifactIdslf4j-jdk14/artifactId /exclusion /exclusions /dependency Or alternately, apply the exclusion of slf4j-log4j12 in the lift-util dependency section if you prefer to use slf4j-jdk14 instead. Cheers, Indrajit On 05/03/10 12:51 AM, harryh wrote: Smile (a scala memcached client) is pulling in slf4j-jdk14-1.5.2.jar, and lift-util is pulling in slf4j-log4j12-1.5.11.jar. What is the best way to deal with this conflict? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: conflicting slf4j versions when using M3 with smile
Hmm, slf4j-log4j12-1.5.11.jar ends up being in the classpath twice (from /Users/harryh/foursquare.web/lib_managed/compile and /Users/harryh/foursquare.web/target/webapp/WEB-INF/lib). A quick fix would be to apply exclusion of slf4j-log4j12 in lift-util declaration. This will prevent having slf4j-log4j12-1.5.11.jar under target/webapp/WEB-INF/lib. Then I don't get slf4j-log4j12 at all and I get exceptions: java.lang.NoClassDefFoundError: org/apache/log4j/Logger at net.liftweb.util.LogBoot$.net$liftweb$util$LogBoot$ $_logger(Log.scala:207) at net.liftweb.util.LogBoot$$anonfun$6.apply(Log.scala:209) at net.liftweb.util.LogBoot$$anonfun$6.apply(Log.scala:209) at net.liftweb.util.Log$.rootLogger(Log.scala:85) at net.liftweb.util.Log$.warn(Log.scala:123) at net.liftweb.http.LiftServlet.service(LiftServlet.scala:89) Maybe this is a weird SBT problem? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: conflicting slf4j versions when using M3 with smile
I tend to think the underlying problem (two slf4j-log4j12 jars on the classpath) is in SBT, so maybe you should ask on the sbt list. Ya, I'm pretty sure you're right. I posted there: http://groups.google.com/group/simple-build-tool/browse_thread/thread/4d088713c85dbdb -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Add lock() to MetaMapper
Sent this to dpp the other day with the idea that it might be a useful addition to MetaMapper. Would others find this useful? (It's a tad PostgreSQL specific in its current form). object LockMode extends Enumeration { type LockMode = Value val AccessShare = Value(ACCESS SHARE) val RowShare = Value(ROW SHARE) val RowExclusive = Value(ROW EXCLUSIVE) val ShareUpdateExclusive = Value(SHARE UPDATE EXCLUSIVE) val Share = Value(SHARE) val ShareRowExclusive = Value(SHARE ROW EXCLUSIVE) val Exclusive = Value(EXCLUSIVE) val AccessExclusive = Value(ACCESS EXCLUSIVE) } import LockMode._ trait Lockable[T : Mapper[T]] extends MetaMapper[T] { self: T = def lock[T](mode: LockMode)(func: = T) = { DB.use(dbDefaultConnectionIdentifier) { conn = DB.statement(conn)(_.execute(LOCK TABLE +dbTableName+ IN +mode.toString+ MODE)) func } } } -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Potential breaking change: MappedField.name, affects Mapper JSON
If this does happen please take care to include this information in the release notes for M3 (or whatever milestone first has this change) as people using json serialization for caching purposes will need to invalidate their caches. Putting the note in BIG CAPITAL LETTERS might be a good idea. -harryh On Feb 18, 6:22 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: Hi, As part of fixinghttps://www.assembla.com/spaces/liftweb/tickets/155-lift-mapper-%28re... , I would like to change the semantics of MappedField.name slightly: Currently, the name is always lowercased, ie: class SampleModel extends KeyedMapper[Long, SampleModel] { object id extends MappedLongIndex(this) object firstName extends MappedString(this, 32) object moose extends MappedNullableLong(this) object notNull extends MappedString(this, 32) } firstName.name == firstname notNull.name == notnull id.name==id I would like to have name preserve the case of the field such that: firstName.name == firstName notNull.name == notNull id.name==id Reasons: 1) More consistent. css styles, default column headers etc based on name now follows the actual field name 2) Easier to implement #155 :-) name is used when serializing a Mapped object as JSON. So the JSON representation will be changed (unless we lowercase the name only when creating JSON, but this goes against 1) Now: { $persisted:true, id:1, firstname:Elwood, moose:null, notnull: } After proposed change: { $persisted:true, id:1, firstName:Elwood, moose:null, notNull: } I would like to get a feel for the pain this will cause people /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Lift Web Framework 2.0 Milestone 2 released
Huzzah! Gonna push the update out to here soon? http://scala-tools.org/mvnsites/ -harryh On Feb 11, 1:42 pm, Indrajit Raychaudhuri indraj...@gmail.com wrote: The Lift Web Framework team is pleased to announce the framework-2.0- M2 release! Lift is an expressive and elegant framework for writing web applications. Lift stresses the importance of security, maintainability, scalability and performance while allowing for high levels of developer productivity. Lift is a Scala web framework. Changes in this version include: New features: o Multidimensional arrays supported in JSON serialization and extraction Issue: 279. o Enable jQuery version switching in LiftRules Issue: 311. o New LRU Map that works better than Apache LRU map Issue: 293. o Allow thread-local Connection Identerifer resolution Issue: 314. Fixed Bugs: o lift-Json doesn't appear to be correctly handling attributes Issue: 323. o net.liftweb.json.JsonParser.extract fails with List[List[Int]] Issue: 279. o Streamline JDBC library dependencies Issue: 307. o autocomplete widget - make options settable Issue: 46. o Ajax form submission with multiple submit buttons Issue: 280. o Ajax change from () = Any to () = JsCmd Issue: 295. o Add field-by-field error notifications to CRUDified fields Issue: 254. o MappedLongForeignKey::asJsonValue should generate JNull Issue: 282. o Additional tag support for TextileParser Issue: 284. o TextileParser molests divs Issue: 290. o The order of fields is random in Mapper Issue: 308. o How overriding of _showAllTemplate to show a limited number of columns Issue: 315. o Control characters in input can lead to Denial of Service attacks Issue: 319. Changes: o JSON object can be extracted into scala.Map (and scala.Map can be serialized as JSON object). Recursive types can be serialized. Issue: 303. o JSON pull parser API Issue: 333. o Make Lift both Scala 2.7 and 2.8 friendly Issue: 292. o Upgrade jQuery to 1.4.1 Issue: 304. Have fun! -Lift Web Framework team -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: lifecycle callbacks in record
OK kids. Here's a lesson for you. Don't mix Mapper and Record in the same file! Cause if you do, you might do something like this: class MCheckin extends MongoRecord[MCheckin] with MongoId[MCheckin] with LifecycleCallbacks { } and wonder why the #$%^*( the callbacks aren't being called. But then, after 5 hours of tinkering you finally realize that you were implementing the mapper LifecycleCallbacks and not the record LifecycleCallbacks. -harryh On Feb 10, 9:10 pm, harryh har...@gmail.com wrote: Can anyone give me an example of how to implement a lifecycle callback in record? I can't, for the life of me, get it to work. Nor does there appear to be any documentation at all :( -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: lifecycle callbacks in record
Do we have to move the common pieces of Mapper and Record into a common package? We don't have to as I have just changed my code to do with net.lifetweb.record.LifecycleCallbacks and everything is now works fine. It might be worth considering though so no one else has the same problem I did. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: lifecycle callbacks in record
Yeah that would be a bit of a problem!! Out of interest, what Record backend are you trying to use? http://wiki.github.com/eltimn/scamongo/ Which needs some work (I have a fork on my local machine that I'm tinkering with), but mostly seems to be getting the job done. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: lifecycle callbacks in record
Tim (Nelson) You can expect a ping from me about some stuff I've added getting pulled back into the main branch. It's all pretty small. 1) Implemeted bulkDelete_!! 2) Some stuff to make List fields work a bit better when they are a List[DBRecord] 3) Some code for special handling of optional fields (using Box) (don't save anything to the datastore if you have an empty box) 4) A change to DBRef to change the fetch method name to obj (to make it more like MappedForeignKeys) Hopefully you'll like the changes. -harryh On Feb 11, 5:33 pm, Tim Nelson tnell...@gmail.com wrote: At some point I would love to. I'm not sure it's quite ready for that yet though. As soon as I finish the project I'm working on, I hope to be able to spend some more time on it. There are still some things that I haven't implemented and I want to look closer at the code you wrote for couch-db and maybe utilize that. Tim On Thu, Feb 11, 2010 at 4:25 PM, Ross Mellgren dri...@gmail.com wrote: Hey Tim (Nelson), Have you thought about bringing scamongo in as part of Lift? -Ross On Feb 11, 2010, at 5:24 PM, Tim Nelson wrote: You should note that only the save and delete callbacks have been implemented, but I haven't tested them. If you have other requirements, let me know and I can look into it and any feedback is welcome. Tim akahttp://wiki.github.com/eltimn/ On Thu, Feb 11, 2010 at 4:17 PM, harryh har...@gmail.com wrote: Yeah that would be a bit of a problem!! Out of interest, what Record backend are you trying to use? http://wiki.github.com/eltimn/scamongo/ Which needs some work (I have a fork on my local machine that I'm tinkering with), but mostly seems to be getting the job done. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Breaking changes in lift-record 2.0-SNAPSHOT - Optional fields
What is the advantage of doing it this way as opposed to having a collection of Field types who's value is a Box[Whatever] (OptionalStringField, OptionalLongField, etc). I'm finding the e-mail you sent to the list moderately confusing. Maybe it's just that more explanation is needed? -harryh On Feb 11, 11:49 pm, Ross Mellgren dri...@gmail.com wrote: I just committed a change to lift-record in 2.0-SNAPSHOT that will possibly (probably?) break your build if you use it. This change makes it possible to have any record field be optional -- that is, Box[MyType]. You use it like this: object MyRecord extends Record[MyRecord] { object myNormalField extends StringField(this, 100) object myOptionalField extends StringField(this, 100) { override def optional_? = true override def defaultValueBox = Empty override def defaultValue = nothin } } val r: MyRecord r.myNormalField.set(Hello) // as before the change r.myOptionalField.setBox(Empty) r.myNormalField.value == Hello // as before r.myNormalField.valueBox == Full(Hello) r.myOptionalField.valueBox == Empty r.myOptionalField.value == nothin // because defaultValue was used to give back something As part of this change, the semantics for field errors has changed somewhat -- hopefully, to be more consistent. Previously if you tried to set a field and checkCanWrite_? returned false then an internal flag valueCouldNotBeSet on the field will be raised which makes that field generate a validation error when validate is called on the record. In addition, some fields (but not all) would raise the same flag and return Failure or Empty from setFromString or setFromAny upon being given an invalid value. With this change, all types of failure to set now result in the field value becoming a Failure. setFromAny, setFromString, and setBox all return that Failure, while set will return defaultValue (due to its return type.) validators and set filters have had their types changed to Boxed equivalents. And finally, I made consistent the setFromAny methods of all the built-in field types so that they all follow the same contract. For setFromAny it's essentially accept one of MyType, Box[MyType], Option[MyType], or List[MyType] as well as null, with a default to convert an unknown input to string and use setFromString. For setFromString, it is as before, except if the field is optional_? and the empty string is passed in, that's treated as Empty. As I'll mention in another message, I also pushed lift-couchdb to master. I ran the unit tests that I wrote for that, but that doesn't give me full confidence that all the fields are entirely bug free. Similarly I did not test the form generation. If anybody runs into any issues please let me know and I'll fix it as soon as I can. And of course if it causes too much breakage we can revert it back out. -Ross -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] lifecycle callbacks in record
Can anyone give me an example of how to implement a lifecycle callback in record? I can't, for the life of me, get it to work. Nor does there appear to be any documentation at all :( -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: how to set boolean (non-string) value in NodeSeq?
Do it XML style: button disabled=disabled /button On Feb 10, 10:56 pm, wm min...@gmail.com wrote: def seq(): NodeSeq = { button disabled=true /button } it errors out: error: in XML literal: ' or delimited attribute value or '{' scala- expr '}' expected 0 doesn't work either, only string is accepted. Why is there such a restriction? any workaround? Thanks. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Mapper objects deserialized from json have all of their fields marked dirty
At least in my use case this is not idea as I am loading JSON serialized mapper objects from memcached and the fields are not, in fact, dirty. There should possibly be some sort of higher level mechanism that I can use to indicate that this is the case? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Mapper objects deserialized from json have all of their fields marked dirty
- Serializing the dirty-state of each field (e.g., field_name_$dirty: true) This further increases the size of the serialized objects which is not ideal - A thread-local flag for the default dirty/clean - A global flag indicating that the fields are marked clean/dirty on deserialization And these seem no good due to the user of global variables What about option 4: - change the deserialize function to take an extra parameter indicating whether the fields should be marked dirty or not. ? -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] use S and templating without state?
I have a simple web page that is not based on any session state, only on the provided params and the contents of the datastore: http://foursquare.com/iphone/achievements?uid=209cityid=22 Can I serve this page from Lift's statelessDispatchTable and still using templating (and possibly S?) so that no Lift/Jetty session is created when serving this page? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Lift 1.1-M8
Huzzah! Welcome M8! -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] S.attrs question
lift:OuterSnippet form=POST lift:InnerSnippet class=foo style=color:blue /lift:InnerSnippet /lift:OuterSnippet class InnerSnippet { def render(xhtml: NodeSeq) { // S.attrs will, at this point give me (form, POST), (class, foo), (style, color:blue). I only // want the specific attributes on the lift:InnerSnippet element. Is there some way // to do that? } } -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: S.attrs question
Oh nevermind. S.currentAttrs is what I want. Just didn't see it before. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] lift-json and illegal field names
I feel like there has been a post on this before, but I can't seem to find it. How can I construct a case class that can deal with json like so: { type : image } since this won't work (as type is a scala keyword): case class Foo(type: String) -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: lift-json and illegal field names
Thx all! Just couldn't remember that little trick. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Fwd: Watch Foursquare Lift talk live from NY
My slide deck (for any that are interested) can be found here: http://docs.google.com/present/view?id=dcbpz3ck_24f3v83ggz -harryh On Dec 8, 12:19 am, Xuefeng Wu ben...@gmail.com wrote: 6:30 p.m. the time zone is -8:00? On Tue, Dec 8, 2009 at 12:58 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Dec 7, 2009 at 8:50 PM, Mateo Barraza mateo.barr...@gmail.comwrote: I can't seem to be able to download the talk. Anyone else having problems? Yeah... n8han's uploading the video elsewhere... we'll send around an URL once we get one. M On Mon, Dec 7, 2009 at 7:59 PM, Peter Robinett pe...@bubblefoundry.com wrote: If you missed the talk you can download it from the same link. It's a good one. One thing mentioned briefly in the talk that I'd like to know more about is oAuth Server code. Is anyone working on that? How can I help? Peter On Dec 7, 3:16 pm, David Pollak feeder.of.the.be...@gmail.com wrote: -- Forwarded message -- From: Dave Briccetti da...@davebsoft.com Date: Mon, Dec 7, 2009 at 3:15 PM Subject: Watch Foursquare Lift talk live from NY To: Bay Area Scala Enthusiasts scala-b...@googlegroups.com http://www.justin.tv/n8han -- You received this message because you are subscribed to the Google Groups Bay Area Scala Enthusiasts group. To post to this group, send email to scala-b...@googlegroups.com. To unsubscribe from this group, send email to scala-base+unsubscr...@googlegroups.comscala-base%2bunsubscr...@googlegroups.com scala-base%2bunsubscr...@googlegroups.comscala-base%252bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/scala-base?hl=en. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Scala中文社区: http://groups.google.com/group/scalacn -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Sharing data between snippet functions during a single HTTP request
Another strategy, different from what Ross suggests, that I have found useful in some circumstances. In the view do this: lift:YourPage page:firstsection firstsection:username/ firstsection:foo/ /page:firstsection page:secondsection secondsection:username/ secondsection:foo/ /page:secondsection /lift:YourPage Then class YourPage extends RenderSnippet { def render(xhtml: NodeSeq) = { val user = User.currentUser def firstSection(xhtml: NodeSeq) = { val foo = whatever bind(firstsection, xhtml, username - user.name, foo - foo.name) } def secondSection(xhtml: NodeSeq) = { val bar = whatever bind(firstsection, xhtml, username - user.name, bar - bar.name) } bind(page, xhtml, firstsection - firstSection _, secondSection - secondSection) } } -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] lift-json escaping bug
scala import net.liftweb.json._ scala val s2 = { \id\: \America\\/New_York\ } s2: java.lang.String = { id: America\/New_York } scala JsonParser.parse(s2) res1: net.liftweb.json.JsonAST.JValue = JObject(List(JField(id,JString (America\New_York It should be America/New_York but for some reason getting a \ instead of a / -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: lift-json escaping bug
Yes, what Ross said. Further, taking a look at JsonParser.scala the bug appears to be on line ~202 where there are a couple of missing escape sequences: \/ as well as \f. -harryh On Nov 30, 6:20 pm, Ross Mellgren dri...@gmail.com wrote: He's double escaping so that scala's string interpretation will put a raw \ in there, so that it's an escaped forward slash (\/) to the JSON parson, as I understand it. The output should be either invalid escape or forward slash, but not backslash unless the input was \\. -Ross On Nov 30, 2009, at 6:18 PM, Peter Robinett wrote: Harry, I think you're double-escaping the slash. This works: scala import net.liftweb.json._ scala val s1 = { \id\: \America/New_York\ } s1: java.lang.String = { id: America/New_York } scala JsonParser.parse(s1) res0: net.liftweb.json.JsonAST.JValue = JObject(List(JField(id,JString (America/New_York Peter Robinett On Nov 30, 2:16 pm, harryh har...@gmail.com wrote: scala import net.liftweb.json._ scala val s2 = { \id\: \America\\/New_York\ } s2: java.lang.String = { id: America\/New_York } scala JsonParser.parse(s2) res1: net.liftweb.json.JsonAST.JValue = JObject(List(JField (id,JString (America\New_York It should be America/New_York but for some reason getting a \ instead of a / -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: lift-json escaping bug
Done: http://github.com/dpp/liftweb/issues/#issue/214 On Nov 30, 6:33 pm, Ross Mellgren dri...@gmail.com wrote: If you file an issue on github I'll write up a patch for you tonight. -Ross On Nov 30, 2009, at 6:30 PM, harryh wrote: Yes, what Ross said. Further, taking a look at JsonParser.scala the bug appears to be on line ~202 where there are a couple of missing escape sequences: \/ as well as \f. -harryh On Nov 30, 6:20 pm, Ross Mellgren dri...@gmail.com wrote: He's double escaping so that scala's string interpretation will put a raw \ in there, so that it's an escaped forward slash (\/) to the JSON parson, as I understand it. The output should be either invalid escape or forward slash, but not backslash unless the input was \\. -Ross On Nov 30, 2009, at 6:18 PM, Peter Robinett wrote: Harry, I think you're double-escaping the slash. This works: scala import net.liftweb.json._ scala val s1 = { \id\: \America/New_York\ } s1: java.lang.String = { id: America/New_York } scala JsonParser.parse(s1) res0: net.liftweb.json.JsonAST.JValue = JObject(List(JField (id,JString (America/New_York Peter Robinett On Nov 30, 2:16 pm, harryh har...@gmail.com wrote: scala import net.liftweb.json._ scala val s2 = { \id\: \America\\/New_York\ } s2: java.lang.String = { id: America\/New_York } scala JsonParser.parse(s2) res1: net.liftweb.json.JsonAST.JValue = JObject(List(JField (id,JString (America\New_York It should be America/New_York but for some reason getting a \ instead of a / -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/liftweb?hl=en . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: simple database question
Here is what you need for a minimal Person table that contains two columns: an id for the primary key, and name which is a string: package com.jacksdomain.model import net.liftweb.mapper._ class Person extends LongKeyedMapper[Person] with IdPK { def getSingleton = Person object name extends MappedString(this, 100) } object Person extends Person with LongKeyedMetaMapper[Person] { override def dbTableName = person } You can then do things like this: val person = Person.find(1) // retrieve the person with id = 1 from the database val person = Person.find(By(Person.name, Jack)) // retrieve the person with name = Jack from the database val people = Person.findAll() // retrieve all people form the database val people = Person.findAll(By_(Person.id, 10)) // retrieve all the people with id 10 etc. -harryh On Nov 26, 1:39 pm, jack jack.wid...@gmail.com wrote: wow. thats impressive. But for this, what does the Person class have to look like? Suppose I have the table but I don't have the Person class written. What does it need to look like? On Nov 26, 1:32 pm, harryh har...@gmail.com wrote: val people = Person.findAll() On Nov 26, 1:22 pm, jack jack.wid...@gmail.com wrote: I have my database configured properly in Boot.scala and in my pom.xml. Suppose I have a table name person with a field called name. What is the simple code to return all rows of this table using Mapper. I want to understand the essence of how lift ties tables to objects with a simple example. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] lift-json question related to Lists of things
consider: case class Foo(id: Int, bars: List[Bar]) case class Bar(id: Int) val foo = json.extract[Foo] The following json will cause a problem: { id: 12 } This can be fixed by changing bars to an Option[List[Bar]]. Should that really be necessary though? Can't bars just be an empty list if there are none of them? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: Strip ?xml ? header from a subset of pages
It is not 100% obvious to me how I would, after this change is submitted, avoid sending an ?xml? header when serving pages under a certain path. Should we be adding something similar to S.skipDocType (S.skipXmlHeader)? -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Memcached + Mapper (or Record?)
Is anyone successfully running Lift with a simple Memcached based row cache? If so, are you doing it with Mapper or Record? Are there any docs and/or sample code that would help with this sort of thing? I'm happy to read source code, but wondering if there are any other resources in this general area that might be useful. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: Memcached + Mapper (or Record?)
Then how to go back from the case class (pulled in from memcached) to a Mapper object (that I can modify and then save)? I'm worried about getting the mapper object in an incorrect state where it thinks it needs to add a new row to the table on save rather than update an existing one. Ideally I'd like to override findDbByKey() in my MetaMapper class, and save() in my Mapper class(1) and leave the rest of my code unchanged. -harryh (1) And maybe also bulkDelete_!! and delete, but you get the general idea. Personally, I'd use final case classes, serialize them via lift-json and put them in memcached... but that's just me. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: Memcached + Mapper (or Record?)
Hmmm... so you want to cache the model object in memcached rather than keeping a link to it in the JVM. Yes, because I'm running on 1 JVMs. when you have a modify operation to the model object, you want to update the field and hit save and have the right row go back to the RDBMS? Yes. Where the object was originally loaded from memcached or the RDBMS (if it wasn't in the cache). Further, the save should update the cache as well as the RDBMS. (sorry if I'm being dense... just want to create a firm picture in my head of what you want to do.) No problem at all. And definitely tell me if what I want to do sounds crazy to you for some reason. Ultimately what I want to do is decrease the load on my RDBMS. How I go about that exactly is all up for discussion. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] intro to lift-json?
Is there a basic intro to lift-json floating around anywhere? I'm having a bit of trouble getting started with a couple basic things. For example if a have a JObject that corresponds to: { foo : { bar : 999 } } How do I get the 999 (as an int) out of the JObject? I'm sure this is simple, just a bit confused on the basics. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: intro to lift-json?
Why does this parse into a JArray(List(..)) intead of a JArray(..) ? -harryh scala parse( { ids : [1, 2] } ) res5: net.liftweb.json.JsonAST.JValue = JObject(List(JField(ids,JArray (List(JInt(1), JInt(2)) On Nov 19, 3:51 pm, Tim Nelson tnell...@gmail.com wrote: Have you seen the readme file? http://github.com/dpp/liftweb/tree/master/lift-base/lift-json/ On Thu, Nov 19, 2009 at 2:20 PM, harryh har...@gmail.com wrote: Is there a basic intro to lift-json floating around anywhere? I'm having a bit of trouble getting started with a couple basic things. For example if a have a JObject that corresponds to: { foo : { bar : 999 } } How do I get the 999 (as an int) out of the JObject? I'm sure this is simple, just a bit confused on the basics. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: intro to lift-json?
Ah, ok. That makes sense. Thx! On Nov 19, 5:14 pm, Ross Mellgren dri...@gmail.com wrote: JArray is a case class that wraps a List. It's not an array-of-list or anything, just that the actual elements are stored in a List that JArray holds. -Ross On Nov 19, 2009, at 5:12 PM, harryh wrote: Why does this parse into a JArray(List(..)) intead of a JArray(..) ? -harryh scala parse( { ids : [1, 2] } ) res5: net.liftweb.json.JsonAST.JValue = JObject(List(JField(ids,JArray (List(JInt(1), JInt(2)) On Nov 19, 3:51 pm, Tim Nelson tnell...@gmail.com wrote: Have you seen the readme file? http://github.com/dpp/liftweb/tree/master/lift-base/lift-json/ On Thu, Nov 19, 2009 at 2:20 PM, harryh har...@gmail.com wrote: Is there a basic intro to lift-json floating around anywhere? I'm having a bit of trouble getting started with a couple basic things. For example if a have a JObject that corresponds to: { foo : { bar : 999 } } How do I get the 999 (as an int) out of the JObject? I'm sure this is simple, just a bit confused on the basics. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb %2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/liftweb?hl= . -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] Re: Where are the dragons hiding?
See this thread: http://groups.google.com/group/liftweb/browse_thread/thread/4a174ecf34873967/ In which we discuss how certain queries generated by Mapper perform very poorly on MySQL. Certainly this problem could be addressed, but until it is using Mapper with MySQL will be problematic. -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Presenting on Lift @ NYC Scala Meetup: Dec 7
For anyone who lives in the NYC are and would be interested in this sort of thing: http://www.meetup.com/New-York-Scala-Enthusiasts/calendar/11900384/ -harryh -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] foursquare.com now basically all on Lift
I've been a bit coy about it on the list, but three months ago when I joined the team at foursquare.com I made the final decision that we would port our webservers to Scala/Lift. It took about 3 months, but foursquare.com is now basically running only on Lift(1). This includes the website, a mobile website (m.foursquare.com) and a simple (but growing!) REST api (api.foursquare.com). I'd like the send a huge thank you to dpp and the rest of the Lift team. You've built a really great framework here, and I look forward to using it and seeing it grow for many years to come. An additional thanks goes out to all those who have answered my many random questions over the past couple of months. For those who haven't yet found out about foursquare, you can read more about it here: http://foursquare.com/learn_more Anyways, that's about enough self promotion, but I did want to officially let the community know about what I hope will be a fairly high profile site that is using Lift. -harryh (1) Haven't quite ported feeds.foursquare.com, and there is a legacy PHP based REST api that will live on for a bit longer as it supports current versions of our iPhone app. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.
[Lift] unusually formed POSTs aren't handled correctly
POST /path/to/page?foo=bar HTTP/1.1 Host: harryh.org Content-Length: 0 req.param(foo) will return Empty instead of Full(bar) -harryh --~--~-~--~~~---~--~~ 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: unusually formed POSTs aren't handled correctly
Hrm. They are *not* ignored with the following request: POST /index?foo=bar HTTP/1.1 Host: localhost Content-Length: 0 Content-Type: application/x-www-form-urlencoded Will look into the spec. -harryh On Nov 14, 4:10 pm, David Pollak feeder.of.the.be...@gmail.com wrote: This is defined behaviour in Lift. :-( And query params are ignored during POST processing. Does the HTTP or Servlet spec define the appropriate behaviour here? If Lift is violating either, we'll change Lift. On Sat, Nov 14, 2009 at 12:36 PM, harryh har...@gmail.com wrote: POST /path/to/page?foo=bar HTTP/1.1 Host: harryh.org Content-Length: 0 req.param(foo) will return Empty instead of Full(bar) -harryh -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] lift-json bug (in Xml.toJson)
This is on M7: scala import scala.xml.Elem import scala.xml.Elem scala import net.liftweb.json.JsonAST._ import net.liftweb.json.JsonAST._ scala import net.liftweb.json._ import net.liftweb.json._ scala def go(e: Elem) = Printer.pretty(render(Xml.toJson (e))) go: (scala.xml.Elem)String scala tipsgroup type=Nearbytipid10/id/tip/group/ tips res0: scala.xml.Elem = tipsgroup type=Nearbytipid10/id/ tip/group/tips scala go (res0) res1: String = { tips:{ group:{ type:Nearby, tip: { id:10 } }, type:Nearby } } Note how Nearby appears twice in res1 but only once in res0 -harryh --~--~-~--~~~---~--~~ 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] Whitespace removal from XML
Not scrictly a Lift question, but does anyone have a library they like (or is there something in scalalib I'm not aware of) that will remove whitespace from XML? foo barhello world/bar /foo to: foobarhello world/bar/foo -harryh --~--~-~--~~~---~--~~ 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: Whitespace removal from XML
Answering my own question, I wrote this. I think it should do what I want: def compactXml(node: Node): Node = node match { case Elem(p, l, a, s, children @ _*) = Elem(p, l, a, s, children.map (compactXml(_)) :_*) case Text(data) = Text(data.trim) case x = x } -harryh --~--~-~--~~~---~--~~ 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 quick is webdev with Lift?
I use JRebel and SBT (http://code.google.com/p/simple-build-tool/) and very rarely have to restart my server when doing development. It's a very quick dev-cycle. No big tips really. I save the code and reload the page and see the results of my work. -harryh --~--~-~--~~~---~--~~ 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: Rendering a template bit
What you want can be done with very basic usage of snippets (the way that templates interface with code in Lift). In your template: lift:YourSnippet.foo/ Then in YourSnippet.scala: class YourSnippet { def foo(xhtml: NodeSeq) = Site.render() } Make sure render returns a NodeSeq. -harryh On Nov 5, 9:35 pm, DFectuoso santiago1...@gmail.com wrote: I want to do the following pattern, i don't know how(or if its possible) to do it in lift: - I want any part of my code to call a Site.render() where site is a model and render is a function inside that model that will print it the information - I want the xhtml to be in a html file so that any designer/html guy can play with it and its css/html. (also they won't have to compile and/or scala:cc after every change). Is this possible? I was playing with the lift:embed what=/commons/site / and sending parameters, but i didn't know how to catch those params in the xml, has anyone done this pattern? Am i trying to solve something that can be solved other pattern? --~--~-~--~~~---~--~~ 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] path based and hostname based UrlRewriting interacting badly
First, I rewrite URLs like /user/harryh to /user?uid=harryh Also, requests to http://m.harryh.org/foo/bar get rewritten to / subdomain/mobile/foo/bar Doing this with the following code: val urlRewriter: LiftRules.RewritePF = NamedPF(URLRewrite) { case RewriteRequest(ParsePath(user :: uid :: Nil, _, true, _), _, _) = { RewriteResponse(ParsePath(user :: Nil, , true, false), Map (uid - uid)) } case RewriteRequest(path, _, req) if (req.serverName.toLowerCase.startsWith(m.)) = { RewriteResponse(ParsePath(subdomain :: mobile :: path.partPath, path.suffix, path.absolute, path.endSlash), emptyMap, true) } } LiftRules.rewrite.append(urlRewriter) The problem is that emtyMap in the second RewriteResponse. The uid=harryh parameter that gets created by the first rewrite rule is being destroyed at which point bad things happen. Is there a better way to do what I am trying to do here? -harryh --~--~-~--~~~---~--~~ 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] unnecessary COMMITs?
Seeing a great many of these on my postgresql logs: 2009-10-23 21:35:02 UTC WARNING: there is no transaction in progress 2009-10-23 21:35:02 UTC STATEMENT: COMMIT Any idea what might be causing this? I can filter them out but a) that would be a little annoying b) vaguely worried that something non ideal is going on here -harryh --~--~-~--~~~---~--~~ 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: S.deleteCookie broken in M6
File a ticket. Done It's Harry's tickets day for me today. The more you file, the more that get fixed. Oh my. That's really quite something there. -harryh --~--~-~--~~~---~--~~ 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: maintaining logged in user longer outside of SessionVar
See ProtoExtendedSession After adding this to Boot.scala: S.addAround(ExtendedSession.requestLoans) I'm seeing request to load the User object from the database on every request (including requests for static flies like images/css/js). Is there something I can do to make this not happen? Alternately, should this be considered a Lift bug? -harryh --~--~-~--~~~---~--~~ 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: maintaining logged in user longer outside of SessionVar
It's going to load the user for each stateful request. What do you mean by a stateful request? I guess we can change it up to make the load lazy so it'll only happen in the requestvar is actually accessed. Does that sould reasonable? If that makes it so I don't hit the database when loading static files, then yes. -harryh --~--~-~--~~~---~--~~ 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 JqKeypress?
Yes, but then how can I distinguish back on the server whether func is being executed because of a blur (in which case I don't really want to do anything) or because of a keypress of enter (in which case I want to perform an action as if the go button had been pressed). -harryh On Oct 20, 11:27 am, Derek Chen-Becker dchenbec...@gmail.com wrote: I think that the ajaxText already handles an enter key as field submission. Here's the code that defines an ajaxText field: 1. private def ajaxText_*(value: String, jsFunc: Box[Call], func: AFuncHolder, attrs: (String, String)*): Elem = { 2. val raw = (funcName: String, value:String) = JsRaw(' +funcName + =' + encodeURIComponent( + value + .value)) 3. val key = formFuncName 4. 5. fmapFunc(func){ 6. funcName = 7. (attrs.foldLeft(input type=text value={value}/)(_ % _)) % 8. (onkeypress - liftUtils.lift_blurIfReturn(event)) % 9. (onblur - (jsFunc match { 10. case Full(f) = JsCrVar(key, JsRaw(this )) deferCall(raw(funcName, key), f) 11. case _ = makeAjaxCall(raw(funcName, this)) 12. }) 13. ) 14. } 15. } Note the onkeypress and onblur event handlers. If you need to do some extra handling on the client side, you can provide the jsFunc parameter which will be used to submit the ajax call. Derek On Mon, Oct 19, 2009 at 6:13 PM, harryh har...@gmail.com wrote: It seems like I ought to be able to use JqKeypress so that if a user presses enter when a text input has focus an associated ajaxButton is submitted. I can't get it to work though. Help? Basically I have a bunch of little form like so [ text input ] [go!] that I want to submit (ajax style) when the user presses enter. -harryh --~--~-~--~~~---~--~~ 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: Menu entry to perform action then redirect
Menu(Loc(logout, List(logout), logout, Template(() = { User.logout }), ifLoggedIn)) :: object User { def logout = { logUserOut S.redirectTo(/) } } On Oct 20, 5:50 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Could someone give an example of a Sitemap menu entry that performs an action and then redirects?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] maintaining logged in user longer outside of SessionVar
I want users to stay logged into my site for extended periods of time (through server restarts, and browser restarts). By default Lift stores a User in a SessionVar so this doesn't get me there. I've configured jetty so the session cookie doesn't time out for 30 days, and I have a database table with a session id - user id mapping, but keeping this up to date has proven to be kind of a pain as the session id can change from time to time (like when I restart my servers to push a new website version) and it's a bit more tricky than I would like to handle all of this correctly. Are any other lift users trying to accomplish the same goal? How have you gone about it? Would it be a good feature for the framework to have something to do this a bit more built in? -harryh --~--~-~--~~~---~--~~ 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: maintaining logged in user longer outside of SessionVar
See ProtoExtendedSession Ah, this is perfect! Just hadn't noticed it before. Thx. -harryh --~--~-~--~~~---~--~~ 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: maintaining logged in user longer outside of SessionVar
Is it more dangerous to store the user's uniqueId in a cookie than to store another uniqueId that's associated with the user's uniqueId? It is if your site has URLs like http://harryh.org/user/[uid] -harryh --~--~-~--~~~---~--~~ 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] how to use JqKeypress?
It seems like I ought to be able to use JqKeypress so that if a user presses enter when a text input has focus an associated ajaxButton is submitted. I can't get it to work though. Help? Basically I have a bunch of little form like so [ text input ] [go!] that I want to submit (ajax style) when the user presses enter. -harryh --~--~-~--~~~---~--~~ 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: maintaining logged in user longer outside of SessionVar
See ProtoExtendedSession It might be kind of annoying to change at this point, but experation is a misspelling in this trait. -harryh --~--~-~--~~~---~--~~ 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] binding bug inside of select elements
This seems very strange to me, and I don't have a minimal test case yet, but I'm seeing a problem where elements are not being properly bound when they appear inside of a select in my view. So, for example: select stats:options /select stats:options isn't being bound. But div stats:options /div gets bound find (but then I, obviously, don't have proper HTML since the options are inside of a div instead of a select). Has anyone else seen this? Is it possible that this is what is really going on here? It seems like a very strange bug (if I have, in fact, hit a bug). -harryh --~--~-~--~~~---~--~~ 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: binding bug inside of select elements
Not seeing how to mark it high priority, but here is the ticket: http://github.com/dpp/liftweb/issues/#issue/102 will attach additional information as I figure it out. -harryh On Oct 15, 12:37 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Weird. When you have a repro case, please file a ticket and mark it as high priority. On Thu, Oct 15, 2009 at 9:28 AM, harryh har...@gmail.com wrote: This seems very strange to me, and I don't have a minimal test case yet, but I'm seeing a problem where elements are not being properly bound when they appear inside of a select in my view. So, for example: select stats:options /select stats:options isn't being bound. But div stats:options /div gets bound find (but then I, obviously, don't have proper HTML since the options are inside of a div instead of a select). Has anyone else seen this? Is it possible that this is what is really going on here? It seems like a very strange bug (if I have, in fact, hit a bug). -harryh -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Followup: Persisting a mapper with join tables in 1.0.2
There is no online API docs for 1.1-M6 http://scala-tools.org/mvnsites/liftweb-1.1-M6/lift-webkit/scaladocs/index.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: collecting page load statistics for ajax requests
So, your callOnAjaxCompleteFunc will be called if any of the ajax functions in the block are executed. That's certainly one way to go. I was thinking it might be nice to modify the URL used for the ajax request though because then the request can be logged in a standard way (whatever it is that jetty/ tomcat/whatever server you are using is already doing) and parsed with standard tools. callOnAjaxCompleteFunc could certainly create a log entry designed to look like the above, but it might be a bit more work for the developer. -harryh PS: Just so you know this isn't high priority or anything. Just a random might be nice idea I had. --~--~-~--~~~---~--~~ 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: DB logging logs statements twice?
I'm also seeing this double logging behavior (using PostgreSQL. I was under the impression that it was happening because the SQL statement is first prepared, and then executed (each of which cause a log entry). It's not critical or anything, but it would be nice if this could be fixed at some point. -harryh On Oct 13, 10:28 am, Derek Chen-Becker dchenbec...@gmail.com wrote: I'm not sure how that could be getting logged twice, especially since it's the exact same ResultSet being returned. When I tested this on my local app (against both PG and MySQL) I didn't get this behavior, but I'll try pulling from master and testing again just in case something changed. Derek On Tue, Oct 13, 2009 at 6:56 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: Hi, Just wanted to update to the new db logging by adding the following to boot: DB.addLogFunc { case (query:DBLog, time) = { LogBoot.loggerByName(query).info( All queries took + time + ms: ) query.statementEntries.foreach({ case DBLogEntry(stmt, duration) = LogBoot.loggerByName(query).info( +stmt + took + duration + ms)}) LogBoot.loggerByName(query).info( End queries) } } But it seems all executed statements are logged twice. I have this snippet: def currentUser(xhtml: Group): NodeSeq = Text(User.currentUser.dmap(S.?(Anonym))(user = user.firstName + + user.lastName)) This logs: 14:46:09.068 [tp-1029120287-4] INFO query - All queries took 5ms: 14:46:09.068 [tp-1029120287-4] INFO query - Exec query SELECT users.id, users.firstname, users.lastname, users.email, users.locale, users.timezone, users.password_pw, users.password_slt, users.account_id, users.superuser, users.uniqueid, users.validated FROM users WHERE id = 2 (scale -5) : org.postgresql.jdbc4.jdbc4result...@77f31432 took 4ms 14:46:09.069 [tp-1029120287-4] INFO query - End queries 14:46:09.069 [tp-1029120287-4] INFO query - All queries took 8ms: 14:46:09.069 [tp-1029120287-4] INFO query - Exec query SELECT users.id, users.firstname, users.lastname, users.email, users.locale, users.timezone, users.password_pw, users.password_slt, users.account_id, users.superuser, users.uniqueid, users.validated FROM users WHERE id = 2 (scale -5) : org.postgresql.jdbc4.jdbc4result...@77f31432 took 4ms 14:46:09.069 [tp-1029120287-4] INFO query - End queries Note the same resultset. The postgres logs also shows that only a single statement is executed So, what did I miss? /Jeppe --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] LongKeyedMapper object where I can set the id
LongKeyedMapper object where I can set the id. I want a database object where I set the primary key myself (rather than having it be sequentially by the database). I thought I could do this: class Tombstone extends LongKeyedMapper[Tombstone] { def getSingleton = Tombstone def primaryKeyField = id object id extends MappedLongIndex(this) { override def writePermission_? = true } } object Tombstone extends Tombstone with LongKeyedMetaMapper[Tombstone] { override def dbTableName = tombstones } But when I do Tombstone.create.id(12).save it does an UPDATE instead of an INSERT. Is there any good way to do what I want here? --~--~-~--~~~---~--~~ 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: Milestone 6 Released!
Huzzah! On Oct 8, 8:13 pm, Charles F. Munat c...@munat.com wrote: The Lift team is pleased to announce the lift-1.1-M6 release! Lift is an expressive and elegant framework for writing web applications. Lift stresses the importance of security, maintainability, scalability and performance while allowing for high levels of developer productivity. Lift is a scala web framework. No changes defined in this version. Have fun! -Lift team --~--~-~--~~~---~--~~ 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] MappedLong null values
I have a long field in my database that I want to have a unique index (enforced by the database). Sometimes this field will be empty, in which case I'd like to set it to NULL. 0 won't work because that won't work with the unique index. MappedLong appears to be converting null to 0 internally. Additionally overriding defaultValue for the field and returning null does not appear to work. Is this by design? Is it possible that I am misunderstanding something here? -harryh --~--~-~--~~~---~--~~ 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 can I pass the result of Xml.toJson to JsonResponse
For now I am doing this. It's not so bad. def xmlToJson(xml: Elem): JsExp = { val json = Xml.toJson(xml) map { // some mappings specific to my json needs } JsRaw(Printer.compact(render(json)) } JsonResponse(xmlToJson(xml)) On Oct 6, 11:17 am, David Pollak feeder.of.the.be...@gmail.com wrote: Please open a ticket for this. We need to get the rest of Lift playing well with Joni's excellent JSON library. On Tue, Oct 6, 2009 at 7:43 AM, glenn gl...@exmbly.com wrote: I want to pass the result of Xml.toJson to JsonResponse. How can I do that, when JsonResponse takes a JsExp as a parameter, not a JValue. Glenn -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Surf the harmonics --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: lift-json and attributes
This is a feature request and I just committed an implementation to my branch. This looks great. If there is anyway it could get committed to master in time for M6 (which is coming out any day now right?) that would be very very helpful to me. Thanks for your work on this stuff Joni! -harryh --~--~-~--~~~---~--~~ 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] Possible lift-json bug in Xml.toJson
Xml.toJson (in M5) is converting this: iconhttp://harryh.org/img/icons/foo.png/icon to this: JField(icon, JObject(Nil)) Is there some special handling of URLs going on here that might be causing me problems? -harryh --~--~-~--~~~---~--~~ 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: Possible lift-json bug in Xml.toJson
More info. If the code that generates the XML looks like this: icon{http://harryh.org+theUri}/icon everything is fine, but it breaks when like this: iconhttp://harryh.org{theUrl}/icon -harryh On Oct 5, 2:22 pm, harryh har...@gmail.com wrote: Xml.toJson (in M5) is converting this: iconhttp://harryh.org/img/icons/foo.png/icon to this: JField(icon, JObject(Nil)) Is there some special handling of URLs going on here that might be causing me problems? -harryh --~--~-~--~~~---~--~~ 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: a question about host based url rewriting
You want the foo_mobile.html template rather than the foo.html template (or foo_en.html or foo_es.html). So, the rest of the logic stays the same (page access, etc.) but the template selection is different. Is this correct? No, not really. There isn't a 1:1 mapping of pages between the standard site and the mobile site. I can see how some people might want that, but it's not my particular use case. I just have a whole separate set of templates I want to serve off of m.harryh.org. -harryh --~--~-~--~~~---~--~~ 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: a question about host based url rewriting
Are they essentially two independent apps in terms of templates and snippets? Yes. Though they share the same model (+ some random extra library code). That seems like you just want a virtual host via nginx or some other web server. I could go that route. But then I have another app to build + deploy. -harryh --~--~-~--~~~---~--~~ 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] a question about host based url rewriting
I want http://m.harryh.org to visit a mobile version of my site so I added the following rewrite rule: case RewriteRequest(path, _, req) if (req.serverName.toLowerCase.startsWith(m.)) = { RewriteResponse(ParsePath(mobile :: path.partPath, path.suffix, path.absolute, path.endSlash), emptyMap, true) } This also makes the mobile site appear at http://harryh.org/mobile/ which I don't really want. Is there any way I can accomplish this goal (other than putting the mobile site in a weird path like / someRandomGuid/ -harryh --~--~-~--~~~---~--~~ 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] Change net.liftweb.mapper.ByList to take a Seq[T] instead of a List[T]?
Subject says it all. Is there any reason why this should not be done? -harryh --~--~-~--~~~---~--~~ 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: Change net.liftweb.mapper.ByList to take a Seq[T] instead of a List[T]?
We're going to have to turn it into a List under the covers anyway, so it's a performance wash. Taking a look at the code it does no appear to be the case that it will have to be turned into a List under the covers. It's just mapped over and then mkStringed. -harryh --~--~-~--~~~---~--~~ 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] selecting random rows from a table
Let's say I want 10 random users from a table In SQL I would do this: SELECT * FROM users ORDER BY random() LIMIT 10; Is there any way (without resorting to a fully raw SQL query) to do this with lift-mapper? I though this would work: Users.findAll(OrderBySql(random(), IHaveValidatedThisSQL(harryh, 2009-9-29)), MaxRows(10)) This does not work, however, because when using SELECT DISTINCT you can't ORDER BY something that you aren't selecting (in PostgreSQL at least, might be ok in MySQL). -harryh --~--~-~--~~~---~--~~ 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: Struggling with mapping a list of objects
But I cannot for the life of me work out of to store a list of objects What do you expect the underlying type in the database table to be? Normally this would be done with a separate table with a foreign key (MappedLongForeignKey) back to the users table. -harryh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: XML - JSON converter?
This is really really great. Will totally help me out a lot. Thanks! -harryh On Sep 24, 3:24 am, Joni Freeman freeman.j...@gmail.com wrote: Hi, There is now improved XML support in lift master. See a short section in README:http://github.com/dpp/liftweb/tree/master/lift-json/ and some executable examples:http://github.com/dpp/liftweb/blob/master/lift-json/src/test/scala/ne... Cheers Joni On Sep 2, 9:27 pm, harryh har...@gmail.com wrote: Is there anything built into lift that will doXML- JSON conversion? For example: foos foo id1/id nameHarry/name /foo foo id2/id nameDavid/name /foo /foos to: { foos: { foo: [{ id: 1, name: Harry }, { id: 2, name: David } ] } Just checking to see if there was something Lift friendly to do this before writing my own (or picking a java library to use). -harryh --~--~-~--~~~---~--~~ 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: suggestion: strip comments when serving templates
- Would also be nice if all excessive white space were stripped from the output (not sure how much this matters if it's gzip'ed) This would be nice as well, but can be a lot more complicated. GXP (a templating language I worked on at Google) had pretty awesome whitespace control that I'm happy to describe in detail if dpp (or another committer) is interested. Personally though, I wouldn't consider this super high priority. -harryh --~--~-~--~~~---~--~~ 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: access to raw HttpServletRequest/Response
You can do it today like this: S.containerRequest.map(r = (r.asInstanceOf[HTTPRequestServlet]).req) eh? I'm getting this error: [error] value req is not a member of net.liftweb.http.provider.servlet.HTTPRequestServlet [error] val request: HttpServletRequest = S.containerRequest.map(r = (r.asInstanceOf[HTTPRequestServlet]).req).open_! -harryh --~--~-~--~~~---~--~~ 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] low level lift exception when building with sbt
Experimenting with SBT, and everything works fine when running jetty from within sbt, but when I package up a war file and try to run in production, I'm getting the following exception. Any ideas? -harryh java.lang.NullPointerException at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply (HTTPProvider.scala:54) at net.liftweb.http.provider.HTTPProvider$$anonfun$service$3.apply (HTTPProvider.scala:54) at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:65) at net.liftweb.http.URLRewriter$.doWith(Req.scala:470) at net.liftweb.http.provider.HTTPProvider$class.service (HTTPProvider.scala:53) at net.liftweb.http.LiftFilter.service(LiftServlet.scala:507) at net.liftweb.http.provider.servlet.ServletFilterProvider $class.protected$service(ServletFilterProvider.scala:41) at net.liftweb.http.LiftFilter.protected$service(LiftServlet.scala: 507) --~--~-~--~~~---~--~~ 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] suggestion: strip comments when serving templates
I would love to add comments to my templates: !-- Put the shiny new feature here as soon as we have time to build it -- that got stripped out before being served to end users. -harryh --~--~-~--~~~---~--~~ 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 bind preserving element contents?
Personally, when doing this, I like splitting out the code to fill in the rows into a separate function like so: def row(xhtml: NodeSeq): NodeSeq = { questions.flatMap(question = { bind(question, xhtml, edit - ..., delete - ...) }) } bind(questions, xhtml, row - row _) On Sep 18, 3:05 am, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Hi, I would like to bind the following part form a template: question:row tdquestion:edit/nbsp;question:delete//td tdquestion:id//td tdquestion:text//td tdquestion:answers//td /question:row The result should be a table row like that: tr id=someId td.../td ... /tr So in this case I want to replace the row-element itself (and add an attribute value), but the contents (children) of the row-element must be preserved! How can this be accomplished? Thank you! Heiko -- My job: weiglewilczek.com My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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: What's the best way to get the current request URL
S.uri On Sep 16, 9:35 am, Ryan Donahue donahu...@gmail.com wrote: I want to capture the the current request URL, so I can redirect back to it at a later point. What's the best way to get at the URL? The answer is probably obvious, but I can't seem to find it. Thanks, Ryan --~--~-~--~~~---~--~~ 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: Bug in MappedEmail: emailPattern is wrong
Hrm, MappedEmail is now rejecting e-mails with a - in the part before the @. is %-+ being interpreted as % through + and not % OR - OR + ? -harryh, who is easily confused by regular expressions On Aug 26, 7:32 pm, David Pollak feeder.of.the.be...@gmail.com wrote: Thanks. Changed and pushed to GitHub. Allow 2 hours for Maven availability. On Wed, Aug 26, 2009 at 4:15 PM, harryh har...@gmail.com wrote: What's the change to the RegEx? val emailPattern = Pattern.compile(^[a-z0-9._%-+]+@(?:[a-z0-9-]+\\.)+ [a-z]{2,4}$) note the addition of the + to the allowed characters before the @ -harryh -- 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] suggestion: make Mailer use n.l.util.Props
Rather than using System.getProperties should Mailer use net.liftweb.util.Props? It seems a little inconsistent as is. -harryh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Problems with ByList on M5
val venues = Venue.findAll(ByList(Venue.id, List(1, 2, 3))) results in the following compile error: found : com.foursquare.model.Venue.id.type (with underlying type object com.foursquare.model.Venue.id) required: net.liftweb.mapper.MappedField [AnyVal,com.foursquare.model.Venue.MapperType] Note that implicit conversions are not applicable because they are ambiguous: both method mapToType in object MappedField of type [T,A : net.liftweb.mapper.Mapper[A]](net.liftweb.mapper.MappedField[T,A])T and method mapToType in object MappedField of type [T,A : net.liftweb.mapper.Mapper[A]](net.liftweb.mapper.MappedField[T,A])T are possible conversion functions from com.foursquare.model.Venue.id.type to net.liftweb.mapper.MappedField [AnyVal,com.foursquare.model.Venue.MapperType] val venues = Venue.findAll(ByList(Venue.id, List(1, 2, 3))) -harryh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Problems with ByList on M5
Though strangely enough, this compiles fine: val ids: List[Long] = List(1,2,3) val venues = Venue.findAll(ByList(Venue.id, ids) Weird! -harryh --~--~-~--~~~---~--~~ 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] small bug in SHtml.ajaxText
Neither of the ajaxText methods take attrs: (String, String)* The private ajaxText_* does, but the public methods don't. -harryh --~--~-~--~~~---~--~~ 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: small bug in SHtml.ajaxText
http://reviewboard.liftweb.net/r/5/ Thanks! -harryh --~--~-~--~~~---~--~~ 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: Bug in HasManyThough causing unexpected deletions?
I'm still seeing this on M5. My diagnosis of the prolem in my 2nd e- mail is incorrect, but there is definitely a problem here. -harryh On Aug 28, 1:39 pm, harryh har...@gmail.com wrote: Tips are on TipLists based on TipListBinds. Tips are also hooked to a Venue: class Tip extends LongKeyedMapper[Tip] with IdPK { // other unrelated stuff stuff object venueid extends MappedLongForeignKey(this, Venue) object lists extendsHasManyThrough(this, TipList, TipListBind, TipListBind.tipid, TipListBind.listid) } In an ajax request I am setting the venueid on a collection of Tips to Empty. This is, for somewhat confusing reasons, causing the Tip to be removed from the lists it is on (the TipListBindings are being deleted). I am fairly certain this is happening because ofHasManyThrough. INFO - com.mysql.jdbc.preparedstatem...@2b48c3: UPDATE tips SET venueid = ** NOT SPECIFIED ** WHERE id = ** NOT SPECIFIED **:2ms INFO - com.mysql.jdbc.preparedstatem...@69827c: SELECT DISTINCT tipxlist.listid, tipxlist.id, tipxlist.tipid FROM tipxlist WHERE tipid = 21128 :1ms INFO - com.mysql.jdbc.preparedstatem...@69827c: SELECT DISTINCT tipxlist.listid, tipxlist.id, tipxlist.tipid FROM tipxlist WHERE tipid = ** NOT SPECIFIED ** :22ms INFO - com.mysql.jdbc.preparedstatem...@ca8d17: DELETE FROM tipxlist WHERE id = ** NOT SPECIFIED **:1ms Currently thinking through what's going on inHasManyThrough::afterUpdate -harryh --~--~-~--~~~---~--~~ 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] setting cookies in an ajax response
I have an SHtml.ajaxSelect that, when executed sets a cookie: S.addCookie(HTTPCookie(CITYID, city.id.toString)) and then returns a JsCmds.RedirectTo(uri) command. The cookie isn't actually being set (if I look at the live http headers the Set-Cookie line isn't sent down in the http response to the ajax call. It's not clear to me if this is correct behavior on lift's part, of if this is a bug. If it is correct behavior, is there a better way to do this sort of thing? -harryh --~--~-~--~~~---~--~~ 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: Milestone 5 now available!
Are there generated scaladocs on the web for M5 anywhere? -harryh --~--~-~--~~~---~--~~ 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] PreCache doesn't take into account OrderBy and MaxRows?
Consider: val venues = Venue.findAll(By(Venue.cityid, City.currentCity), NotNullRef(Venue.owner), OrderBy(Venue.id, Descending), MaxRows(10), PreCache(Venue.owner)) This appears to be generating a query like so: SELECT DISTINCT users.id, users.firstname, users.lastname FROM users WHERE id IN (SELECT owner FROM venues WHERE cityid = 22 AND owner IS NOT NULL ) - 970ms This will end up returning a much larger number of users than is required which seems bad. -harryh --~--~-~--~~~---~--~~ 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: PreCache doesn't take into account OrderBy and MaxRows?
~1125 ms for your query. ~50ms for the IN based on that lift currently generates. This is doing things in the psql console on the same machine the database lives on. It's not so much the query time that concerns me, as the amount of data being sent back in the results. In my example at the top of the thread I only need 10 users, but the query is spitting back thousands. -harryh On Sep 10, 2:16 pm, Viktor Klang viktor.kl...@gmail.com wrote: On Thu, Sep 10, 2009 at 8:15 PM, Viktor Klang viktor.kl...@gmail.comwrote: On Thu, Sep 10, 2009 at 6:23 PM, harryh har...@gmail.com wrote: Consider: val venues = Venue.findAll(By(Venue.cityid, City.currentCity), NotNullRef(Venue.owner), OrderBy(Venue.id, Descending), MaxRows(10), PreCache(Venue.owner)) This appears to be generating a query like so: SELECT DISTINCT users.id, users.firstname, users.lastname FROM users WHERE id IN (SELECT owner FROM venues WHERE cityid = 22 AND owner IS NOT NULL ) - 970ms Just out of curosity, if you run the following query, how long does it take? Ack! a very nice distinct fell away, this is the real deal: select distinct u.id http://u.id/, u.firstname, u.lastname from venues v inner join users u on v.owner = u.id where v.cityid = 22 select u.id, u.firstname, u.lastname from venues v inner join users u on v.owner = u.id where v.cityid = 22 This will end up returning a much larger number of users than is required which seems bad. -harryh -- Viktor Klang Blog: klangism.blogspot.com Twttr: viktorklang Lift Committer - liftweb.com AKKA Committer - akkasource.org Cassidy - github.com/viktorklang/Cassidy.git SoftPub founder:http://groups.google.com/group/softpub -- Viktor Klang Blog: klangism.blogspot.com Twttr: viktorklang Lift Committer - liftweb.com AKKA Committer - akkasource.org Cassidy - github.com/viktorklang/Cassidy.git SoftPub founder:http://groups.google.com/group/softpub --~--~-~--~~~---~--~~ 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: PreCache doesn't take into account OrderBy and MaxRows?
A fix is in the works. Awesome. Thanks!!! -harryh --~--~-~--~~~---~--~~ 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: PreCache doesn't take into account OrderBy and MaxRows?
http://github.com/dpp/liftweb/commit/58c5463d44948a48dd2fa62bf9d14960... Any idea how long it will be until this is in a non snapshot build? I guess I just missed the M5 release. I'm a little scared of pushing production code based on 1.1-SNAPSHOT. Anyone out there doing this sort of thing? If so, have you found it generally pretty stable, or would you not recommend it? -harryh --~--~-~--~~~---~--~~ 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] XML - JSON converter?
Is there anything built into lift that will do XML - JSON conversion? For example: foos foo id1/id nameHarry/name /foo foo id2/id nameDavid/name /foo /foos to: { foos: { foo: [{ id: 1, name: Harry }, { id: 2, name: David } ] } Just checking to see if there was something Lift friendly to do this before writing my own (or picking a java library to use). -harryh --~--~-~--~~~---~--~~ 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 subclasses
I've been handling this with traits, for example I have something like so: trait Timestamp[MapperType : Mapper[MapperType]] { object xdatetime extends MappedDateTime[MapperType](this.asInstanceOf [MapperType]) // all sorts of utility functions for dealing with timestamps } Then I can do class Foo extends LongKeyedMapper[Foo] with IdPK with Timestamp[Foo] { // additional fields that are Foo specific } I have quite a few traits similar to Timestamp at this point corresponding to various fields that appear in lots of different tables in my application. -harryh --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---