小编aca*_*ein的帖子

如何使用 CMake 创建包

.
+-- MyPack
|   +-- Lib1
|   |   +-- include
|   |   |   +-- Lib1.h
|   |   +-- src
|   |   |   +-- Lib2.cpp
|   |   +-- CMakeLists.txt
|   +-- Lib2
|   |   +-- include
|   |   |   +-- Lib2.h
|   |   +-- src
|   |   |   +-- Lib2.cpp
|   |   +-- CMakeLists.txt
|   +-- CMakeLists.txt
+-- SubProject1
|   +-- CMakeLists.txt
+-- SubProject2
|   +-- CMakeLists.txt
+-- CMakeLists.txt
Run Code Online (Sandbox Code Playgroud)

大家好。

我是 CMake 的新手,我正在尝试获得如下内容。考虑到我的 C++ 项目的上述目录树:

我有一个目录(比如“MyPack”),其中包含几个子目录(Lib1、Lib2...),每个子目录代表我编写的一个 C++ 库。

如何设置所有内容以便我可以find_package(MyPack)在其他子项目中编写? …

c++ cmake cmake-modules

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

两个带有子字符串比较的字符串集之间的交集

我知道这是自行车脱落,但有一种方式来获得一组琴弦C,两者之间(分类)设置,字符串,其中B是A的子串,具有复杂性比的更好的说明B A.size * B.size * comp_substr,作为幼稚解决方案我来了吗?

    std::copy_if(devices.cbegin(), devices.cend(),
                          std::back_inserter(ports),
                          [&comport_keys] (const auto& v) {
        return std::any_of(comport_keys.begin(),comport_keys.end(), [&v](auto& k) {
           return v.find(k) != std::string::npos;
        });
    });
Run Code Online (Sandbox Code Playgroud)

如果B是A的字符串,则更std::set_intersection简单的情况是(A.size + B.size) * comp_substr,如果复杂度为,则将非常简单,如果必须先对其进行排序,则将更好(n * log(n)),但是我不知道如何为它编写比较函数,或两者兼而有之。

    #define BOOST_TEST_MODULE My Test

    #include <boost/test/included/unit_test.hpp>

    #include <vector>
    #include <string>
    #include <algorithm>
    #include <iterator>
    #include <set>

    BOOST_AUTO_TEST_CASE(TEST) {
        std::vector<std::string> devices{
                "tty1",
                "ttyOfk",
                "ttyS05",
                "bsd",
        }, ports{};

        const std::set<std::string> comport_keys{
                "ttyS",
                "ttyO",
                "ttyUSB",
                "ttyACM",
                "ttyGS",
                "ttyMI",
                "ttymxc",
                "ttyAMA",
                "ttyTHS",
                "ircomm",
                "rfcomm",
                "tnt", …
Run Code Online (Sandbox Code Playgroud)

c++ algorithm c++17

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

有人加入时播放音频文件的Discord Bot

我希望机器人在有人加入时加入语音通道,然后播放声音文件。

到目前为止,我已经让该机器人加入了语音通道,但是它只是没有播放声音,也没有错误显示,所以我真的不知道出了什么问题。

const Discord = require('discord.js');
const bot = new Discord.Client();
bot.login('BOT TOKEN');

bot.on('voiceStateUpdate', (oldMember, newMember) => {
  let newUserChannel = newMember.voiceChannel
  let oldUserChannel = oldMember.voiceChannel
  let textChannel = oldMember.guild.channels.get('TEXTCHANNEL ID')

  if(oldUserChannel === undefined && newUserChannel !== undefined) {

    if (newMember.id === 'MEMEBER ID')         //Member 1
    {   
       newUserChannel.join()
       .then(connection => {
          console.log("Joined voice channel!");
          const dispatcher = connection.playFile("C:\Users\NAME\Documents\Welcome_Bot\music\bossman.mp3");

          dispatcher.on("end", end => {newUserChannel.leave()});
       })
        .catch(console.error);

    }
      else if (newMember.id === 'MEMEBER ID')       //Member 2
      {
       textChannel.send('Hello Member 2')
      }
        else if …
Run Code Online (Sandbox Code Playgroud)

javascript discord discord.js

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

沃森:对话.他们需要吗?

我们正在开发一种与Watson互动的微服务.

我看到了以下论点:"没有必要在Watson的Conversation项目中使用对话框.声明意图和实体就足以完成工作了"

基于文档,我的印象是使用对话框是为了正确训练Watson如何解释意图和实体的组合.另外,在"对话"部分中,您可以进行聊天,以便进行更正.

有没有办法可以确认Dialogs是否是要求?

ibm-watson watson-conversation ibm-cloud

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

带有 Asp .NET Core 的多租户 Web 应用程序登录问题

设置多租户应用程序后,出现以下错误。处理请求时发生未处理的异常。

SecurityTokenInvalidIssuerException: IDX10205: 发行人验证失败。发行人:“ https://sts.windows.net/2566cb39-d9fg-5ad6-tryb-d1e2kl067a89/ ”。不匹配:validationParameters.ValidIssuer:'null'或validationParameters.ValidIssuers:' https : //sts.windows.net/{tenantid}/'。

Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler+d__12.MoveNext() 堆栈查询 Cookie 标头 SecurityTokenInvalidIssuerException:IDX10205:颁发者验证失败。发行人:“ https://sts.windows.net/2096cb39-d9fd-4ad6-bbeb-d1e2be067a89/ ”。不匹配:validationParameters.ValidIssuer: 'null' 或 validationParameters.ValidIssuers: ' https://sts.windows.net/{租户}/'。Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler+d__12.MoveNext() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) Microsoft.AspNetCore.Authentication.AuthenticationMiddleware+d__6.Move () System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) Microsoft.AspNetCore.Session.SessionMiddleware+d__9.MoveNext() Microsoft.AspNetCore.Session.SessionMiddleware+d__9 .MoveNext() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter。

下面是startup.cs代码

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Threading.Tasks;
    using LPPlusUI.Models;
    using Microsoft.AspNetCore.Authentication;
    using Microsoft.AspNetCore.Authentication.Cookies;
    using Microsoft.AspNetCore.Authentication.JwtBearer;
    using Microsoft.AspNetCore.Authentication.OpenIdConnect;
    using Microsoft.AspNetCore.Builder;
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.EntityFrameworkCore;
    using Microsoft.Extensions.Configuration;
    using Microsoft.Extensions.DependencyInjection;
    using Microsoft.Extensions.FileProviders;
    using Microsoft.IdentityModel.Tokens;
    using ReflectionIT.Mvc.Paging;
    namespace LPPlusUI
    {
        public class Startup
        { …
Run Code Online (Sandbox Code Playgroud)

azure multi-tenant azure-active-directory azure-web-app-service asp.net-core

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