小编zer*_*ing的帖子

如何在两个flexbox之间设置空间

我使用材料设计flexbox布局,在一个盒子里,我有两个盒子.我在jsfiddle上创建,以澄清我的意思:

Angular Material应用程序

我想在这些盒子之间设置一个空间

<div flex layout="row" layout-align="space-between center">
            <md-toolbar flex="15">
                 <h2 class="md-toolbar-tools">
                    <span>Home</span>
                  </h2>

            </md-toolbar>
                <!--How to set space between -->
            <md-toolbar>
                 <h2 class="md-toolbar-tools" layout-align="end center">
                    <span>Sign Up</span>
                    <span>Sign In</span>
                  </h2>

            </md-toolbar>
        </div>
Run Code Online (Sandbox Code Playgroud)

angular-material

6
推荐指数
2
解决办法
2万
查看次数

Gradle找不到依赖项

我正在尝试使用Gradle,文件看起来像:

// Apply the java plugin to add support for Java
apply plugin: 'java'

// In this section you declare where to find the dependencies of your project
repositories {
    // Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    mavenCentral()
    jcenter()
}

jar {
    manifest {
        attributes 'Main-Class': 'execute.Entry'
    }
}

// In this section you declare the dependencies for your production and test code
dependencies {
    // The production code uses the SLF4J …
Run Code Online (Sandbox Code Playgroud)

java gradle

6
推荐指数
1
解决办法
1万
查看次数

什么是反应式编程的订阅

我正在努力学习反应式编程,我对订阅这个词感到非常困惑.

什么是反应式编程的订阅?

我知道订阅时会创建订阅者.

java reactive-programming rx-java

6
推荐指数
1
解决办法
1042
查看次数

Keep in akka 流是什么意思?

我正在学习 akka 流,在代码中遇到了 Keep.left 和 Keep.right:

implicit val system = ActorSystem("KafkaProducer")
implicit val materializer = ActorMaterializer()

val source = Source(List("a", "b", "c"))
val sink = Sink.fold[String, String]("")(_ + _)

val runnable: RunnableGraph[Future[String]] = source.toMat(sink)(Keep.right)
val result: Future[String] = runnable.run()
Run Code Online (Sandbox Code Playgroud)

这里的 Keep.right 是什么意思?

scala akka-stream

6
推荐指数
1
解决办法
2531
查看次数

为什么它可以与 npm 一起使用而不能与yarn一起使用?

package.jsonwith安装软件包后yarn,然后启动,yarn test出现以下错误:

\n\n
FAIL  src/Dashboard/AppBar/Tests/AppBar.test.js\n  \xe2\x97\x8f Test suite failed to run\n\n    TypeError: environment.setup is not a function\n\n      at node_modules/jest-runner/build/run_test.js:71:23\n\nTest Suites: 1 failed, 1 total\nTests:       0 total\nSnapshots:   0 total\nTime:        0.478s\nRan all test suites related to changed files.\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我运行 withnpm i安装软件包,然后运行测试时yarn test,测试将通过。

\n\n
 PASS  src/Dashboard/AppBar/Tests/AppBar.test.js\n  \xe2\x9c\x93 renders (92ms)\n\nTest Suites: 1 passed, 1 total\nTests:       1 passed, 1 total\nSnapshots:   0 total\nTime:        1.452s, estimated 2s\nRan all test suites related to changed files.\n\nWatch Usage: Press …
Run Code Online (Sandbox Code Playgroud)

javascript npm yarnpkg

6
推荐指数
1
解决办法
2746
查看次数

如何在 vue 中使用 grpc-web?

我正在尝试在我的 vue 应用程序中使用 grpc-web 客户端,如下所示:

import Vue from "vue";
import App from "./App.vue";
const { Registration, _ } = require("./identity-service_pb.js");
const {
  IdentityServicePromiseClient
} = require("./identity-service_grpc_web_pb.js");

const identityService = new IdentityServicePromiseClient(
  "http://localhost:9000"
);


const req = new Registration();
req.setGender("male");
req.setInterestList(["A", "B", "C"]);

console.log(req);
console.log(identityService);

identityService.signUp(req, {}).then(function(response) {
  console.log(response);
}).catch(function(error) {
  console.error(error);
});

Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");
Run Code Online (Sandbox Code Playgroud)

当应用程序被编译时,编译器会抱怨:

error  in ./src/identity-service_pb.js

Module Error (from ./node_modules/eslint-loader/index.js):

/home/developer/js/identity-client/src/identity-service_pb.js
   27:1   error  'proto' is not defined      no-undef
   28:50  error …
Run Code Online (Sandbox Code Playgroud)

vue.js grpc grpc-web

6
推荐指数
2
解决办法
5033
查看次数

验证struct变量是否为空

首先,请查看以下代码段:

package main

import (
    "fmt"
)

func main() {

    var para1 struct {
        email, addr string
    }

    para1.email = "test@test.com"

    if para1 != nil {
        fmt.Println(para1)
    }

}
Run Code Online (Sandbox Code Playgroud)

当我编译这段代码时,我遇到了编译器错误:

./struct_func.go:15: cannot convert nil to type struct { email string; addr string }
Run Code Online (Sandbox Code Playgroud)

如何判断我的struct变量是否为零?或者我必须验证属性

if para1.email != nil {
    fmt.Println(para1)
}
Run Code Online (Sandbox Code Playgroud)

go

5
推荐指数
2
解决办法
1万
查看次数

使用regexp进行密码验证

我正在尝试使用regexp编写密码验证功能,但不知道该怎么做.Golang正则表达式与其他语言不同.有人知道,这个正则表达式模式应该如何?
该模式应验证:

/*
 * Password rules:
 * at least 7 letters
 * at least 1 number
 * at least 1 upper case
 * at least 1 special character
 */
Run Code Online (Sandbox Code Playgroud)

regex go

5
推荐指数
4
解决办法
3861
查看次数

为什么Elixir捕获操作符需要将函数绑定到值

我有以下elixir代码片段:

defmodule Rectangle do

    def area(a, b) do
        a * b
    end

    def area(a) do
        a * a
    end

end
Run Code Online (Sandbox Code Playgroud)

然后我将文件加载到iex会话中,如下所示:

iex(1)> import_file "rectangle.exs"
{:module, Rectangle,
 <<70, 79, 82, 49, 0, 0, 5, 84, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 204, 131, 104, 2, 100, 0, 14, 101, 108, 105, 120, 105, 114, 95, 100, 111, 99, 115, 95, 118, 49, 108, 0, 0, 0, 4, 104, 2, ...>>,
 {:area, 1}}
Run Code Online (Sandbox Code Playgroud)

它像我预期的那样工作得很好

iex(2)> Rectangle.area(9)
81 …
Run Code Online (Sandbox Code Playgroud)

elixir

5
推荐指数
1
解决办法
425
查看次数

找不到模块:org.scala-sbt#sbt; 1.1.6

我通过终端安装了SBT,命令如下:

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
Run Code Online (Sandbox Code Playgroud)

在我的Ubuntu 18.04和java版本:

openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)  
Run Code Online (Sandbox Code Playgroud)

安装成功但是当我试图SBT通过终端启动时,我就得到了

https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/sbt/1.1.6/ivys/ivy.xml

        ::::::::::::::::::::::::::::::::::::::::::::::

        ::          UNRESOLVED DEPENDENCIES         ::

        ::::::::::::::::::::::::::::::::::::::::::::::

        :: org.scala-sbt#sbt;1.1.6: not found

        ::::::::::::::::::::::::::::::::::::::::::::::


:::: ERRORS
    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.1.6/sbt-1.1.6.pom

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: …
Run Code Online (Sandbox Code Playgroud)

scala sbt

5
推荐指数
2
解决办法
3586
查看次数