Te Lif Framework for Fun and Proft
Peter Robinett peter@bubblefoundry.com for DUSE VI, 2010-06-30
Te Lif Framework for Fun and Proft Peter Robinett - - PowerPoint PPT Presentation
Te Lif Framework for Fun and Proft Peter Robinett peter@bubblefoundry.com for DUSE VI, 2010-06-30 Who am I? Background in web programming with interpreted languages (PHP, Python, Javascript, etc) Likes long walks on the beaches
Peter Robinett peter@bubblefoundry.com for DUSE VI, 2010-06-30
interpreted languages (PHP, Python, Javascript, etc)
has minor commit to lift-flot to my name
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 inspired by Seaside, Rails, Django, Wicket, and beyond.
<lift:comet type=”Clock”> The time is <clock:time />. </lift:comet> class Clock extends CometActor {
// schedule a ping every 10 seconds so we redraw ActorPing.schedule(this, Tick, 10 seconds) private lazy val spanId = uniqueId+"_timespan" def render = { bind("time" -> timeSpan) } def timeSpan = (<span id={spanId}>{timeNow}</span>)
case Tick => partialUpdate(SetHtml(spanId, Text(timeNow.toString))) ActorPing.schedule(this, Tick, 10 seconds) } } case object Tick
Allows great AJAX, Comet support.
BUT, there were issues with the EFPL library so David wrote
Template:
<lift:DuSE.sayHello> Hi <DuSE:name />. It's now <DuSE:datetime />. </lift:DuSE.sayHello>
Snippet:
import java.util.Date import scala.xml.{NodeSeq, Text} import net.liftweb.util.Helpers.bind
def sayHello(xhtml: NodeSeq): NodeSeq = { User.currentUser.map(user => { bind(“DuSE”, xhtml, “name” -> Text(user.shortName), “datetime” -> Text((new Date).toString) ) }) openOr <div>You didn't log in!</div> } }
Routing is done via SiteMap...
LiftRules.statefulRewrite.prepend({ case RewriteRequest(ParsePath("app" :: appID :: "index" :: Nil, _, _,_), GetRequest, _) => RewriteResponse("app":: "view" :: Nil, Map("appID" -> appID) })
... and redirects with partial functions!
val entries = Menu(Loc(“App Page”, “app” :: “view” :: Nil, “App Page”) :: Nil LiftRules.setSiteMap(SiteMap(entries :_*))
Regex Free!
already know Lift)
possible)
if you're not careful
By Markus Lütkemeyer http://flickr.com/photos/helico/2245863081/
By Alan Sung http://flickr.com/photos/clsung/310886130/
use 'official' releases, wait a week for 2.0.
see 3.0-SNAPSHOT after the 2.0 release.
http://groups.google.com/group/liftweb
http://www.liftweb.net/docs/getting_started.html
http://www.assembla.com/wiki/show/liftweb/
http://scala-tools.org/mvnsites-snapshots/liftweb/
http://github.com/lift/lift *
* Yep, since last night we've been using the new GitHub organizations
simple-build-tool is THE way to do Scala projects. See http://www.assembla.com/wiki/show/liftweb/Using_SBT OR git clone git://github.com/dpp/lift_sbt_prototype.git Then cd into lift_sbt_prototype and type: sbt At the sbt prompt, type: update Then: jetty-run Point your browser to http://localhost:8080/
Mads Hartmann is working on sbt processors for Google Summer of Code. It should be awesome.
http://www.assembla.com/wiki/show/liftweb/Using_Maven
mvn archetype:generate \
mvn jetty:run mvn scala:cc (jRebel license: http://www.zeroturnaround.com/scala-license/)
http://demo.liftweb.net/ http://github.com/lift/lift/tree/master/examples/ http://github.com/dpp/lift-samples http://www.liftweb.net
By Gillian Maniscalco http://flickr.com/photos/gillian_m/448800043/