2014年6月2日星期一

playframework メモ

1
単独なjarファイルの導入
The lib/ directory
The lib directory is optional and contains unmanaged library dependencies, ie. all JAR files
you want to manually manage outside the build system. Just drop any JAR files here and they
will be added to your application classpath
 2
json bodyParserを指定した場合、requestの中にjsonのbodyを含まないと、400BadRequestになる

3
play 2.1 [BUG]
play distの後、playのdefault logger.xmlが使用されます、confの中のcustomized logger.xmlじゃない。手動で  -Dlogger.resource=mylogger.xml に指定する必要がある。

4
play 2.2.2
Json.formatはマクロだが、書き順番もありました。
----
implicit val userFmt = Json.format[UserModel]
case class UserModel
--- OK
case class UserModel
implicit val userFmt = Json.format [UserModel]
--- Error

5
play 2.2.3
GET にbodyが使えない、nettyがエラーになる、HTTP標準に違反

6
myakka のconf設定をapplication.confに書き込む方法:
myakka {
akka{
loglevel = DEBUG
stdout-loglevel = DEBUG
log-config-on-start = off

7
play common projectの作り方:
---play 2.2.2---
lazy val root = project in file(".") aggregate (module1, module2)
lazy val module1 = ProjectRef(file("../existing-codebase/module1"), "module1")
lazy val module2 = ProjectRef(file("../existing-codebase/module2"), "module2")
---play 2.2.3---
build.sbtに追加
lazy val proj = project.in(file("."))
    .aggregate(common)
    .dependsOn(common)

lazy val common = ProjectRef(file("../common"), "common")

scala メモ

1
Arrayはmutable,immutableじゃない

2014年4月21日星期一

scala method定義重複

scalaで同じ名前で複数種類のparameterでのmethodを定義する時に、重複エラーが発生しました。

def m(a:String = "AAA") = ???
def m(a:String = "AAA", b:String) = ???

上記の問題はコンパイルする時に、

def m$default$AAA = "AAA"

にコンパイルされる。ここは重複している。

名前を変えるしかないね。

参考先:
http://stackoverflow.com/questions/4652095/why-does-the-scala-compiler-disallow-overloaded-methods-with-default-arguments