[Lift] Re: Sermo, persistent comet chat example
Hello list, Since I am presenting this Sermo example to an audience I want to understand how to flow of it works in more detail. When a new Chat CometActor is created it does the following 1. calls LocalSetup that register it with the ChatServer. 2. ChatServer then sends back the messages that are already there 3. lowPriority in Chat is called and partialUpdates the page with the messages. ( is this really done when the Chat cometActor registeres the first time? I would think that render should bind the content initially?) 4. localSetup is done so PerformReRender is called that again calls render 5. render binds the conent Is this the correct flow? When is fixedRender called? regards Bjarte On Mon, Sep 14, 2009 at 11:46 PM, Bjarte Stien Karlsen bjarte.stien.karl...@gmail.com wrote: Thanks, I googled a little bit and found this sollution myself as well :) Will push it to github any minute now. mvh Bjarte On Mon, Sep 14, 2009 at 11:42 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Sep 14, 2009 at 2:17 PM, Bjarte Stien Karlsen bjarte.stien.karl...@gmail.com wrote: Hello David, Thanks for your comments. So you mean that instead of using m.id.obj then I should fetch all users in a map and lookup in that instead? import mapper._ private var chats: List[Message] = Message.findAll(PreCache(Message.user)).reverse This will pre-cache the user object in each Message instance. mvh Bjarte On Mon, Sep 14, 2009 at 10:39 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Sep 14, 2009 at 1:18 PM, Bjarte Stien Karlsen bjarte.stien.karl...@gmail.com wrote: Hello lifted, Today i created Sermo [1] as the title says a persistent comet based chat example. I copied code from demo.liftweb.net/chat and modified to support - user's firstname + lastname is the username in the chat - messages are persisted in the message table and loaded when the chat server starts up. - chat is added as a page that requires user login I plan to use this example as a demo in a upcomming talk about lift. The reason I wanted a example that is a little bit more complex then the 50 line comet example is to show some more of lifts features. Comments and suggestions are very welcome. I had the honor to show Lift off to Phillip Wadler last year. I did the chat example and he asked How would you persist the chats? The code I came up with was surprisingly similar to your code. The only suggestion that I would have is to PreCache the Message.user fields to get better start-up performance. [1] http://www.github.com/bjartek/Sermo -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Sermo, persistent comet chat example
Hello lifted, Today i created Sermo [1] as the title says a persistent comet based chat example. I copied code from demo.liftweb.net/chat and modified to support - user's firstname + lastname is the username in the chat - messages are persisted in the message table and loaded when the chat server starts up. - chat is added as a page that requires user login I plan to use this example as a demo in a upcomming talk about lift. The reason I wanted a example that is a little bit more complex then the 50 line comet example is to show some more of lifts features. Comments and suggestions are very welcome. [1] http://www.github.com/bjartek/Sermo -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Sermo, persistent comet chat example
Hello David, Thanks for your comments. So you mean that instead of using m.id.obj then I should fetch all users in a map and lookup in that instead? mvh Bjarte On Mon, Sep 14, 2009 at 10:39 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Sep 14, 2009 at 1:18 PM, Bjarte Stien Karlsen bjarte.stien.karl...@gmail.com wrote: Hello lifted, Today i created Sermo [1] as the title says a persistent comet based chat example. I copied code from demo.liftweb.net/chat and modified to support - user's firstname + lastname is the username in the chat - messages are persisted in the message table and loaded when the chat server starts up. - chat is added as a page that requires user login I plan to use this example as a demo in a upcomming talk about lift. The reason I wanted a example that is a little bit more complex then the 50 line comet example is to show some more of lifts features. Comments and suggestions are very welcome. I had the honor to show Lift off to Phillip Wadler last year. I did the chat example and he asked How would you persist the chats? The code I came up with was surprisingly similar to your code. The only suggestion that I would have is to PreCache the Message.user fields to get better start-up performance. [1] http://www.github.com/bjartek/Sermo -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Sermo, persistent comet chat example
Thanks, I googled a little bit and found this sollution myself as well :) Will push it to github any minute now. mvh Bjarte On Mon, Sep 14, 2009 at 11:42 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Sep 14, 2009 at 2:17 PM, Bjarte Stien Karlsen bjarte.stien.karl...@gmail.com wrote: Hello David, Thanks for your comments. So you mean that instead of using m.id.obj then I should fetch all users in a map and lookup in that instead? import mapper._ private var chats: List[Message] = Message.findAll(PreCache(Message.user)).reverse This will pre-cache the user object in each Message instance. mvh Bjarte On Mon, Sep 14, 2009 at 10:39 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Mon, Sep 14, 2009 at 1:18 PM, Bjarte Stien Karlsen bjarte.stien.karl...@gmail.com wrote: Hello lifted, Today i created Sermo [1] as the title says a persistent comet based chat example. I copied code from demo.liftweb.net/chat and modified to support - user's firstname + lastname is the username in the chat - messages are persisted in the message table and loaded when the chat server starts up. - chat is added as a page that requires user login I plan to use this example as a demo in a upcomming talk about lift. The reason I wanted a example that is a little bit more complex then the 50 line comet example is to show some more of lifts features. Comments and suggestions are very welcome. I had the honor to show Lift off to Phillip Wadler last year. I did the chat example and he asked How would you persist the chats? The code I came up with was surprisingly similar to your code. The only suggestion that I would have is to PreCache the Message.user fields to get better start-up performance. [1] http://www.github.com/bjartek/Sermo -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Lift deal breakers
Hey, If I understand Dustin correctly here he wants unobtrusive javascript. That is no javascript in the elements but javascript code that hooks into the dom and attaches events as needed. I am not familiar enough with the internals of lift's js wrapping to know how easy it would be to do it this way. regards Bjarte On Sat, Sep 12, 2009 at 5:30 AM, DMB combust...@gmail.com wrote: I'm not sure how you'd implement an _ajax_ Button without Javascript. :-) I also don't see how it is bad for SEO. These days, depending on the page and search engine, Javascript either gets executed (if there are JS blocks that run onload or inline) or ignored. In case of less popular pages, JS is nearly always ignored, for indexing performance reasons. On Sep 11, 7:13 pm, Dustin Whitney dustin.whit...@gmail.com wrote: Hey, I like Lift so in an effort to improve it I am submitting some criticism. Obtrusive javascript: when I create an ajaxButton I get this html: button onclick=liftAjax.lift_ajaxHandler(quot;F1029758482780OTA=truequot;, null, null, null); return false;Press me/button That onclick is not ok. It's bad for SEO and makes the page harder to read. Ideally, no javascript should appear on the page whatsoever. Client Side Load Time: I strive for that A in Y-Slow, so when I see script type=text/javascript src=/ajax_request/liftAjax.js view-source:http://localhost:8080/ajax_request/liftAjax.js/script at the top of the page, I feel a little uneasy, and there is nothing I can do (I think) to move it to the bottom of the page. -Dustin -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Mastering SiteMap
I think this is a very nice post Peter. Some other issues that would be nice to discuss related to menus are - submenus that are shown when you open the parent menu element - example on how to only see some items when logged in - example on how to only see some items if you are a admin level user ( Lift afaik does not have role level authentication but checking on a role flag in the user table should not be that hard? ) mvh Bjarte On Fri, Sep 4, 2009 at 12:53 AM, Peter Robinettpe...@bubblefoundry.com wrote: Hi all, I haven't been able to find many detailed explanations about how use SiteMap, so I went through and tried write up a decent walkthrough: http://www.bubblefoundry.com/blog/2009/09/understanding-lifts-sitemap/ My knowledge is still pretty basic, so I'd appreciate any comments and corrections. One question I still have is what is the use of the views folder under the src/main/myapp/ in the standard directory configuration? As I understand it, you don't put XHTML view files there – they need to be in src/main/myapp/webroot/. Am I misunderstanding the terminology and something else is a View with goes in that directory? Thanks, Peter Robinett -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Newbie Question design pattern for ORM in Lift
That looks very cool from a first glance. mvh Bjarte On Fri, Aug 28, 2009 at 5:04 AM, rstradlingryanstradl...@gmail.com wrote: git clone git://github.com/rstradling/DDLtoLiftORM.git is the location of the git code. http://github.com/rstradling/DDLtoLiftORM is the web address I hope this is helpful to others. On Aug 27, 3:13 pm, rstradling ryanstradl...@gmail.com wrote: Thanks for the answers everyone. What David hit upon about wanting objects to be subclassible is the conclusion I came to that would work..if it existed. I was hoping there was a way. :(. Well, I guess Naftoli has provided a possible solution but seems more involved than I have the experience for. I will resort to putting the stuff on the generated classes and let merge tools do the rest. Regarding sharing the codeI should be more specific in that it parses ddl. To be honest, I hope you all are not hoping for muchbut I will get it up on github and when I do will reply to this thread with the location. On Aug 27, 1:35 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, Aug 27, 2009 at 10:26 AM, rstradling ryanstradl...@gmail.comwrote: With a parser combinator I wrote to parse .sql and it outputs scala orm files. Care to share? That'd be a pretty darned useful utility! Please note it is very specific to my needs (i.e. only works with certain grammars (INSERTS) but that particular grammar is all I needed to process at the time) but is written in a way that could be extended to the full grammar (at least that was my intent :).. So... the problem is that objects in Scala are not subclassible. What does this mean? For example: trait Foo { object bar extends AnyRef } trait MyFoo extends Foo { override object bar { def cantDoIt = sigh } } Back in the Scala 2.5 days, there was some talk about allowing this to happen, but it never did. So, unfortunately, I can't think of a way for your sql generator to create a superclass that could be subclassed and have the effect that you want. Sorry/ On Aug 27, 1:09 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: How do you auto-generate them? On Thu, Aug 27, 2009 at 1:03 PM, rstradling ryanstradl...@gmail.com wrote: I am using Lift 1.0 with the Mapper ORM module from Lift. I am a newbie to Scala and Lift. I have auto-generated my ORM classes from a .sql file. Given that these classes are auto-generated I would prefer not to edit them directly and provide additional functionality via inheritance. Say I have the following... class StatGenerated extends LongKeyedMapper[StatGenerated] with IdPK { def getSingleton = StatGenerated object errors extends MappedLong(this) object hits extends MappedLong(this) object AB extends MappedLong(this) } object StatGenerated extends StatGenerated with LongKeyedMetaMapper [StatGenerated] { override def fieldOrder = List(errors, hits) } class Statistics extends StatGenerated { def GetBattingAverage(id : Long) : float = { val stat = Stat.findByKey(id) stat.hits/stat.AB } } Now what I would like to do is work with the Statistics class as my ORM object... But I believe everything that is ORM related is actually of type StatGenerated rather than Statistics. i.e. findByKey will return me a StatGenerated rather than a Statistics class. Is there any clever way around this that I am missing without either modifying the generated class or duplicating code? -- 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 -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Comet Chat
Thanks for your answers David and Wilson. mvh Bjarte On Mon, Aug 24, 2009 at 9:39 PM, David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 24, 2009 at 12:20 PM, Wilson MacGyver wmacgy...@gmail.com wrote: Hi Bjarte, I am the one who wrote that post. It came out of a 1 hour presentation that I did for my local java user group to show what lift can do. So it was very minimal. Since most people attending are new to both Scala and Lift. I second David's suggestion. For a more full featured version check out http://demo.liftweb.net/chat In fact http://demo.liftweb.net/ has quite a bit of example. And I believe all the code are also available from David Pollak's github repo. All the demo.liftweb.net code is part of the Lift source distribution found at http://github.com/dpp/liftweb/tree/master Thanks, Mac On Mon, Aug 24, 2009 at 12:05 PM, Bjarte Stien Karlsenbjarte.stien.karl...@gmail.com wrote: Hello lifted, I am playing around with the 50ish line based comet example that dpp has talked about in several talks and that is written more about here: http://m.3wa.com/?p=304 Today I showed this to a friend and it looks like the focus of the input box is lost when an update is received. Does anybody have a clue on how this can be fixed? Is it not possible to just update part of the DOM without having to steal the focus from the input field? -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com -- Omnem crede diem tibi diluxisse supremum. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Comet Chat
Hello lifted, I am playing around with the 50ish line based comet example that dpp has talked about in several talks and that is written more about here: http://m.3wa.com/?p=304 Today I showed this to a friend and it looks like the focus of the input box is lost when an update is received. Does anybody have a clue on how this can be fixed? Is it not possible to just update part of the DOM without having to steal the focus from the input field? -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Recent presentation to the Boulder JUG
Watching this talk now and loving it. Do you have the slides online somewhere since they are kind of hard to read on the video? mvh Bjarte On Tue, Aug 18, 2009 at 7:01 AM, marius d.marius.dan...@gmail.com wrote: Great talk Derek !!! Br's, Marius On Aug 18, 2:46 am, Derek Chen-Becker dchenbec...@gmail.com wrote: http://blip.tv/file/2485411 A big thanks to BJUG and especially Fred Jean for recording this. I'll be giving another talk in December to the Denver Open Source User Group (DOSUG). Hopefully we'll have some exciting announcements concerning 1.1 by then! Derek -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: TableSorter and Crudify
Awesome! Where did you put this to get it to work? It would be nice to have this built into Lift as an option since tablesorter is very usefull for large lists of stuff. mvh Bjarte On Fri, Jul 17, 2009 at 9:23 AM, Andrea Peruffoa.peru...@mcmspa.it wrote: Solved: There is some trouble resolving the path of the javascripts library, with the first / is ok and without it doesn't works. override def _showAllTemplate = lift:crud.all head script id=jquery-metadata src=/style/javascript/jquery-metadata.js type=text/javascript/script script id=jquery-tablesorter src=/style/javascript/jquery-tablesorter.js type=text/javascript/script script id=jquery-tablesorter-pager src=/style/javascript/jquery-tablesorter-pager.js type=text/javascript/script script type=text/javascript {$(document).ready(function(){$('#myTable').tablesorter({widthFixed: true, widgets: ['zebra']}).tablesorterPager({container: $('#pager')});});} /script /head table id=myTable class=tablesorter thead tr crud:header_itemthcrud:name//th/crud:header_item thnbsp;/th ... and so on... Il Thursday 16 July 2009 19:28:13 Andrea Peruffo ha scritto: Hello, I'm extending the crudify to use tablesorter as default into the list table, but it looks like jquery cannot be used in the page. I've imported it in the default page wrapper and I have no problem (also with the same code) in the pages that I create manually... Any idea? This is an example: override def _showAllTemplate = lift:crud.all head script type=text/javascript {$(document).ready(function(){alert('Pippo');});} /script /head table id=myTable class=tablesorter thead tr... and so on But after calling the page no alert are displayed... I cannot figure out why (my browser is FF) Thanx in advance Chi riceve il presente messaggio e' tenuto a verificare se lo stesso non gli sia pervenuto per errore. In tal caso e' pregato di avvisare immediatamente il mittente e, tenuto conto delle responsabilita' connesse all'indebito utilizzo e/o divulgazione del messaggio e/o delle informazioni in esso contenute, voglia cancellare l'originale e distruggere le varie copie o stampe. The receiver of this message is required to check if he/she has received it erroneously. If so, the receiver is requested to immediately inform the sender and - in condideration of the responsibilities arising from undue use and/or disclosure of the message and/or the information contained therein destroy the original message and any copy or printout thereof. Die Information dieses e-mails ist vertraulich und ausschließlich für den Adressaten bestimmt. Der Empfänger dieses e-mails der nicht der Adressat ist (sowie einer seiner Mitarbeiter oder sein Empfangsberechtigter), darf den Inhalt nicht verwenden, weitergeben oder reproduzieren. Sollten Sie dieses e-mail irrtümlich erhalten haben, benachrichtigen Sie bitte den Absender und vernichten Sie dieses e-mail. -- Bjarte Stien Karlsen Ronatoppen 6a, 4638 Kristiansand 95219547 MSN: m...@ibjarte.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---