我用gruntjs和yeoman.io构建我的webapp.
我希望能够录制git的修改/提交/ SHA一个构建从何而来,这样我可以在部署的版本,并仔细检查它来自何处,哪些已经与新版本改变了一下.
如何使用docker-compose快速更新一个正在运行的服务.
我发现自己经常跑步docker-compose stop SERVICE
,docker-compose build SERVICE
而且docker-compose up -d SERVICE
.
是否有更简单的方法,最好是停机时间很短.
与将隐式解码器保存为val相比,为什么Circe Json使用隐式解码器查找更慢.
我希望这些是相同的,因为隐式解析是在运行时完成的.
import io.circe._
import io.circe.generic.auto._
import io.circe.jackson
import io.circe.syntax._
private val decoder = implicitly[Decoder[Data.Type]]
def decode(): Either[Error, Type] = {
jackson.decode[Data.Type](Data.json)(decoder)
}
def decodeAuto(): Either[Error, Type] = {
jackson.decode[Data.Type](Data.json)
}
[info] DecodeTest.circeJackson thrpt 200 69157.472 ± 283.285 ops/s
[info] DecodeTest.circeJacksonAuto thrpt 200 67946.734 ± 315.876 ops/s
Run Code Online (Sandbox Code Playgroud)
完整的回购可以在这里找到. https://github.com/stephennancekivell/some-jmh-json-benchmarks-circe-jackson
我有一个API服务器的nginx代理.API有时会设置缓存控制标头.如果API没有设置缓存控件,我希望nginx覆盖它.
我怎么做?
我想我想做这样的事情,但它不起作用.
location /api {
if ($sent_http_cache_control !~* "max-age=90") {
add_header Cache-Control no-store;
add_header Cache-Control no-cache;
add_header Cache-Control private;
}
proxy_pass $apiPath;
}
Run Code Online (Sandbox Code Playgroud) 如何将HList的类型作为String获取,以便我可以打印它.例如"Int :: Long :: String :: HNil"
val gen = Generic[?]
val typeString: String = ???
println("The type is " + typeString)
Run Code Online (Sandbox Code Playgroud)
我知道它的字符串不是很有用,通常你想要的类型 gen.Repr
为什么Intellij会发出此警告,这是什么意思,我怎样才能让它变得更好?
import akka.actor.Props
object Router {
def props(config: Config, addresses: Set[Address]): Props =
Props(classOf[Router], config, addresses)
// "dynamic invocation could be replaced with a constructor invocation"
Run Code Online (Sandbox Code Playgroud)
如果我在Props inplace我得到一个不同的警告.
system.actorOf(Props(classOf[Router], config, addresses))
// could be replaced with factory method call
Run Code Online (Sandbox Code Playgroud)
谢谢
我有一些返回IO的代码,但是我需要在http4s中使用效果。
import cats.effect.{Effect, IO}
class Service[F[_]: Effect] extends Http4sDsl[F] {
val service: HttpService[F] = {
HttpService[F] {
case GET -> Root =>
val data: IO[String] = getData()
data.map(d => Ok(d))
}
}
}
Run Code Online (Sandbox Code Playgroud)
给
[error] found : cats.effect.IO[F[org.http4s.Response[F]]]
[error] required: F[org.http4s.Response[F]]
[error] data.map(d => Ok(d))
[error] ^
Run Code Online (Sandbox Code Playgroud) 如何关闭此警告?我喜欢大多数Intellij警告,但不喜欢它。
method with accessor like name is empty-paren
Run Code Online (Sandbox Code Playgroud)