问题列表 - 第277374页

代码:403。错误:权限被拒绝 - 对 Hashicorp Vault 进行 API 调用时

我正在关注来自以下引用的Vault 配置示例: https: //spring.io/guides/gs/vault-config/。我已经使用Windows机器启动了服务器。

vault server --dev --dev-root-token-id="00000000-0000-0000-0000-000000000000"
Run Code Online (Sandbox Code Playgroud)

两个环境变量将 Vault CLI 指向 Vault 端点并提供身份验证令牌。

set VAULT_TOKEN="00000000-0000-0000-0000-000000000000"
set VAULT_ADDR=http://127.0.0.1:8200
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

C:\Softwares\vault_1.0.1_windows_amd64>vault write secret/gs-vault-config example.username=demouser example.password=demopassword
Error writing data to secret/gs-vault-config: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/secret/gs-vault-config
Code: 403. Errors:

* permission denied
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

hashicorp-vault

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

使用.Net Core在Raspberry Pi上使用蓝牙LE

我想在.NET Core中构建GATT客户端。它将部署到运行Raspbian Lite的RPi3,以控制多个BLE设备。.Net Core Framework(2.2或3预览)当前是否支持Bluetooth LE?

我知道在RPi的Windows 10 IoT上使用UWP库的替代方法,但我宁愿运行Raspbian Lite。目前是否有其他替代方案可用于此类堆栈?

.net c# bluetooth-lowenergy raspbian raspberry-pi3

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

IPython.embed()不使用终端颜色

我将经常使用它IPython.embed()来检查运行代码的状态。在早期版本的IPython中,它可以正确确定终端(xterm)的颜色功能,并使用彩色文本。在最新版本的IPython(7.2.0)中,使用时仅显示黑白文本IPython.embed()

根据文档,我应该可以通过设置在默认配置文件中覆盖此默认值c.InteractiveShell.colors = 'Linux'。但是,此设置仅适用于IPython的独立实例,不适用于嵌入式会话。

我可以使用%colors Linuxmagic方法对每个实例进行更正。但是,这应该自动进行,而无需在每次嵌入后进行其他配置。

如果我通过ipython3直接运行来启动IPython的独立实例,那么将正确设置终端颜色。但是,这不是我最常用的工作流程的选项。

这是使用运行在Linux Mint 19(基于Ubuntu 18.04)上的python 3.5.2测试的。在PyPI上发生的第一个ipython版本是7.0.0版本。可用的先前版本6.5.0正确使用带有终端颜色IPython.embed()。目前,我已经恢复到6.5.0的最新工作版本,但是我想保持最新版本。

python ipython

4
推荐指数
2
解决办法
402
查看次数

Maven 找不到 aws s3 sdk

尝试通过 Maven 使用 Amazon AWS Java SDK 设置一个新项目,显然 Maven 找不到 s3 包。

这是错误:

[错误] /X:/java/amazon/S3/s3shell/src/main/java/me/s3/S3Shell.java:[4,42] 软件包 software.amazon.awssdk.services.s3 不存在

这些是 pom 文件中的依赖项:

<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>software.amazon.awssdk</groupId>
    <artifactId>bom</artifactId>
    <version>2.2.0</version>
    <type>pom</type>
    <scope>import</scope>
    </dependency>
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>s3</artifactId>
      <version>2.2.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
</dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)

java maven aws-sdk

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

从回调函数内部使用"纯"Node.js重定向

以下是我的server.js代码的MCVE :

let fs = require('fs');
let http = require('http');

http.createServer((req, res) => {
    // Handles GET requests
    if(req.method == 'GET') {
        let file = req.url == '/' ? './index.html': '/login.html'; // just an example
        fs.readFile(file, (err, data) => {
            res.writeHead(200, {'Content-Type': 'text/html'});
            res.end(data);
        });
    } 

    // Handles POST requests
    else {
        read(status => {
            if(status) {
                res.writeHead(302, {
                    'Location': 'http://localhost:8000/login.html',
                    'Content-Type': 'text/html'
                });
                res.end();
                console.log('Redirected!');
            }
        });
    }
}).listen(8000);

// In my actual script, the `read` function …
Run Code Online (Sandbox Code Playgroud)

javascript ajax redirect node.js server

10
推荐指数
1
解决办法
722
查看次数

无法解析导入 org.springframework - Java(268435846)

我正在尝试在我的项目中使用 Spring Framework,但我在导入时遇到了问题。我正在使用 Gradle 进行构建,前端使用 React JS,后端使用 Java。

奇怪的是,即使 VS Code 告诉我无法解析我的导入,我也可以将类用作 RowMapper 和 JdbcTemplate(我可以使用这些类在我的数据库中读写)。

当我使用 Gradle 构建时(在我的命令提示符中 gradle build 然后 gradle bootrun )它也可以工作。

