[Lift] Re: Using TemplatePf for JPA powered templates

2008-12-01 Thread Charles F. Munat
Will do, if I figure it out. But my comment wasn't complaining. I am honestly mystified. Am I the only one using trees in Hibernate? Is there a tree library in Scala that I'm missing? What the heck does everyone else do? It just blows my mind. Chas. Viktor Klang wrote: On Mon, Dec 1,

[Lift] Re: JPA find or create new

2008-12-01 Thread Charles F. Munat
That will probably work. I was thinking it would be nice to build in a method findOrNew that would do it for me... but it looks like that might involve some sort of implicit manifest thingy, so I don't know. Chas. Viktor Klang wrote: On Mon, Dec 1, 2008 at 7:12 AM, Charles F. Munat

[Lift] Re: Using TemplatePf for JPA powered templates

2008-12-01 Thread Charles F. Munat
Are you including a link to the parent node or are you just using the left and right values to figure out which nodes are children? I always include a foreign key to the parent so I can just select the children of that parent directly. Then to get all descendants, I use the left and right

[Lift] Re: Using TemplatePf for JPA powered templates

2008-12-01 Thread Tim Perrett
Im not sure I follow? Can you use this diagram to try and explain?: http://dev.mysql.com/tech-resources/articles/hierarchical-data-4.png If you wanted to select the direct children of 'electronics', how would one go about doing that? Is there a simpler way than all that HQL? Cheers Tim On

[Lift] Re: a plea for documentation

2008-12-01 Thread Derek Chen-Becker
http://github.com/tjweir/liftbook/tree/master See earlier posts for details. Derek On Sun, Nov 30, 2008 at 7:33 PM, Oscar Picasso [EMAIL PROTECTED]wrote: Which book are you talking about? I didn't know that they were already chapters of a lift book we could read. On Wed, Nov 26, 2008 at

[Lift] Re: JPA find or create new

2008-12-01 Thread Derek Chen-Becker
Because it's type erasure I don't think I can do a generic new inside the methods, but the findOne method does return a Can. That means that you were actually pretty close in your demo code. Here's what it could look like: val user: User = Model.createNamedQuery[User]( findUserByUsername,

[Lift] Re: Testing for well-formed XML

2008-12-01 Thread Derek Chen-Becker
For now the plugin lives here: http://github.com/dchenbecker/maven-lift/tree/master I'm going to talk to David B. about hosting the plugin on scala-tools, but for now you can check it out and do a mvn install on the source. Then add plugin groupIdnet.liftweb.tools/groupId

[Lift] Re: Using TemplatePf for JPA powered templates

2008-12-01 Thread David Pollak
Tim, Please remember that Lift's Snippet processing is recursive. Thus, you don't really need to hook into the templating system in order to be able to using Lift's templates. For example, if your snippet returned: spanlift:comet type=Dog/lift:comet type=Cat//span Lift would then interpret

[Lift] Re: Testing for well-formed XML

2008-12-01 Thread David Pollak
On Sun, Nov 30, 2008 at 3:46 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote: OK, I have a maven-lift plugin done with an i18ngen target that you can use to parse all of your Scala and xhtml sources for i18n keys (lift:loc, etc). The question now is, where should I put it? Should I put it in the

[Lift] Re: Using TemplatePf for JPA powered templates

