我是新手喷,我不能让它上班......:/
我的build.sbt:
val apacheDeps = Seq(
"commons-validator" % "commons-validator" % "1.4.1"
)
val sprayAndAkkaDeps = {
val sprayV = "1.3.3"
Seq(
"io.spray" %% "spray-can" % sprayV,
"io.spray" %% "spray-routing" % sprayV,
"io.spray" %% "spray-testkit" % sprayV % "test",
"com.typesafe.akka" %% "akka-actor" % "2.3.9"
)
}
name := "myApp"
version := "1.0.0"
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
"org.mongodb" %% "casbah" % "2.8.1",
"ch.qos.logback" % "logback-classic" % "1.1.2",
"org.scala-lang.modules" %% "scala-xml" % "1.0.3",
"com.typesafe.play" %% "play-json" % "2.4.0",
"org.specs2" %% "specs2-core" …Run Code Online (Sandbox Code Playgroud) 我已经安装了intellij idea 2018.1。我无法打开集成终端外壳。这对我来说是有用的窗口。
左侧下拉菜单中没有按钮。有:事件日志、收藏夹、项目,但没有终端:(
我试图在将来改变FSM状态,但我不工作..我想我正在寻找pipeTo like方法.
When(State.Waiting) {
case Event(anyMsg, anyData) =>
asyncCode.map(res =>
if (res == 1) {
goto(State.Working) using Data.MyData
} else {
stay() replying "bad response"
}
)
}
Run Code Online (Sandbox Code Playgroud)
goto命令被执行但fsm不会将状态更改为State.Working
我自己找到了这个工作
When(State.Waiting) {
case Event(anyMsg, anyData) =>
asyncCode.map(res =>
if (res == 1) {
self ! "do job"
} else {
stay() replying "bad response"
}
)
case Event("do job", anyData) => {
goto(State.Working) using Data.MyData
}
}
Run Code Online (Sandbox Code Playgroud)
可能有一个更好的主意来解决问题
我想将我的工件推送到本地ivy存储库,以便将它们用作其他项目中的依赖项.
我的神器的build.scala:
name := "jsonApi"
organization := "com.github.kondaurovdev"
version := "0.1-SNAPSHOT"
scalaVersion := "2.11.7"
Run Code Online (Sandbox Code Playgroud)
运行publishLocal任务:
> publishLocal
[info] Packaging /home/user256/Projects/kondaurov/jsonApi/target/scala-2.11/jsonapi_2.11-0.1-SNAPSHOT-sources.jar ...
[info] Wrote /home/user256/Projects/kondaurov/jsonApi/target/scala-2.11/jsonapi_2.11-0.1-SNAPSHOT.pom
[info] :: delivering :: com.github.kondaurovdev#jsonapi_2.11;0.1-SNAPSHOT :: 0.1-SNAPSHOT :: integration :: Mon May 16 12:07:08 MSK 2016
[info] Done packaging.
[info] delivering ivy file to /home/user256/Projects/kondaurov/jsonApi/target/scala-2.11/ivy-0.1-SNAPSHOT.xml
[info] Main Scala API documentation to /home/user256/Projects/kondaurov/jsonApi/target/scala-2.11/api...
[info] Compiling 51 Scala sources to /home/user256/Projects/kondaurov/jsonApi/target/scala-2.11/classes...
model contains 97 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /home/user256/Projects/kondaurov/jsonApi/target/scala-2.11/jsonapi_2.11-0.1-SNAPSHOT-javadoc.jar ...
[info] Done …Run Code Online (Sandbox Code Playgroud) 我有这条路线:
path("rus") {
complete("??????!")
}
Run Code Online (Sandbox Code Playgroud)
当我使用浏览器(chrome)进入/ rus时,得到以下输出:
“ !!”!
为什么?响应头是:
HTTP/1.1 200 OK
Server: akka-http/2.4.10
Date: Mon, 10 Oct 2016 22:31:53 GMT
Content-Type: application/json
Content-Length: 15
Run Code Online (Sandbox Code Playgroud)
我曾经使用过喷雾,但现在我想使用akka http,我没有遇到过这样的问题。
当我卷曲此路径时,我得到正常输出
$ curl http://localhost:9010/rus
"??????!"
Run Code Online (Sandbox Code Playgroud)
我看到响应标头'Content-Type'应该是'application / json; charset = utf-8'但缺少charset ...
我有一个包含多个包的maven包.我想删除它中的子包,但我不知道如何做到这一点.
您可以在Bintray UI中删除包中的文件或使用rest api方法
DELETE /content/:subject/:repo/:file_path
Run Code Online (Sandbox Code Playgroud)
但是,如果我想删除整个包呢?为什么没有这方面的支持?
我不明白为什么所有的承诺都会同时得到解决。我读到它await在循环中不能按预期工作forEach,但它不能与map任何一个一起工作
const promise = async (ms, name) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log(`resolving ${name}`)
resolve(name)
}, ms)
});
}
async function main() {
['foo', 'bar', 'baz'].reduce(async (accum, curr) => {
const res = await promise(1000, curr)
return res
}, Promise.resolve(''))
}
main()
Run Code Online (Sandbox Code Playgroud)
但在这种情况下,await 工作得很好:
async function main2() {
const ms = 1000
await promise(ms, "foo")
await promise(ms, "bar")
await promise(ms, "baz")
}
main2()
Run Code Online (Sandbox Code Playgroud) 我不是java类型系统和异常处理方面的专家。但我发现我们应该只捕获异常而不是可抛出的异常。
这是链接: Difference Between using Throwable and Exception in a try catch
在 Vavr 的库中我找到了这个源代码:
public interface Try<T> extends Value<T>, Serializable {
long serialVersionUID = 1L;
static <T> Try<T> of(CheckedFunction0<? extends T> supplier) {
Objects.requireNonNull(supplier, "supplier is null");
try {
return new Try.Success(supplier.apply());
} catch (Throwable var2) {
return new Try.Failure(var2);
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我将来使用这个容器,会有什么问题吗?我会错过执行“of”函数期间可能发生的一些关键异常吗?
我想生成案例类的json模式,以便向其他服务提供一些信息,这些服务将使用rest api公开我的应用程序
我有这门课:
case class Vendor(
name: String,
synonyms: List[String],
transalit: String,
urlPart: String)
Run Code Online (Sandbox Code Playgroud)
我怎么能这样生成:
{
"type":"object",
"properties":{
"name":{
"type":"string"
},
"synonyms":{
"type":"array",
"items":{
"type":"string"
}
},
"translit":{
"type":"string"
},
"urlPart":{
"type":"string"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我发现这个:https://github.com/coursera/autoschema但是sbt找不到依赖.
我也发现这有没有办法从Scala Case Class层次结构中获取JSON-Schema?这个问题与我的问题很相似,但没有答案..
也许我正在寻找不存在的答案.使用其他一些技术可能会更好
我在一个组ID中有很多包.
我的主要群组ID是:com.github.kondaurovdev
我的小组:com.github.kondaurovdev.snippets com.github.kondaurovdev.akka_http ...
我不想在bintray中创建很多包,因为我必须等待批准将包链接到jcenter.
所以我找到了一个"解决方案".Bintray UI中有一个合并按钮,您可以选择具有相同组ID的所有包,并且具有一个包含许多子包的包.您只能链接此软件包一次,您的软件包可以使用JCenter repo下载.这很酷!
但我不想每次都合并.我想将我的子包发布到父包中.这可能吗?
我正在使用sbt-bintray上传工件,但它总是会创建新的包并上传内容.