d6y / lift-cookbook Goto Github PK
View Code? Open in Web Editor NEWASCII Doc source for Lift Cookbook
License: Other
ASCII Doc source for Lift Cookbook
License: Other
Problem:
You want to have Less files compiled to CSS as part of your development cycle.
Solution:
Use less sbt (apparently this is the popular choice according to the mailing list).
Discussion:
Other plugins are available.
Links
The sample on http://cookbook.liftweb.net/#LiftFromScratch doesn't work with sbt 0.12.2 for fix it: sbt/sbt#499 (comment)
I think it would be a great idea to use disqus to add comment support to each page to make it even easier for people to give feedback.
I don't mind implementing it and send a pull request to pamflet but I wanted to make sure that you guys also think it's a good idea before going forward :)
/Mads
Problem:
You want a regular HTML form and process the values on the server.
Solution:
Use StatefulSnippet and instance vars.
(insert example here)
Discussion:
Because... https://groups.google.com/forum/?fromgroups#!topic/liftweb/2pxQf4VMk-c and the links from it
RequestVars are good for sharing between snippets. Don't work for comet.
"The purpose of RequestVars is to share state across snippets during a single request. I advise against using RequestVars when snippet instance variables are available." (dpp in https://groups.google.com/forum/?fromgroups#!msg/liftweb/gTkrnu8588o/dxaKFPrI5y4J)
Mention Wizard as another useful way to handle simple form stuff?
See also
4.3 Stateful Snippets
http://simply.liftweb.net/index-4.3.html
4.4 RequestVars
http://simply.liftweb.net/index-4.4.html
Problem: you want to see your site changes faster, using JRebel to reload your changes.
Solution:
pointer to JRebel site
changes to SBT start up and build.sbt
Discussion:
It's free for open source Scala devs.
0350-Pipelline should be 0350-Pipeline
:-)
All of the sudden you get java.lang.AbstractMethodError errors at runtime using lift-json. You also use dispatch
answer:
Dispatch uses lift-json internally, this results in having two different versions of lift-json in your classpath
If you are using sbt, enter this in your build.sbt
"net.databinder" %% "dispatch-lift-json" % dispatchVersion intransitive()
see also:
[enter new page for "Potentially incompatible versions of dependencies of {file:/.....i/}default-32219c:org.scala-lang: 2.9.1, 2.9.0-1"] warning when compiling your project
Problem: you have a list you want to display, using the same HTML template for each item in the list.
Solution:
.fields" #> (".label *" #> List("Cat", "Dog"))
for
<div class="fields">
<div class="label">Field Label</div>
</div>
(or see wiki entry for example to use)
Discussion
Show case for label and description as per mailing list discussion.
See also:
http://www.assembla.com/spaces/liftweb/wiki/Binding_via_CSS_Selectors
You have text with new line characters and you want to replace them with br tags for display.
Solution: if pre doesn't do what you want use:
text.split("\n").toList flatMap { Text(_) ++ <br/> } init
Discussion:
Possibly discuss Lift's escaping safety mechnism.
Possibly discuss \n vi \r\n
Textile also supports this, but produces valid html (i.e., body tags etc). I think. Check that
See:
Write up an example of Autocomplete
See mailing list: [Lift] Scala Lift AutoComplete
Problem:
You want to work with Eclipse, developing web applications, hitting refresh in your browser and see the changes.
Solution:
pointer to Scala IDE for Eclipse plugin.
sbt eclipse plugin
running Jetty in a shell window.
Discussion:
global v. per-project sbt config
better with JRebel
Problem: you want to see your site changes faster, using JRebel to reload your changes.
Solution:
pointer to JRebel site
changes to SBT start up and build.sbt
Discussion:
It's free for open source Scala devs.
See e.g., [Lift] How to do file upload in ajax form? and https://groups.google.com/forum/m/?fromgroups#!topic/liftweb/OuN1sqRMO_c
You want to trigger a function on the server from a button press.
Solution: SHtml.ajaxInvoke
Discussion: explain signature of ajaxInvoke. Possibly mention jsonCall.
From:
and
http://blog.fmpwizard.com/scala-lift-custom-wizard (search for Call Scala code from JavaScript.)
Write about pagination in the context of Record.
See: "Paginator problem" on the mailing list and https://www.assembla.com/spaces/liftweb/wiki/Pagination
Would be a great convenience to readers if the text were packaged as a downloadable ePUB file on GitHub.
Hi Richard,
Love your idea of the cookbook.
I wrote some time ago a blog post on how to create a new project with maven and setup Intellij to run and debug the project.. It has a few screenshots that always help!
The post is here
You are free to copy the content to your cookbook or link the post, whatever suits!
If I'll have something else will definitely get in touch!
Cheers
You want to see the SQL being executed by SQueryl
answer:
org.squeryl.Session.currentSession.setLogger( s => println(s) )
perhaps use logger instead?
discuss:
what other options are there?
see also:
squeryl links
FInd a place to link to this: https://fmpwizard.telegr.am/blog/adding-fields-dynamically-lift
You want to run against the latest-and-greatest Lift snapshot.
Solution:
sbt changes from the example build.sbt given as the first cookbook recipe
e.g., for low-level operations on a collection
A blue square is a bit dull.
"I have one complaint though. I have a Big monitor - Apple 30" 2560x1600. I have my browser taking up almost the entire screen and so there's this gigantic empty spot on one side, a gigantic empty spot on the other side and a teeny little strip of text in the middle. Is there a way to change the formatting so that it makes better use of
the available space?"
Problem: You want to debug your Lift application from Eclipse.
Solution: ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.