我有以下文件
/app/menus/menu1.yml
Run Code Online (Sandbox Code Playgroud)
我想阅读它的内容
-
简答:
fileContent = play.vfs.VirtualFile.fromRelativePath("/app/menus/menu1.yml").contentAsString();
Run Code Online (Sandbox Code Playgroud) 在验证几个连续条件时,我经常会遇到很多嵌套的.map和.getOrElse
例如:
def save() = CORSAction { request =>
request.body.asJson.map { json =>
json.asOpt[Feature].map { feature =>
MaxEntitiyValidator.checkMaxEntitiesFeature(feature).map { rs =>
feature.save.map { feature =>
Ok(toJson(feature.update).toString)
}.getOrElse {
BadRequest(toJson(
Error(status = BAD_REQUEST, message = "Error creating feature entity")
))
}
}.getOrElse {
BadRequest(toJson(
Error(status = BAD_REQUEST, message = "You have already reached the limit of feature.")
))
}
}.getOrElse {
BadRequest(toJson(
Error(status = BAD_REQUEST, message = "Invalid feature entity")
))
}
}.getOrElse {
BadRequest(toJson(
Error(status = BAD_REQUEST, message = "Expecting …Run Code Online (Sandbox Code Playgroud) 我正在寻找一个完整的,响应迅速的管理主题,用于我计划开发的开源项目.
是否有一些开源管理存储库,其中包含用于twitter bootstrap的管理主题?
themes responsive-design twitter-bootstrap twitter-bootstrap-3
有谁知道任何优秀的开源立方体浏览器?
理想情况下,它将使用普通的javascript构建.
它甚至存在吗?
我正计划将它与经典的asp再次使用一个SQL数据库.
我只想和groovy玩一点
我正在考虑开发自己的小型Web框架,非常简单和易于管理......
所以我想使用GSP页面,而不必安装整个grails的东西,包括所有依赖项和幕后框架......
任何人都可以提供有关下载内容,安装位置,如何配置tomcat等的详细说明...
到目前为止我发现的一些信息
这非常接近我正在寻找的东西,但仍然不知道下载什么,在哪里保存,等等......
看看这里说的是什么......
GSP不作为独立模块进行维护.但它已经在Grails中分叉并重新整合.
?
我收到一条带有未知变量名元素的xml消息......也就是说,它们不是预定义的...
我只知道可以有0个或更多这些元素,其他一些是强制性的......
例如
<root>
<service>my service</service>
<resource>my resource</resource>
<action>update</action>
<parameters>
<field1>value1</field1>
<field2>value2</field2>
<field3>value3</field3>
</parameters>
</root>
Run Code Online (Sandbox Code Playgroud)
也就是说,我不知道将作为"参数"传递什么,我只知道将有0个或更多元素具有值,不允许更深层标记嵌套....
我在考虑类似的事情
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="service" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element name="resource" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element name="action" type="xs:string" minOccurs="1" maxOccurs="1" nillable="false"/>
<xs:element name="parameters">
<xs:complexType>
<xs:element name="*" maxOccurs="unbounded">
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
当然,困难的部分是
<xs:element name="*" maxOccurs="unbounded">
Run Code Online (Sandbox Code Playgroud)
有可能做一件事吗?
如何定义验证此类消息的xsd文件?
-
我检查了w3c的参考资料
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/datatypes.html#NCName
它说:
"NCName的词法空间是所有字符串的集合,它们与[XML中的命名空间]的NCName生成相匹配."
这是什么意思?
除此之外......您能否提出一些简单的方法来测试xsd定义的合规性?
有什么方法可以告诉sql server使用(nolock)提示或存储过程中的每个选择?
将每个选择添加到每个选项中是非常烦人的....
这有点让我感到困惑
以下代码编译好了:
def save: Action[AnyContent] = Action {
if (1 == 2) {
BadRequest(toJson("something went wrong"))
} else {
Ok(toJson(Feature.find))
}
}
Run Code Online (Sandbox Code Playgroud)
但如果我只是添加return语句,我得到以下内容:
def save: Action[AnyContent] = Action {
if (1 == 2) {
return BadRequest(toJson("something went wrong"))
} else {
return Ok(toJson(Feature.find))
}
}
[error] found : play.api.mvc.SimpleResult[play.api.libs.json.JsValue]
[error] required: play.api.mvc.Action[play.api.mvc.AnyContent]
[error] return BadRequest(toJson("something went wrong"))
Run Code Online (Sandbox Code Playgroud)
我以为这两个代码是等价的......
BTW,Action是一个伴随对象,它有一个apply方法,它接收一个形式的函数:Request [AnyContent] => Result,并返回一个Action [AnyContent]
看起来像return语句,块返回直接执行BadRequest的结果...而且Ok ...而不是返回将块传递给Action对象伴侣的结果...
我对吗?
注意:我正试图找到摆脱这么多嵌套map和getOrElse的方法
ps:对不起,如果问题有点混乱,我很困惑自己......
在play的2.0.x doc中,您可以看到如何安排异步任务:
http://www.playframework.org/documentation/2.0.4/ScalaAkka
Akka.system.scheduler.schedule(0 seconds, 30 minutes, testActor, "tick")
Run Code Online (Sandbox Code Playgroud)
你怎么能用最近的重新播放Play 2.1来实现同样的目的?
整个akka API似乎已经改变了......
我检查过:
https://github.com/playframework/Play20/wiki/Highlights https://github.com/playframework/Play20/wiki/Migration以及 http://doc.akka.io/docs/akka/2.1.0- RC1 /项目/迁移指南-2.0.x版本,2.1.x.html
也在这里问:https://groups.google.com/d/topic/play-framework/7VcwNea6QlM/discussion
我正在使用select2,我想将多色表显示为下拉列表,因此我需要下拉容器的宽度与输入本身具有不同(更大)的宽度
有可能吗?
此外,我想展示一个包含多个列的表格.从电影示例中,我看到在formatResult函数中,您为每一行创建一个新表.
是否可以在同一个表中包含每一行,以便每个单元格具有相同的宽度?我需要设置一些模板来包含行或类似的东西.
我想要实现的是显示实体代码的小输入,以及显示更多列的大型下拉列表
-
这是关于github的相关问题:https://github.com/ivaynberg/select2/issues/1314
javascript ×2
scala ×2
akka ×1
cube ×1
database ×1
dropdownbox ×1
file ×1
filesystems ×1
grails ×1
groovy ×1
gsp ×1
installation ×1
locking ×1
nolock ×1
olap ×1
select ×1
sql ×1
sql-server ×1
styles ×1
themes ×1
widget ×1
xml ×1
xsd ×1