2008-12-01 Thread Tim Perrett
Hey David, Thanks for the response - I have been reflecting on the whole L2 cache thing today and kind of came to the same conclusion. If the content has been served, it might as well be cached in its entirety as a HTML file so it can then be served by the front end web-server (nginx, apache

[Lift] Re: Named Partial Functions

2008-12-01 Thread David Pollak
On Wed, Nov 26, 2008 at 2:44 PM, Alex Boisvert [EMAIL PROTECTED] wrote: ... extends PartialFunction with Named ? I was looking to name the companion object. It's called NamedPF alex On Wed, Nov 26, 2008 at 2:08 PM, TylerWeir [EMAIL PROTECTED] wrote: DebugPartialFunction,

[Lift] Re: Alter presentation behavior with snippet markup

2008-12-01 Thread David Pollak
I've added def dmap[B](dflt: = B)(f: A = B): B to Cans: S.param(foo).dmap(5)(toInt) On Fri, Nov 28, 2008 at 6:53 AM, Derek Chen-Becker [EMAIL PROTECTED]wrote: I have to say, I love this Can-map-openOr idiom. I use it all of the time in my code for parameter handling, etc. Derek On Fri,

[Lift] Re: Lift and eclipse hotdeploy

2008-12-01 Thread David Pollak
On Fri, Nov 28, 2008 at 4:39 AM, Acciaio [EMAIL PROTECTED] wrote: Thanx for the advice, Now I'm writing code into eclipse with a project setted up without source files to compile and after I run jetty I also run a scala:cc on the same project... Don't works perfectly but in this way I

[Lift] Re: JPA and Record

2008-12-01 Thread David Pollak
My 2 cents: - I'm strongly opposed to any compiler plugins as they (1) mean that IDEs will work less well and (2) they require some sort of installation (if they can be rolled into the Maven building stuff, it makes this objection go away) - I'm strongly opposed to mixing

[Lift] Re: Alter presentation behavior with snippet markup

2008-12-01 Thread David Pollak
On Mon, Dec 1, 2008 at 10:24 AM, Alex Boisvert [EMAIL PROTECTED] wrote: Isn't this similar to Option.mapOrElse that you opposed on the scala mailing list? :) In fact it is. :-) Polluting Scala is bad. Polluting Lift is less bad. alex On Mon, Dec 1, 2008 at 9:55 AM, David Pollak

[Lift] Re: A quick question

2008-12-01 Thread David Pollak
Marius, Back when I wrote the mapper stuff, there were a bunch of limitations of using vals: - Because of uniform access rules, the difference between val foo = new Thing ; def bar = foo was not possible to calculate. It looks like the compiler now stores things in a named field, so

[Lift] Re: JPA and Record

2008-12-01 Thread Josh Suereth
- I'm pretty close to having a releasable version of the maven-scala-plugin that supports compiler plugins. - Adding integration between the maven-pom and eclipse is going to take some time (but is possible). I'm not sure about the netbeans/IntelliJ tools, but this could be an awkward integration

[Lift] Re: JPA and Record

2008-12-01 Thread Marius
On Dec 1, 8:22 pm, David Pollak [EMAIL PROTECTED] wrote: My 2 cents:    - I'm strongly opposed to any compiler plugins as they (1) mean that IDEs    will work less well and (2) they require some sort of installation (if they    can be rolled into the Maven building stuff, it makes this

[Lift] new to lift ... horizontal scaling of databases?

2008-12-01 Thread baconeater...@gmail.com
Hi ... new to Scala and Lift. I'm having trouble understanding how to think about a project with a horizontally scaled database. I guess people call this sharding these days? My existing app uses PHP, no framework, and no O-R mapping. It's all PHP/MySQL with SQL statements. Some O-R mappers

[Lift] Re: Using TemplatePf for JPA powered templates

2008-12-01 Thread Charles F. Munat
When I use a nested set, I make it like a combination of nested set and a simple tree. So in my database, I have: idparent_idlftrgtname -- 1 NULL 1 20Electronics 21 2 9Televisions 3

[Lift] Re: Using TemplatePf for JPA powered templates

2008-12-01 Thread Shawn O'Connor
On Sun, Nov 30, 2008 at 6:27 AM, Derek Chen-Becker [EMAIL PROTECTED] wrote: If you're heavily skewed towards reads and not writes (as it seems in the case of a CMS), you might want to look at Celko nested sets: http://www.intelligententerprise.com/001020/celko.jhtml

[Lift] Re: Bug in Chat example?

2008-12-01 Thread Paul Butcher
I hate to nag, but does anyone have any idea what's up with the bug in the chat example I e-mailed about a while ago? I've been playing around with the ask/answer functionality in the interim, and (although it's quite possible that I'm missing something) I can't get it to work at all. The first

[Lift] Re: JPA find or create new

2008-12-01 Thread Charles F. Munat
Thanks. Types are still largely a mystery to me, but this works just fine. Chas. Derek Chen-Becker wrote: Because it's type erasure I don't think I can do a generic new inside the methods, but the findOne method does return a Can. That means that you were actually pretty close in your demo

[Lift] Re: new to lift ... horizontal scaling of databases?

2008-12-01 Thread David Pollak
On Sun, Nov 30, 2008 at 6:07 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi ... new to Scala and Lift. I'm having trouble understanding how to think about a project with a horizontally scaled database. I guess people call this sharding these days? My existing app uses PHP, no

[Lift] Inserting/deleting table rows with AJAX

2008-12-01 Thread Charles F. Munat
I have a table in which each row represents an object in the database, with each cell in the row an input bound to an attribute of the object. I want to be able to add rows (with new, blank objects) and delete rows (deleting both the row on the page and the associated object in the database).

[Lift] Re: Inserting/deleting table rows with AJAX

2008-12-01 Thread David Pollak
Charles, If you're planning to deploy this app in IE, you may have an issue. My experience with IE is that adding/removing tr doesn't always work well. :-( What is most likely happening is that your button is inside a form. It turns out that there's a race condition where sometimes the

[Lift] Re: Joins in Lift mapper

2008-12-01 Thread David Pollak
On Thu, Oct 9, 2008 at 9:46 AM, Charles F. Munat [EMAIL PROTECTED] wrote: Is it possible to do joins in Lift Mapper? For example, I have a Category class that has a name and position (an int). I have a Document class that has a name, a URI, and a Category. I want to query the database and

[Lift] Re: Tools

2008-12-01 Thread David Pollak
Charles, I use NetBeans and a whole lot of printlns. In general, if you've got a case class or Scala collections, the toString methods are pretty descriptive of what's going on. I have heard tell that it's possible to hook the NetBeans debugger up to a running Jetty instance and do breakpoints

[Lift] Minor differences between mapper and record

2008-12-01 Thread Derek Chen-Becker
Hi, I'm writing the chapter on Mapper/Record right now and I was wondering why there have been small name changes between the two frameworks. Things like 1. MappedField.validations vs. Field.validators 2. MappedField.asHtml vs. Field.asXHtml (and Field.toXHtml, which seems redundant)

[Lift] Re: Tools

2008-12-01 Thread Derek Chen-Becker
I've done it in Eclipse and I'm assuming it would be similarly easy in NetBeans. There's a good article on setting up Maven remote debugging with Jetty here: http://www.mojavelinux.com/blog/archives/2007/03/remote_debugging_with_jetty/ Derek On Mon, Dec 1, 2008 at 2:43 PM, David Pollak [EMAIL

[Lift] Re: Inserting/deleting table rows with AJAX

2008-12-01 Thread Charles F. Munat
Hmm. Crap. Damn that IE. Well, I have something working in Firefox on Mac for the button. It's probably more complicated than it needs to be... def ajaxRemove(name: String, func: AFuncHolder, attrs: Tuple2[String, String]*): Elem = { val funcName = mapFunc(func) (input

[Lift] Re: Minor differences between mapper and record

2008-12-01 Thread David Pollak
On Mon, Dec 1, 2008 at 1:44 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote: Hi, I'm writing the chapter on Mapper/Record right now and I was wondering why there have been small name changes between the two frameworks. Things like 1. MappedField.validations vs. Field.validators 2.

[Lift] Compile problems with lift

2008-12-01 Thread Juha L
I'm not sure whether it is just me, but I seem to be stumbling on the Scala compiler exceptions whatever I do. First there was one when creating specs that I mailed earlier, and now I get compile problems when I changed Boot-class. I have changed Boot-class as follows. Idea is to allow different

[Lift] Re: SHtml form inputs and attributes/labels

2008-12-01 Thread David Pollak
Charles, Thanks for the suggestion. I've just checked up code that looks something like yours: def ajaxButton(text: NodeSeq, func: () = JsCmd, attrs: (String, String)*): Elem = attrs.foldLeft(button onclick={makeAjaxCall(Str(mapFunc(func)+=true)).toJsCmd+; return false;}

[Lift] Re: Compile problems with lift

2008-12-01 Thread David Pollak
The exception is an out of memory exception. What OS and RAM size are you running? On Mon, Dec 1, 2008 at 1:44 PM, Juha L [EMAIL PROTECTED] wrote: I'm not sure whether it is just me, but I seem to be stumbling on the Scala compiler exceptions whatever I do. First there was one when creating

[Lift] Re: Compile problems with lift

2008-12-01 Thread Jorge Ortiz
It might be the type checker getting confused. Try: val models: List[MetaMapper] = List(User, Game, GameUser, Hull, Ship, StarSystem) You can also call schemify with: Schemifier.schemify(true, Log.infoF _, models :_*) Instead of the foreach stuff --j On Mon, Dec 1, 2008 at 3:44 PM, Juha

[Lift] Re: Strange behavior for /index.html

2008-12-01 Thread David Pollak
Derek, I've made the default behavior to not pass requests to the container (you can change the default in LiftRules.) That will address the raw template being displayed. Now... I have no idea why you need an index and a List(index) always matches for me. Are you using 0.10-SNAPSHOT?

[Lift] Re: SHtml form inputs and attributes/labels

2008-12-01 Thread TylerWeir
Gah, this is super-handy. Thanks Chas, Dave. On Dec 1, 5:41 pm, David Pollak [EMAIL PROTECTED] wrote: Charles, Thanks for the suggestion. I've just checked up code that looks something like yours:   def ajaxButton(text: NodeSeq, func: () = JsCmd, attrs: (String, String)*): Elem =    

[Lift] Re: Minor differences between mapper and record

2008-12-01 Thread Derek Chen-Becker
I would but I have so many other things going on right now I don't want to hold things up. I don't want to sound like I'm complaining about something and not wanting to actually deal with it but my plate is pretty full :( Derek On Mon, Dec 1, 2008 at 3:21 PM, David Pollak [EMAIL PROTECTED]wrote:

[Lift] Re: Strange behavior for /index.html

2008-12-01 Thread Derek Chen-Becker
I am using 0.10-SNAPSHOT, but let me do a clean jetty:run and make sure it's still doing it. Thanks! Derek On Mon, Dec 1, 2008 at 3:44 PM, David Pollak [EMAIL PROTECTED]wrote: Derek, I've made the default behavior to not pass requests to the container (you can change the default in

[Lift] Re: Tools

2008-12-01 Thread Charles F. Munat
I've tried twice to get NetBeans up and running on my MacBook Pro with 2 gigs of RAM. Both times I made the mistake of loading in the entire liftweb library. After that -- and even after I closed the liftweb master project -- NetBeans will lock up for long periods of time (e.g. ten minutes or

[Lift] Are there printable versions of any draft Lift books?

2008-12-01 Thread mal3
Are there printable versions of any draft Lift books? It would help me and would provide an easy basis for feedback to the authors if the Lift books currently in draft were made available for easy download and printing, in say PDF format. The Scala book early access process was both useful and

[Lift] Re: Tools

2008-12-01 Thread Charles F. Munat
Cool. I hope I get time to read this really soon. Thanks! Chas. Derek Chen-Becker wrote: I've done it in Eclipse and I'm assuming it would be similarly easy in NetBeans. There's a good article on setting up Maven remote debugging with Jetty here:

[Lift] Re: Inserting/deleting table rows with AJAX

2008-12-01 Thread Charles F. Munat
Will do. Thanks. Chas. David Pollak wrote: Charles, I just checked in code that has a return false at the end of ajaxButton. If you've pulled the Lift source from GitHub, please do a fresh pull and an mvn clean install on Lift and then give it a try. Thanks, David On Mon, Dec

[Lift] Re: SHtml form inputs and attributes/labels

2008-12-01 Thread Charles F. Munat
I figured there was a better way to do it. I rewrote pretty much all of SHtml to allow adding attributes easily (which is why mine says FH instead of SHtml). This looks interesting. I'll check it out. Thanks, Chas. David Pollak wrote: Charles, Thanks for the suggestion. I've just

[Lift] Re: Tools

2008-12-01 Thread David Pollak
There was a defect in the plugin. Cauyuon posted a fix to this list last week. On Mon, Dec 1, 2008 at 3:07 PM, Charles F. Munat [EMAIL PROTECTED] wrote: I've tried twice to get NetBeans up and running on my MacBook Pro with 2 gigs of RAM. Both times I made the mistake of loading in the

[Lift] Re: Broken class in latest nightly snapshot?

2008-12-01 Thread David Pollak
I just pushed a change... change the line to: class Entry extends KeyedRecord[Entry,Long] and see if it works. On Mon, Dec 1, 2008 at 3:39 PM, Derek Chen-Becker [EMAIL PROTECTED]wrote: I'm writing up some sample code for the book (Record chapter) and I got this when trying to do a keyed

[Lift] Re: A javascript method bound to lift?

2008-12-01 Thread David Pollak
You certainly can. The easiest way is with the JsonFunc: val (jsonCall: JsonCall, jsCmd: JsCmd) = S.buildJsonFunc { case JsonCmd(DoSomething, _, s, _) = println(Got +s) Alert(You entered: +s) case _ = Noop } In your page, include: span { Script(jsCmd) // emit the JSON call } {

[Lift] Re: Testing best practices

2008-12-01 Thread David Pollak
Please make sure that you've got specs 1.4.0 and scalacheck 1.5 Also, please do an mvn clean test Thanks, David On Sat, Nov 29, 2008 at 3:45 AM, Juha L [EMAIL PROTECTED] wrote: I managed after all to find specs test example from the example webapp. Now that I try to start creating some

[Lift] Re: Tools

2008-12-01 Thread Charles F. Munat
I thought I had updated to that, but maybe I broke it before the update... Will install all the latest this time and will see what happens. But I had the same experience a couple of months ago when I tried it for the first time. I'd really like it to work, though. That would be great, and it

[Lift] Re: Tools

2008-12-01 Thread David Pollak
I'd suggest removing the ~/.netbeans directory (and anything that looks like it). On Mon, Dec 1, 2008 at 5:00 PM, Charles F. Munat [EMAIL PROTECTED] wrote: I thought I had updated to that, but maybe I broke it before the update... Will install all the latest this time and will see what

[Lift] Re: Are there printable versions of any draft Lift books?

2008-12-01 Thread TylerWeir
Please keep in mind most things are in flux. Just fair warning. :) On Dec 1, 6:11 pm, mal3 [EMAIL PROTECTED] wrote: Are there printable versions of any draft Lift books? It would help me and would provide an easy basis for feedback to the authors if the Lift books currently in draft were

[Lift] Re: Broken class in latest nightly snapshot?

2008-12-01 Thread Derek Chen-Becker
Darnit. I figured out the issue. My pom.xml had a scala.version tucked away and set to 2.7.1. Changing to 2.7.2 fixed it. Derek On Mon, Dec 1, 2008 at 4:58 PM, David Pollak [EMAIL PROTECTED]wrote: I just pushed a change... change the line to: class Entry extends KeyedRecord[Entry,Long] and