小编th3*_*man的帖子

Valgrind在macOS Sierra上

我遵循本指南:

valgrind安装指南

在我下载了包之后,我运行了sh脚本,但是当我启动make install命令时,它无法创建该文件夹,因为它没有权限(即使我已经使用了该sudo命令).

此外,我尝试使用brew,但我有这个错误:

valgrind:由于上游不兼容,此公式要么不能在比El Capitan更新的macOS版本上按预期编译或运行.

错误:未满足的要求未通过此构建.

valgrind macos-sierra

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

无法将节点获取导入 Typescript

我正在尝试导入node-fetch到我的Typescript项目中,但遇到了以下错误:

[ERR_REQUIRE_ESM]:必须使用 import 来加载 ES 模块:/Users/xxx/xxx/xxx/xxx/xxx/xxx/xxx/node_modules/node-fetch/src/index.js 不支持 ES 模块的 require()。

这是我的设置:

  1. 节点:v16.1.0
  2. 打字稿:4.5.2

node-fetch包被导入到我的项目中,如下所示:import fetch from 'node-fetch';'

这是我的tscongif.json

{
  "compilerOptions": {
    "module": "CommonJS",
    "sModuleInterop": true,
    "target": "ES2020",
    "allowJs": true,
    "noImplicitAny": true,
    "moduleResolution": "node",
    "outDir": "dist",
    "baseUrl": ".",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "resolveJsonModule": true,
    "typeRoots": [ 
      "src/@types/",
      "node_modules/@types",
    ],
    "strict": true,
    "strictNullChecks": true,
    "allowSyntheticDefaultImports": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "noEmit": true,
    "skipLibCheck": true,
  },
  "include": [
    "src/**/*",
    "config/**/*"
  ]
}
Run Code Online (Sandbox Code Playgroud)

我还尝试添加"type": …

node.js typescript

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

在 C++ 中格式化字符串的最佳方法

javascript可以使用格式化字符串template string

const cnt = 12;
console.log(`Total count: ${cnt}`);
Run Code Online (Sandbox Code Playgroud)

如果我与我一起工作,python我可以使用f-string

age = 4 * 10
f'My age is {age}'
Run Code Online (Sandbox Code Playgroud)

但是,如果我使用C++(17)什么是最好的解决方案(如果可能的话)?

c++ string c++17

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

C-函数具有内部链接,但未定义

我有这个文件夹结构:

结构体

我编写了一个简单的函数来测试文件夹结构,以查看是否所有头文件都存在,但是当我使用make命令进行编译时,出现以下错误:

警告:函数“ stampa”具有内部链接,但未定义

我的lagrange.h文件我有这个:

#ifndef LAGRANGE_H

static void stampa(int i);

#endif /* LAGRANGE_H */
Run Code Online (Sandbox Code Playgroud)

lagrange.c文件中我有这个:

#include <stdlib.h>
#include <stdio.h>
#include <math.h>

#include <stdio.h>

void stampa(int i){
    printf("%d", i);
}
Run Code Online (Sandbox Code Playgroud)

最后,int main.c我只是简单地调用stampa传递给他们一个数字的函数。

c makefile compilation gnu-make

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

JsPDF - 无法读取未定义的属性“charAt”

我写了这个简单的代码来测试jsPDF库:

const base64Img = require('base64-img');
const JsPDF     = require('jspdf');

const LAYOUT    = base64Img.base64Sync('img/layout.png');    

$('#esporta').click( () => {
    var pdf = new JsPDF();
    pdf.addImage(LAYOUT, 'PNG', 18.25, 19.25, 190, 255);
    pdf.save('test.pdf');
});
Run Code Online (Sandbox Code Playgroud)

我有一个简单的按钮,当它点击时应该生成 pdf;但我有这个错误:

未捕获的类型错误:无法在 HTMLButtonElement.$.click (export.js) 处读取未定义的属性“charAt” :62) 在 HTMLButtonElement.dispatch (jquery-3.3.1.min.js:2) 在 HTMLButtonElement.y.handle (jquery-3.3.1.min.js:2)

该行export.js:62是pdf的创建:var pdf = new JsPDF();

javascript jspdf electron

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

如何使用 React 管理多步骤表单?

这是我的多步表单的代码:

