lift

IntelliJ IDEA plugin to fold .conf files?

情到浓时终转凉″ 提交于 2019-12-10 13:50:00
问题 I have a Scala app built with Lift framework. It has a few .conf files. When I open those .conf files in my IntelliJ IDEA Ultimate Fancy Pants Edition, I do not see any buttons to fold those curly braces in those files. Hotkeys do not do it either. Browsed for plugins, none applicable found. Is there any solution to enable code folding in .conf files? Update : Here is an illustration of what would be lovely. Those "-" and "+" icons do not appear in .conf files: 回答1: Those .conf files are of

Handling exceptions in Scala object constructors

馋奶兔 提交于 2019-12-10 11:34:12
问题 I'm trying to use Lift JPA and when I reference Model, it calls the super constructor I'm getting an exception: object Model extends LocalEMF("LiftPersistenceUnit") with RequestVarEM The problem is that the exception is hidden behind this exception: java.lang.NoClassDefFoundError: Could not initialize class... So, my question is: what is the best way to log/handle exceptions in this case? Alternatively, can anyone recommend another pattern to use Lift JPA? The way Model has been code is the

How do I access the fields of a link-table with Lift Mapper?

雨燕双飞 提交于 2019-12-10 11:34:01
问题 From the Lift-Web Mapper model below, how do I access the fields under AssignmentformLink? object TForm extends TForm with LongKeyedMetaMapper[TForm] class TForm extends LongKeyedMapper[TForm] with IdPK with ManyToMany { def getSingleton = TForm object label extends MappedString(this, 40) object pattern extends MappedString(this, 200) object assignments extends MappedManyToMany( AssignmentformLink, AssignmentformLink.assignment, AssignmentformLink.form, TForm) } object AssignmentformLink

Can snippets take parameters in lift?

只愿长相守 提交于 2019-12-10 01:21:20
问题 Is there a way in lift to pass parameters to snippets? I am trying to write a pluraize filter for my page that will display the word "user" or "users" depending on how many there are: 1 user 2 users The way it works in Django is called filters and they are written as follows: You have {{ num_messages }} message{{ num_messages|pluralize }}. So here you can see pluralize function takes an integer num_messages and outputs and appropriate string - either empty "" or "s". EDIT: Note that the num

how to read a file from a lift webapp

[亡魂溺海] 提交于 2019-12-09 18:29:27
问题 I want to read xml file in my lift app: val data = XML.load(new java.io.InputStreamReader(new java.io.FileInputStream(filename), encoding)); However, I am getting java.io.FileNotFoundException . where should I put the file, and what is the correct path from my scala code? BTW - I am using embedded jetty for my testing, although I need a solution for dev env and production. 回答1: There might be better solution for other paths but there is var LiftRules.getResource : (String) ⇒ Box[URL] or def

Best way to create a login/logout form in Scala using Lift

我的梦境 提交于 2019-12-09 18:24:13
问题 As more and more people are interested in Scala (like myself), rather than a question, I'd like to discuss one implementation of a login/logout snippet for a webapp based on Lift . I just started to learn Scala and Lift so it's probably not the best way to implement such a feature but I'd like to share it for other beginners and discuss it with more experienced developers. Please note that I'm also not an expert in web development. Any help for improvements would be greatly appreciated

Scala and Java in same project

ⅰ亾dé卋堺 提交于 2019-12-09 17:26:15
问题 Can I use Scala and Java in the same project? I am new with programming so it's a litte bit confusing for me. From my research I have read that the best combination to get a good project is the combination Java/Spring or Scala/Lift. Why do these combinations exist? Is it not possible to use Scala with Spring or Java with Lift? In case I use Scala, should I have the whole configuration in Scala code? Or can I have external resources so I shouldn't modify every time the Scala code. 回答1: Q. Can

IntelliJ IDEA doesn't load Lift libraries from a SBT project

China☆狼群 提交于 2019-12-09 16:55:32
问题 I've created a blank project via sbt using the most basic guide, specifically: > cd xyz > sbt # here we create a new project w/ Scala 2.8.1 > *lift is org.lifty lifty 1.6.1 > lift create project-blank however when I open the project in IntelliJ, it doesn't correctly recognize .jars downloaded via sbt. All imports are red and when I go to project settings ( Ctrl + Alt + Shift + S ) in Libraries section, they are all greyed out. Apart from that, the project sources are correctly recognized as

Extracting lift-json into a case class with an upper bound

拈花ヽ惹草 提交于 2019-12-09 12:04:54
问题 I have spent the last day searching and reading various sites and articles to try to find the answer to this question myself and I haven't found anything that helps. I'm not even sure if this is feasible. My problem is that I am trying to parse and extract a Json Response using lift-json. The response consists of 4 parts, where the first 3 parts are always the same for every response to every type of request I make. The last part varies depending on the type of request, but it is always going

Can I use the Scala lift-json library to parse a JSON into a Map?

浪尽此生 提交于 2019-12-09 09:23:46
问题 Is there a way to use the lift-json library's JObject class to act like a Map? For example: val json = """ { "_id" : { "$oid" : "4ca63596ae65a71dd376938e"} , "foo" : "bar" , "size" : 5} """ val record = JsonParser.parse(json) record: net.liftweb.json.JsonAST.JValue = JObject(List(JField(_id,JObject(List(JField($oid,JString(4ca63596ae65a71dd376938e))))), JField(foo,JString(bar)), JField(size,JInt(5)))) </code> I would have expected record("foo") to return "bar" I noticed a values function and