我正在尝试添加securesocial到我的Play 2.3.x项目中.这是我的build.sbt文件中的内容.
resolvers += Resolver.sonatypeRepo("releases")
libraryDependencies += "ws.securesocial" %% "securesocial" % "2.1.4"
Run Code Online (Sandbox Code Playgroud)
这是我得到的堆栈跟踪
[info] Loading project definition from /home/chris/dev/suredbits-web/project
[info] Set current project to suredbits-web (in build file:/home/chris/dev/suredbits-web/)
[info] Updating {file:/home/chris/dev/suredbits-web/}root...
[info] Resolving ws.securesocial#securesocial_2.11;2.1.4 ...
[warn] module not found: ws.securesocial#securesocial_2.11;2.1.4
[warn] ==== local: tried
[warn] /home/chris/.ivy2/local/ws.securesocial/securesocial_2.11/2.1.4/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/ws/securesocial/securesocial_2.11/2.1.4/securesocial_2.11-2.1.4.pom
[warn] ==== Typesafe Releases Repository: tried
[warn] https://repo.typesafe.com/typesafe/releases/ws/securesocial/securesocial_2.11/2.1.4/securesocial_2.11-2.1.4.pom
[warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/ws/securesocial/securesocial_2.11/2.1.4/securesocial_2.11-2.1.4.pom
[info] Resolving jline#jline;2.12 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 C 语言修复一个很好的数字生成器uint64_t。这是我目前所拥有的。
def uInt64s : Gen[BigInt] = Gen.choose(0,64).map(pow2(_) - 1)
Run Code Online (Sandbox Code Playgroud)
这是一个好的开始,但它只生成数字2^n - 1。有没有更有效的方法来生成随机 BigInts 同时保留数字范围0 <= n < 2^64?
我正在尝试从我的assets/stylesheets/目录编译*.less资源.我有一个文件包含在这个目录中,即masterpage.less.
我addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")在我的plugins.sbt文件中添加了少量的sbt插件
.
在播放的文件说:
Play中的可编辑资产必须在app/assets目录中定义.它们由构建过程处理,LESS源被编译为标准CSS文件.生成的CSS文件作为标准资源分发到与非托管资产相同的公共/文件夹中,这意味着编译后使用它们的方式没有区别.
我正在做什么,所以我很困惑为什么我的资源没有编译成 public/
这是我的路线:
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /vassets/*file controllers.Assets.versioned(path="/public", file: Asset)
GET /webjars/*file controllers.WebJarAssets.at(file)
Run Code Online (Sandbox Code Playgroud)
这就是我试图链接我的html文件中的CSS页面:
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/masterpage.css")"/>
Run Code Online (Sandbox Code Playgroud)
最后,这是我在控制台中遇到的错误:
GET http://localhost:9000/assets/masterpage.css
Run Code Online (Sandbox Code Playgroud) 我第一次运行依赖于 jdbc sql lite 驱动程序的测试套件时,测试套件通过了。如果我尝试再次运行测试套件,测试将失败,因为找不到适合数据库的驱动程序。这是控制台会话:
> > test-only *EclairTest*
15:56:27.386 TKD [EclairTest-akka.actor.default-dispatcher-14] ERROR a.h.i.engine.client.PoolMasterActor - connection pool for PoolGateway(hcps = HostConnectionPoolSetup(localhost,18332,ConnectionPoolSetup(ConnectionPoolSettings(4,0,5,32,1,30 seconds,ClientConnectionSettings(Some(User-Agent: akka-http/10.1.1),10 seconds,1 minute,512,None,WebSocketSettings(<function0>,ping,Duration.Inf,<function0>),List(),ParserSettings(2048,16,64,64,8192,64,8388608,256,1048576,Strict,RFC6265,true,Full,Error,Map(If-Range -> 0, If-Modified-Since -> 0, If-Unmodified-Since -> 0, default -> 12, Content-MD5 -> 0, Date -> 0, If-Match -> 0, If-None-Match -> 0, User-Agent -> 32),false,true,<function1>,<function1>,<function2>),None,TCPTransport),New,1 second),akka.http.scaladsl.HttpConnectionContext$@5fb80e0c,akka.event.MarkerLoggingAdapter@7da2ada2))) has shut down unexpectedly
[ERROR] [06/13/2018 15:56:27.404] [EclairTest-akka.actor.default-dispatcher-4] [akka.actor.ActorSystemImpl(EclairTest)] exception while executing timer task
[info] EclairTest:
[info] EclairTest
[info] - should connect to a running eclair instance
[info] …Run Code Online (Sandbox Code Playgroud) 我正在使用Jane Streets核心库,我正在尝试进行简单的float_of_int操作.我收到以下错误
This expression has type int but an expression was expected of type
[ Deprecated_use_float_module ]
我怎么解决这个问题?例如,在utop解释器内部:
utop # open Core.Std;;
Run Code Online (Sandbox Code Playgroud)
utop # float_of_int 1;;
Error: This expression has type int but an expression was expected of type [ Deprecated_use_float_module ]
谢谢!
编辑:我也在这里查看 Float模块里面似乎什么都没有.除非我不知道如何正确浏览文档,否则我不确定该怎么做.
什么是Scala中最干净的方法,从转换Future[Option[Future[Int]]]到Future[Option[Int]]?它甚至可能吗?
我正在努力学习斯卡拉期货.正如标题所示,在我看来,Await.result最终必须在程序中的某个时刻调用,以便将未来的值提取到Scala字段中.到目前为止,这是我的代码.我在这里查询一个任意的uri并将它映射到一个case类,Address假设这个Addresscase类有一个字段,final_balance.
case class Address(final_balance:Double)
def getAddress(bitcoinAddress: String)(format: DataFormat): Future[Address] = {
val uri: String = "http://example.com"
val response: Future[HttpResponse] = (IO(Http) ? HttpRequest(GET, Uri(uri))).mapTo[HttpResponse]
implicit val addressJsonFormat = AddressJsonProtocol.addressFormat
val address: Future[Address] = response.flatMap { x =>
x match {
case HttpResponse(_, entity, _, _) =>
Future(entity.asString.parseJson.convertTo[Address])
}
}
address
}
def getFinalBalance(address: String): Double = {
val futureAddress: Future[Address] = QueryAddress.getAddress(address)(Json)
val finalBalance:Future[Double] = for { a <- futureAddress } yield …Run Code Online (Sandbox Code Playgroud) 我正在尝试将play scala添加为依赖build.sbt:
name := "name"
version := "0.0"
lazy val root = (project in file(".")).enablePlugins(play.PlayScala)
scalaVersion := "2.11.2"
resolvers += Resolver.mavenLocal
organization := "com.suredbits.core"
libraryDependencies ++= {
val sprayV = "1.3.2"
val akkaV = "2.3.8"
Seq(
"org.scalatest" % "scalatest_2.11" % "2.2.0",
"io.spray" %% "spray-can" % sprayV withSources() withJavadoc(),
"io.spray" %% "spray-routing" % sprayV withSources() withJavadoc(),
"io.spray" %% "spray-testkit" % sprayV % "test" withSources() withJavadoc(),
"com.typesafe.akka" %% "akka-actor" % akkaV withSources() withJavadoc(),
"com.typesafe.akka" %% "akka-testkit" % akkaV % "test" …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的光滑数据库更改HikariCP的参数maximumPoolSize和connectionTimeout参数,这里是我的设置application.conf
testNet3DatabaseUrl {
dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
driver = "slick.driver.PostgresDriver$"
db {
driver="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/bitcoins-spv-node-testnet3"
user="bitcoins-spv-node-admin"
password=""
queueSize=5000
numThreads=8
}
connectionTimeout=3000
maximumPoolSize=100
}
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试使用我的数据库时,我收到一条错误,说明 Exception: java.sql.SQLTimeoutException: Timeout after 1000ms of waiting for a connection.为什么超时没有3000ms像我在我指定的那样设置application.conf?
我正在尝试编写一个简洁的Scala Slick查询来查找小于当前的所有日期时间DateTime.now().我继续得到编译问题而Column[DateTime]不能与普通人相提并论DateTime.编写此Scala Slick查询的正确方法是什么?
列定义是
def expirationTime = column[DateTime]("EXPIRATION_TIME")
Run Code Online (Sandbox Code Playgroud)
和我想写的查询:
table.filter(_.expirationTime < DateTime.now())
Run Code Online (Sandbox Code Playgroud)