小编vkt*_*vkt的帖子

使用 mongodb 创建数据库 node.js

我可以使用 node.js 删除数据库,但我不知道如何创建新数据库?我想使用 node.js 创建 monogo 数据库。有人可以帮助我了解如何使用 node.js 创建 mongo 数据库吗?

mongodb node.js

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

在运行时将外部配置文件传递给 docker 容器

我有一个 scala sbt 应用程序,并且有一个默认的 application.conf。我构建了一个 docker 映像来通过 docker 运行此应用程序。如何application.conf在运行时替换 docker 容器中的默认值?

scala docker sbt-native-packager dockerfile docker-compose

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

IntelliJ IDEA 无法找到 Artifactory 的凭据

我正在使用 IntelliJ IDEA Ultimate 导入一个 SBT 项目,该项目在私有 Artifactory 中有一些插件。

[info] Resolving com.private#XXXX_X.X;X.X.X-SNAPSHOT ...
[error] Unable to find credentials for [Artifactory Realm @ artifactory-private.com].
[error] Unable to find credentials for [Artifactory Realm @ artifactory-private.com].
Run Code Online (Sandbox Code Playgroud)

我确实在 SBT 中配置了 Artifactory 凭据,并且如果我使用 sbt shell 构建项目,则工作正常;但是,IntelliJ 中的构建失败并且无法识别凭据。有人可以帮忙吗?

更新:当插件是快照版本时,这似乎是唯一的问题。

预先非常感谢您!

scala intellij-idea artifactory sbt sbt-plugin

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

Pytest AttributeError:'function'对象没有属性'test_func'

我正在尝试使用 python 函数进行测试pytest,但出现此错误。

import pytest

class Example:

    def __init__(self):
        pass

    @staticmethod
    def test_func(list_arg):
        return len(list_arg)


@pytest.fixture()
def example_instance():
    return Example()


def test_util_fun():
    empty_val = []

    assert example_instance.test_func(empty_val) == 2
Run Code Online (Sandbox Code Playgroud)

错误 :

AttributeError: 'function' object has no attribute 'test_func'
Run Code Online (Sandbox Code Playgroud)

pytest 和 python 版本

python 3.7
pytest 4.5.0
Run Code Online (Sandbox Code Playgroud)

python pytest python-3.7

0
推荐指数
1
解决办法
4753
查看次数

在 Java 中使用 AES-256-ECB 解密

我已经使用AES-256-ECB加密了 PHP 中的字符串。

$sString   = "test"
$sEncryptionMethod = "AES-256-ECB";
$sEncryptionKey = "mysecretkey";

openssl_encrypt($sString, $sEncryptionMethod, $sEncryptionKey)
Run Code Online (Sandbox Code Playgroud)

我想使用 Java/Scala 解密相同的文件吗?

 String secret = "mysecretkey";
 SecretKeySpec skeySpec = new SecretKeySpec(encKey.getBytes("UTF-8"), "AES");
 byte[] decodedValue = Base64.getDecoder.decode(token);

 Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING");
 int decryptMode = Cipher.DECRYPT_MODE;
 cipher.init(decryptMode, skeySpec);
 new String(cipher.doFinal(decodedValue));
Run Code Online (Sandbox Code Playgroud)

我看到以下错误?我们如何使用Java解密相同的内容?注意:(PHP 中的解密按预期工作)但我想在 Java 中执行此操作

Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
Run Code Online (Sandbox Code Playgroud)

php java encryption aes

0
推荐指数
1
解决办法
97
查看次数