小编Dan*_*zes的帖子

无效的mongodb uri必须以"mongodb://"开头

知道为什么我会收到此错误吗?

这是连接线

mongoose.connect("mongodb+srv://danielkmx:"+process.env.MONGO_ATLAS_PW+"@node-rest-shop-5xfup.mongodb.net/test",
{
    useMongoClient:true
});
Run Code Online (Sandbox Code Playgroud)

mongoose node.js

10
推荐指数
3
解决办法
3392
查看次数

Cognito 注册时电话号码格式无效

我试图通过 nodeJS 在我的认知用户池中创建一个新用户,但我不断收到错误的电话号码错误……但我使用相同格式的号码通过 SNS 服务发送短信,我不明白为什么会发生这种情况

报名方式:

module.exports.post = async (username,password,email,phoneNumber) => {
    const environment = {
        UserPoolId: xxxxxxx,
        ClientId: xxxxxx,
    }
    return new Promise((reject,resolve) => {
        const userPool = new AmazonCognitoIdentity.CognitoUserPool(environment);
        const emailData = {
            Name: 'Email',
            Value: email
        };
        const userData = {
            Name: 'Usuário',
            Value: username
        };
        const phoneData = {
            Name: 'Telefone',
            Value: phoneNumber
        };
        const emailAttribute = new AmazonCognitoIdentity.CognitoUserAttribute(emailData);
        const userAttribute = new AmazonCognitoIdentity.CognitoUserAttribute(userData);
        const phoneAttribute = new AmazonCognitoIdentity.CognitoUserAttribute(phoneData);

        userPool.signUp(username,password,[emailAttribute,userAttribute, phoneAttribute], null, (err,data) => {
        if(err) …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-cognito

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

C2061:语法错误:标识符'_TCHAR'

无法理解为什么我收到这个错误?我有点像c ++和微软视觉工作室的新手,有点迷失于此.感谢您的帮助.

#include <iostream>                          
#include <fstream>                           
#include <string>                       
#include <windows.h>                        

using namespace std;
#define STILL_PLAYING   1
#define QUIT            0
#define GAME_FILE "Mundo.txt";

////// the main class of the game, its a room, ull be moving around to other rooms. /////////////
struct posicao{
    string posAtual;
    string Descricao;
    string posNorte;
    string posSul;
    string posLeste;
    string posOeste;
};

/////////// displays the room that you are at the moment /////
void mostraposicao(posicao &posicao)
{
    cout << posicao.Descricao << endl << endl;
}

////////// gets …
Run Code Online (Sandbox Code Playgroud)

c c++

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

Dotnet EF 更新不生成数据库

我正在按照教程制作 dotnet 2 rest api,并期望 dotnet cli 在 dotnet ef 更新后生成数据库。但它没有发生

我有这个上下文类

 public class DutchContext : DbContext
 {
     public DutchContext(DbContextOptions<DutchContext> options): base(options)
     {
         public DbSet<Product> Products { get; set; }
         public DbSet<Order> Orders { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

这就是我在 StartUp.cs 中调用 con 字符串的方式

public void ConfigureServices(IServiceCollection services)
{
    services.AddTransient<IMailService, NullMailService>();
    // support for real mail service
    services.AddMvc();
    services.AddDbContext<DutchContext>(cfg =>
    {
        cfg.UseSqlServer(_config.GetConnectionString("ConnectionString"));
    });
}
Run Code Online (Sandbox Code Playgroud)

以及保存 con 字符串的 config.json

{

  "ConnectionStrings": {
    "ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=EstudoDotnetDB;Integrated Security=true;MultipleActiveResultSets=true"
  }
}
Run Code Online (Sandbox Code Playgroud)

这是我的 localdb > (localdb)\MSSQLLocalDB …

.net entity-framework .net-core

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

将字节对象列表转换为 dict

我正在使用一个 API,它返回一个 JSON 中的对象列表。但是当我使用 Requests lib 获取其内容时,内容是一个字节数组,如下所示:

b'[{"id":44,"id_string":"a2BPQDsGLfLiwo4r5U4JCY","title":"ED_1803_ITAIPAVA_RJ","description":"ED_1803_ITAIPAVA_RJ","url":"https://kobocat.docker.kobo.techo.org/api/v1/data/44"},{"id":57,"id_string":"a3pb3ALiGuQAHD6XzdHAip","title":"ED_v2018_1801_Taba\xc3\xa7u-SP","description":"ED_v2018_1801_Taba\xc3\xa7u-SP","url":"https://kobocat.docker.kobo.techo.org/api/v1/data/57"},{"id":68,"id_string":"a4Gz2dSwRuyQCsjBwNhf3D","title":"ECS_1804_SONHO REAL-BA","description":"ECS_1804_SONHO REAL-BA","url":"https://kobocat.docker.kobo.techo.org/api/v1/data/68"},{"id":2,"id_string":"a4KjYoy8ieCRNykiYb7nGP","title":"ECS_1708_Vila Esperan\xc3\xa7a-SP","description":"ECS_1708_Vila Esperan\xc3\xa7a-SP","url":"https://kobocat.docker.kobo.techo.org/api/v1/data/2"},{"id":38,"id_string":"a7GQQ7xEu4K6HXWYu9SaSC","title":"ECo_1711_Terra Nossa-UF","description":"ECo_1711_Terra Nossa-UF","url":"https://kobocat.docker.kobo.techo.org/api/v1/data/38"},{"id":78,"id_string":"a7NnnbdhBUSsGoxVWBiGFb","title":"ECoSP_1805_Vila Nova Esperan\xc3\xa7a-SP","description":"ECoSP_1805_Vila Nova Esperan\xc3\xa7a-SP","url":"https://kobocat.docker.kobo.techo.org/api/v1/data/78"}]
Run Code Online (Sandbox Code Playgroud)

我怎样才能使它成为一个普通的字典列表?我尝试使用 for in range() 遍历字节数组,但我只能返回数字。

python json http python-requests

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

在打字稿中使用 eslint 解析错误,lint 没有获取 parserOptions 配置

我不确定为什么会出现此错误

You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project"
Run Code Online (Sandbox Code Playgroud)

这是我的配置

tsconfig

{
  "compilerOptions": {
    "target": "es6",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "jsx": "react",
    "rootDir": "src",
    "baseUrl": "src",
    "paths": {
      "@/*": [
        "*"
      ]
    },
    "allowJs": true,
    "resolveJsonModule": true
  },
  "include": [
    "src"
  ],
  "exclude": [
    "src/main/test/cypress"
  ]
}
Run Code Online (Sandbox Code Playgroud)

.eslintrc.json

{
  "extends": "standard-with-typescript",
  "parserOptions": {
    "projects": "./tsconfig.json"
  },
  "rules": {
    "@typescript-eslint/consistent-type-definitons": "off", …
Run Code Online (Sandbox Code Playgroud)

typescript eslint

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

错误找不到模块,测试 Nestjs 服务

我在 Nestjs 上测试服务时遇到了困难,我相信这与我缺乏对依赖注入如何用于测试的知识有关,奇怪的是只在测试中出现错误。我有3个模块Teste,Teste2,Teste3,Teste2导入Teste3服务,Teste导入Teste2服务。我尝试导出 Teste2 和 Teste3,并导入它们的模块,当我运行 npm start 时工作正常。测试思想不起作用...

泰斯特

 @Module({
    imports: [],
    providers: [ TesteService,Teste2Service],
    exports: [TesteService],
    controllers: [TesteController]
  })
  export class TesteModule {}
@Injectable()
export class TesteService {
constructor(private teste2Service: Teste2Service){}

    teste(){
        return this.teste2Service.hello();
    }
}
Run Code Online (Sandbox Code Playgroud)

测试2

@Module({
  imports: [Teste3Module],
  providers: [Teste2Service],
  exports: [Teste2Service]
})
export class Teste2Module {}
@Injectable()
export class Teste2Service {
    constructor(private teste3Service: Teste3Service){}
    hello(){
        return this.teste3Service.hello();
    }
}
Run Code Online (Sandbox Code Playgroud)

测试3

@Module({
  providers: [Teste3Service],
  exports: [Teste3Service]
})
export class Teste3Module {}

@Injectable()
export class Teste3Service { …
Run Code Online (Sandbox Code Playgroud)

node.js nestjs

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

无法读取 &lt;CATALINA_HOME&gt;/conf/server.xml

出于某种原因,我无法让 tomcat 8 在 netbeans 上运行......它在 localhost:8080 上运行得很好。但不会在netbeans上工作。我正在运行 ubuntu 16.04。

catalina 变量设置如下:

      CATALINA_HOME=/usr/share/tomcat8
      CATALINA_BASE=/usr/share/tomcat8
Run Code Online (Sandbox Code Playgroud)

share/tomcat8 没有 conf 文件,我认为这是问题所在,conf 文件位于 var/lib/tomcat8。我该如何解决这个问题?尝试将 catalina_base 和 _home 设置为 var/bin/tomcat8,但它不起作用

tomcat netbeans

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

非静态字段需要对象引用,为什么?

我做了一些关于这个错误的研究,我找到的所有发现包括从方法或属性中删除静态,但在我的代码中没有任何静态,所以我不知道发生了什么,谢谢你的帮助.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class textoTitular : Form
    {
        public textoTitular()
        {
            InitializeComponent();
        }


        private void textoTitular_Load(object sender, EventArgs e)
        {

            textoTitular.Text = "testing";   /// prints testing on the textbox
        }
    } 
}
Run Code Online (Sandbox Code Playgroud)

c#

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

%*c是什么意思?

我正在通过" C++完整参考 " 这本书来学习C/C++ ,而我却陷入了一个tic toe游戏.该计划有这样的声明:

scanf("%d %*c %d",&x,&y)
Run Code Online (Sandbox Code Playgroud)

这是什么%*c?本书根本没有解释.

c c++

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