import clsx from 'clsx';
import React from 'react';
import PropTypes from 'prop-types';
import { makeStyles, withStyles } from '@material-ui/styles';
import Step from '@material-ui/core/Step';
import Stepper from '@material-ui/core/Stepper';
import StepLabel from '@material-ui/core/StepLabel';
import StepConnector from '@material-ui/core/StepConnector';
import { Container, Row, Col, Button } from 'react-bootstrap';

import Description from '@material-ui/icons/Description';
import AccountCircle from '@material-ui/icons/AccountCircle';
import DirectionsCar from '@material-ui/icons/DirectionsCar';

import Step1 from '../components/Step1';
import Step2 from '../components/Step2';
import Step3 from '../components/Step3';

const styles = () => ({
  root: {
    width: '90%',
  }, …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs material-ui

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

Prisma - 在更多条件下更新一项资源

我想知道是否可以在多种条件下更新资源。例如,考虑以下两个表:

+----------+----------+
|  Table1  |  Table2  |
+----------+----------+
| id       | id       |
| param1T1 | param1T2 |
| param2T1 | param2T2 |
| idTable2 |          |
+----------+----------+
Run Code Online (Sandbox Code Playgroud)

我想将一条记录更新到表中Table1,我知道该归档idprimary keyANDidTable2具有特定值。

使用该.update()方法,我在编译时遇到错误,但我不明白为什么无法使用更多条件更新单个身份。这是我的更新:

table1.update({
  where: {
    AND: [
      { id: 1 },
      { Table2: { id: 1 } }
    ]
  },
  data: toUpdate
 });
Run Code Online (Sandbox Code Playgroud)

现在,我使用.updateMany(). .update()有解决办法还是不可能?

node.js typescript prisma

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

更新由以下人员管理的视图的属性“填充”时出错:RNSVGReact

我尝试使用这个库渲染一个二维码:react-native-qrcode-svg但我有这个错误:

更新由以下人员管理的视图的属性“填充”时出错:RNSVGReact

我安装了所需的软件包,react-native-svg但问题仍然存在。我正在使用所有软件包的最新版本。

这是完整的代码:

import React, { Component } from 'react';
import QRCode from 'react-native-qrcode-svg';

export default class MyQRCode extends Component {
  render() {
    return (
      <QRCode
        value="http://awesome.link.qr"
      />
    );
  };
}
Run Code Online (Sandbox Code Playgroud)

react-native expo

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

C++ - 获取模板的类型名,其中该类用作另一个模板

我想从另一个使用基于第一个类的模板的类中获取类模板的类型名。

我写了一个这样的类:

template<typename T>
class class_a {
  ...
}
Run Code Online (Sandbox Code Playgroud)

我想做一些事情:

template<class class_a>
class class_b {
  std::vector<class_a.T> arr;
  ...
}
Run Code Online (Sandbox Code Playgroud)

c++ templates typename c++17

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

C# - Microsoft.Office.Interop.Excel.Sheets到Microsoft.Office.Interop.Excel.Worksheet []

我正在尝试创建一个WorksheetExcel文件的数组,但我找不到正确的演员.

这是代码:

Excel.Application app = new Excel.Application();
Excel.Workbook book = app.Workbooks.Open(pathFile);
int numSheet = book.Worksheets.Count;
Excel.Worksheet[] sheets = new Excel.Worksheet[numSheet];
sheets = (Excel.Worksheet[])book.Worksheets;
Run Code Online (Sandbox Code Playgroud)

正如您从代码中看到的那样,我尝试使用该演员,但这是多余的.我该如何解决这个问题?

c# excel excel-interop

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

对齐引导卡内容

正如您从图像中看到的,最后一行文本与其他(其他引导卡的)文本不对齐。从逻辑上讲,这个事实主要取决于上部文本的大小。

如何确保无论文本长度如何,三个基本部分始终对齐?还考虑到标题(文本的第一行)可能位于多行上(非常极端的情况)。

这是仅一张卡的代码:

<div class='col-lg-4' style='cursor: pointer; padding-bottom: 15px;'>
    <div style='height: 377.59px;' class='card mb-3' style='border: 1px solid #33cdc6;'>
        <img style='height:185.59px; width: 100%;' class='card-img-top' src='#' alt='Card image cap'>
        <div class='card-body'>
            <h5 class='card-title' style='color: #293a44;'>TITOLO</h5>
            <p class='card-text'>Breve descrizione</p>
            <p class='card-text'>
                <span class='h5 text-muted'>Montepremi</span>";
                <small style='padding-left: 125px;' class='text-muted'>data</small>
            </p>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

实际状态

html css bootstrap-4

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