问题列表 - 第318097页

比较 Excel 中的多个日期列并在任何列中发生日期更改时返回 true 的有效方法是什么

我正在处理 Excel 工作表,我正在尝试比较多个日期列,并在任何日期(不包括空白)发生更改时返回 true。

在此输入图像描述

我尝试过使用“OR”和 if 语句,但它不起作用

我将不胜感激任何支持

excel excel-formula

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

Haskell Foldr1 lambda 函数添​​加元组值

我一直在挠头试图弄清楚这一点。如何使用foldr1(或任何其他折叠)来获取列表中元组的总和。

\n

例子:

\n
list = [(1,2), (3,4)]\nsum = 10\n
Run Code Online (Sandbox Code Playgroud)\n

我已经尝试过,foldr1 (\\x y -> fst(x) + snd(x) + y) [(1,2),(3,4)]但它不起作用,我怀疑它与执行折叠时创建的类型而不是元组有关。

\n

当我运行上述命令时,我得到以下信息:

\n
foldr1 (\\x y -> fst(x) + snd(x) + y) [(1,2),(3,4)]\n\n\xe2\x80\xa2 Occurs check: cannot construct the infinite type: a ~ (a, a)\n    \xe2\x80\xa2 In the second argument of \xe2\x80\x98(+)\xe2\x80\x99, namely \xe2\x80\x98y\xe2\x80\x99\n      In the expression: fst (x) + snd (x) + y\n      In the first argument of \xe2\x80\x98foldr1\xe2\x80\x99, namely\n        \xe2\x80\x98(\\ x y -> fst (x) + …
Run Code Online (Sandbox Code Playgroud)

haskell functional-programming tuples list fold

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

如何使用或输入 TypeScript 泛型

我试图为其中任何一个提供通用方法的打字匹配。在下面的示例中,我有一个预定义的方法识别,它接受通用类型。现在我想定义 OR 类型来识别,它应该接受人或位置。

身份方法来自我无法修改的第三方库。当我尝试下面的场景时,它返回了一个错误

Argument of type '{ city: string; country: string; }' is not assignable to parameter of type 'Person | Location'.
  Type '{ city: string; country: string; }' is missing the following properties from type 'Location': ancestorOrigins, hash, host, hostname, and 9 more.
Run Code Online (Sandbox Code Playgroud)
function identity<Type>(arg: Type): Type {
  return arg;
}

interface Person {
  name: string;
  age: number;
}

interface Location {
  city: string;
  country: string;
}

identity<Person | Location>({city: 'SA', country: 'USA'})
Run Code Online (Sandbox Code Playgroud)

typescript

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

带有“虚拟”参数的类型类方法

类型类Data. Bits有一个方法,如果参数的类型是有符号类型,isSigned :: a -> Bool则返回该方法。True文档明确指出该参数被忽略。类型类中还有其他类似的方法;还有其他类型类也具有此类方法。我的问题:为什么选择这样的设计?该值仅取决于类型,所以为什么不只是:

isSigned :: Bool
Run Code Online (Sandbox Code Playgroud)

作为后续:假设我有一个带有 nullary method 的自定义类型类method :: Bool。是否有任何理由改变它并这样做Data.Bits,即method :: a -> Bool

haskell

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

更新内核 6.1.0-18 时出现依赖性问题

我只是 Debian 12 用户一周,说实话,这已经是我第三次尝试正确安装了。今天我尝试配置我的 WiFi 适配器 TP-Link Archer T4U Plus AC1300,并在其上安装驱动程序。首先,我遵循了以下说明:https://github.com/morrownr/88x2bu-20210702,它实际上对我有所帮助,而之前安装的 Debian 这次一切都出了问题。
因此,在努力解决问题的同时,我找到了这个存储库https://github.com/fastoe/RTL8812BU。完成后,sudo apt update && sudo apt upgrade我注意到有趣的新 6.1.0-18 内核模块,它与我88x2bunvidia-current/525.147.05驱动程序发生 cpnflicting。我试图在复制的存储库文件夹中使用remove-driver.sh卸载第一个,但问题仍然出现。这是执行任何sudo apt installor操作时的输出sudo apt upgrade

Setting up linux-image-6.1.0-18-amd64 (6.1.76-1) ...
I: /initrd.img is now a symlink to boot/initrd.img-6.1.0-18-amd64
/etc/kernel/postinst.d/dkms:
dkms: running auto installation service for kernel 6.1.0-18-amd64.
Sign command: /usr/lib/linux-kbuild-6.1/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
'make' all …
Run Code Online (Sandbox Code Playgroud)

dpkg linux-kernel

7
推荐指数
2
解决办法
5499
查看次数

如何知道我是否从非阻塞套接字读取了所有内容

我有一个我接受的非阻塞连接套接字:

我有一个非阻塞套接字连接,在收到数据包后,我尝试使用 recv 读取更多数据。

struct sockaddr accepted_address;
socklen_t accepted_address_size = sizeof(accepted_address);

int fd = accept(server_fd, &accepted_address, &accepted_address_size);
make_nonblocking(fd);

... // wait when socket is ready to give me data

char buffer[BUF_SIZE];
int  used = 0;

while (true) {
    int bytes_received = recv(fd, buffer, BUF_SIZE, 0);
    if (bytes_received > 0) { /* OK */ }
    else if (bytes_received < 0) {
        if (errno == EAGAIN || errno == EWOULDBLOCK) {
            /* Should wait for more data, BUT I WILL WAIT INDEFINITELY!!! …
Run Code Online (Sandbox Code Playgroud)

c sockets

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

为什么 boost::atomic 支持非平凡可复制对象?

boost::atomic 要求 T 可以轻松复制。但为什么下面的代码有效呢boost::atomic<atom>


#include <chrono>
#include <iostream>
#include <memory>
#include <unordered_set>
#include <parallel/algorithm>
#include <boost/algorithm/cxx11/all_of.hpp>
#include <boost/atomic.hpp>
#include <boost/optional/optional.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/algorithm/count_if.hpp>
#include <boost/range/algorithm/remove_if.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/algorithm/unique.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/numeric.hpp>


typedef uint32_t vint;  // Integer for vertex IDs

constexpr vint vmax = std::numeric_limits<vint>::max();  // Used as invalid ID

struct atom {
  boost::atomic<float> str;    // Total weighted degree of the community members
  boost::atomic<vint>  child;  // Last vertex that is merged to this vertex
  std::string c; …
Run Code Online (Sandbox Code Playgroud)

c++ boost stdatomic

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

当类型为 int8_t 且 base=2 时 std::from_chars 中的错误

std::from_chars将位字符串 (base=2) 解析为有符号 8 位整数时失败,并出现一般错误,而std::stoi解析有符号 8 位整数时不会出现错误。

下面程序中的两个块都解析相同的位串。程序以调用std::abort第二个块中的第一个断言结束。std::stoi解析相同的位串没有错误。

// Compile: g++ -std=c++17 -O0 -g main.cc -o main
#include <string>
#include <cassert>
#include <charconv>
#include <cstdint>

int main()

{
    {
        std::string bits = "10011100";
        int base = 2;
        std::int8_t num = std::stoi(bits.c_str(), nullptr, base);
        assert(num == -100);
    }

    {
        // Bug found in std::from_chars when type is int8_t and base=2.
        std::string bits = "10011100";
        int base = 2;
        std::int8_t num;
        auto [ptr, ec] = …
Run Code Online (Sandbox Code Playgroud)

c++ c++17

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

指针问题 - 查找奇数并将它们存储在数组中

我得到了这个函数,我添加了这段代码来遍历数组中的数字,然后我有另一个变量来计算奇数的数量,放入第二个数组

int CopySelected(const int array[], int size, int odd_numbers[])
{
    int oddCounter = 0;
    int i;
    for (i = 0; i < size; ++i)
     {
         if (array[i]%2 != 0)
         odd_numbers[++oddCounter] = array[i];
     }
    return oddCounter;
    
}

Run Code Online (Sandbox Code Playgroud)

该代码因错误而通过,但失败了。有什么建议么?

c++ arrays sorting pointers

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

GCP pub/sub 客户端在版本 4.0.0 以上失败并出现身份验证错误

当我尝试创建主题时会发生这种情况

   TypeError: this.auth.getUniverseDomain is not a function
        at GrpcClient.createStub (/Users/<...>/node_modules/google-gax/src/grpc.ts:418:48)
        at processTicksAndRejections (node:internal/process/task_queues:95:5)
Run Code Online (Sandbox Code Playgroud)

示例代码:

pubSubClient = new PubSub({
      "projectId": "project_name"
    });

initTopic = async () => {
    // Creates a new topic if it does not exist
    const [topics] = await this.pubSubClient.getTopics()
    RootLogger.info("topic names: " + topics.join(","))
    const topicExists = topics.some(topic => topic.name.endsWith(this.topicName));

    if (topicExists) {
      RootLogger.info(`Topic ${this.topicName} already exists.`);
    } else {
      await this.pubSubClient.createTopic(this.topicName);
      RootLogger.info(`Topic ${this.topicName} created.`);
    }
  }
Run Code Online (Sandbox Code Playgroud)

authentication node.js typescript google-cloud-platform google-cloud-pubsub

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