小编JSK*_*JSK的帖子

致命错误LNK1104:无法打开文件'gdi32.lib'

每次我尝试运行我的代码时都会收到此错误.我已经尝试了一切,安装SDK,但我仍然得到同样的错误.

1>------ Build started: Project: ConsoleApplication6, Configuration: Debug Win32 ------
1>LINK : fatal error LNK1104: cannot open file 'gdi32.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Run Code Online (Sandbox Code Playgroud)

我正在使用Windows 7和Visual Studio 2012.

c++ visual-studio visual-studio-2012

24
推荐指数
3
解决办法
3万
查看次数

tsc 没有创建 dist 文件夹

一切都在标题中,试图将我的 TypeScript 项目编译到 ./bin 文件夹,tsc 命令执行没有错误导致没有创建任何内容,不知道为什么。

我的 tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": false,
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "lib": ["es6", "es7", "dom", "esnext"],
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmit": true,
    "noImplicitAny": false,
    "outDir": "bin",
    "removeComments": true,
    "sourceMap": true,
    "target": "es2017",
    "rootDirs": ["src/", "config/"],
    "typeRoots": ["./node_modules/@types", "./typings"]
  },
  "include": ["src/**/*", "./typings"],
  "exclude": ["node_modules", "bin", "**/__mocks__*", "**/*.spec.**", "test", "assets"]
}
Run Code Online (Sandbox Code Playgroud)

在我的 package.json 这是我要编译的脚本:

"scripts": {
    "build-ts": "tsc",
    "watch-ts": "tsc -w",
  },
Run Code Online (Sandbox Code Playgroud)

我的项目结构:

rootdir
    |
    |-----src
    |      |----server.ts
    |      |----app.ts
    |-----test …
Run Code Online (Sandbox Code Playgroud)

javascript node.js typescript

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

Jestjs中spyOn()。and.callfake的替代方法

我以前使用spyOn().and.callFake过茉莉花,它对我的​​测试有很大帮助,现在我使用的是Jest,我已经在文档中找到了,jest.spyOn()但是没有callFake

我的问题:如何监视方法并使用Jest和调用Fake expect

javascript reactjs jestjs

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

无法在react jsx value props中重复十六进制html实体

所以我的问题是为什么这样做并显示点:

<Field label="Password" value="&#x2022;&#x2022;&#x2022;&#x2022;&#x2022;" type="password" />
Run Code Online (Sandbox Code Playgroud)

上面只显示了普通的六进制代码!

<Field label="Password" value={`${'&#x2022;'.repeat(10)}`} type="password" />
Run Code Online (Sandbox Code Playgroud)

我的字段组件:

function renderValueByType(value: string, type: string) {
  switch (type) {
    case 'phone':
      return phoneFormatter(value);

    default:
      return value;
  }
}

/**
 * 
 * @param {*} param0 
 */
const Field = ({ label, value, type, className }: PropTypes) => (
  <div className={className}>
    <span className="Field__label">{label}</span>
    <span className="Field__content">{renderValueByType(value, type)}</span>
  </div>
);
Run Code Online (Sandbox Code Playgroud)

html javascript jsx reactjs flowtype

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

影响值后,变量始终为0

我正在尝试用字符串创建哈希映射,地图采用以下形式:

{ 'char': charOccurrence }
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

function compress(text) {
  let hash = new Map();
  let prev = [];
  for (let i = 0; i < text.length; i++) {
    let count = 0;
    prev.push(text[i]);
    for (let j = i+1; j < text.length; j++) {
      // if (prev.indexOf(text[j]) !== -1) break;
      if (text[i] === text[j]) {
        count += 1;
        console.log(count);
      }
    }
    hash.set(text[i], count);
  }
  console.log(hash);
}

compress('aaaaahhhheaaadeee');
Run Code Online (Sandbox Code Playgroud)

问题count总是0,我不知道即使在影响for循环中的值之后这是怎么回事.这是我从这段代码中得到的:

Map { 'a' => 0, 'h' => 0, 'e' => 0, …
Run Code Online (Sandbox Code Playgroud)

javascript algorithm hashmap

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

knex 迁移为枚举创建类型 thows 类型已存在

我正在尝试更改表中的列以将 knex 枚举修改为本机类型,以利用 Postgres 的类型系统,当我执行迁移时,我收到此错误类型"request_type" already exists,知道这里发生了什么吗?

export async function up(knex: Knex): Promise<any> {
  return knex.schema.alterTable('appointments', table => {
    table.enu('type', ['video', 'physical'], { useNative: true, enumName: 'request_type' }).alter();
  });
}

export async function down(knex: Knex): Promise<any> {
  return knex.schema
    .alterTable('appointments', table => {
      table.dropColumn('type');
    })
    .then(() => knex.raw('CREATE TYPE request_type AS ENUM("video", "physical")'))
    .then(() => knex.raw('drop type request_type'));
}
Run Code Online (Sandbox Code Playgroud)

migration postgresql database-migration knex.js

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