处理不应该存在的错误非常无聊。有人能帮我吗 ?

我个人认为这是我的 build.gradle 文件或 VS Code 中的配置中的错误,但我不确定。

这是我的 build.gradle 和我的依赖项和我的存储库:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }

apply plugin: 'java'
apply plugin: 'org.liquibase.gradle'

repositories {
mavenCentral()
}

dependencies {
compile("org.springframework.boot:spring-boot-starter:2.0.6.RELEASE")

// Use MySQL Connector-J
runtime 'mysql:mysql-connector-java:8.0.12'

compile("org.springframework:spring-jdbc:3.2.4.RELEASE")

testCompile('org.junit.jupiter:junit-jupiter-api:5.3.1')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.3.1')

compile ('commons-dbcp:commons-dbcp:1.4')

liquibaseRuntime 'org.liquibase:liquibase-core:3.6.1'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.0.1'
liquibaseRuntime 'mysql:mysql-connector-java:8.0.12'
}
Run Code Online (Sandbox Code Playgroud)

这是我的项目中发生错误的一类:

package be.heh.petclinic.component.pet;

import …
Run Code Online (Sandbox Code Playgroud)

spring gradle visual-studio-code

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

如何为 Firestore 数据库调用 onwrite 事件侦听器函数?

functions.firestore
    .document('users/00QAGyS0NqFdDSS78E6r')
    .onWrite(event => {

        const commentId = event.params.commentId;
        const postId = event.params.postId;

        // ref to the parent document
        const docRef = admin.firestore().collection('posts').doc();

        // get all comments and aggregate
        return docRef.collection('comments').orderBy('createdAt', 'desc')
            .get()
            .then(querySnapshot => {

                // get the total comment count
                const commentCount = querySnapshot.size

                const recentComments = []

                // add data from the 5 most recent comments to the array
                querySnapshot.forEach(doc => {
                    recentComments.push( doc.data() )
                });

                recentComments.splice(5)

                // record last comment timestamp
                const lastActivity = recentComments[0].createdAt

                // …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-firestore

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

程序在将字典传递给函数参数时显示TypeError

def f(**kwargs):
   print(kwargs)

d = {'0': 'a', '1': 'b', '2': 'c', '3': 'd'}   
f(**d)   # {'0': 'a', '1': 'b', '2': 'c', '3': 'd'}

d = {0: 'a', 1: 'b', 2: 'c', 3: 'd'}   
f(**d)   # TypeError: f() keywords must be strings
Run Code Online (Sandbox Code Playgroud)

在这里,我在将字典键值更改为int类型时获得TypeError.我可以知道,为什么我收到这个错误?

python python-3.x

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

引起:java.lang.IllegalArgumentException:令牌(spring.cloud.vault.token)不能为空 - Hashicorp Vault

我正在以下Vault Configuration示例中引用:https://spring.io/guides/gs/vault-config/。当我执行代码时,出现以下错误。

错误:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'vaultPropertySourceLocator' defined in class path resource [org/springframework/cloud/vault/config/VaultBootstrapPropertySourceConfiguration.class]: Unsatisfied dependency expressed through method 'vaultPropertySourceLocator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'vaultTemplate' defined in class path resource [org/springframework/cloud/vault/config/VaultBootstrapConfiguration.class]: Unsatisfied dependency expressed through method 'vaultTemplate' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'vaultSessionManager' defined in class path resource [org/springframework/cloud/vault/config/VaultBootstrapConfiguration.class]: Unsatisfied dependency expressed through method 'vaultSessionManager' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: …
Run Code Online (Sandbox Code Playgroud)

spring hashicorp-vault spring-vault

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

用于 3D 图像体积的 SSIM

我正在使用 TensorFlow 处理图像超分辨率问题(2D 和 3D),并且正在使用 SSIM 作为eval_metrics.

我正在使用image.ssim来自 TF 和measure.comapre_ssim来自skimage. 它们都为 2D 提供了相同的结果,但 3D 体积的结果总是有所不同。

我已经查看了TF-implementationskimage-implementation的源代码。在两种实现中如何考虑和处理输入图像似乎存在一些根本差异。

复制问题的代码:

import numpy as np
import tensorflow as tf

from skimage import measure

# For 2-D case
np.random.seed(12345)
a = np.random.random([32, 32, 64])
b = np.random.random([32, 32, 64])

a_ = tf.convert_to_tensor(a)
b_ = tf.convert_to_tensor(b)

ssim_2d_tf = tf.image.ssim(a_, b_, 1.0)
ssim_2d_sk = measure.compare_ssim(a, b, multichannel=True, gaussian_weights=True, data_range=1.0, use_sample_covariance=False)

print (tf.Session().run(ssim_2d_tf), ssim_2d_sk)

# For …
Run Code Online (Sandbox Code Playgroud)

image-processing python-2.7 ssim scikit-image tensorflow

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