小编npk*_*pkp的帖子

类型错误:rxjs_1.lastValueFrom 不是函数

我正在使用 nestjs 构建一个 api。添加 typeorm 和 pg 依赖项并添加如下所示的TypeOrmModule.forRoot({})代码后app.module.ts

import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { CoffeesModule } from './coffees/coffees.module';

@Module({
  imports: [CoffeesModule, TypeOrmModule.forRoot({
    type: 'postgres',
    host: 'localhost',
    port: 5432,
    username: 'postgres',
    password: 'xxx',
    database: 'postgres',
    autoLoadEntities: true,
    synchronize: true
  })],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule { }

Run Code Online (Sandbox Code Playgroud)

TypeError: rxjs_1.lastValueFrom is not a function …

postgresql typeorm nestjs

16
推荐指数
3
解决办法
4670
查看次数

解释cv2.filter2d()opencv中的ddepth参数?

import cv2
import numpy as np
from matplotlib import pyplot as plt

img = cv2.imread('logo.png')

kernel = np.ones((5, 5), np.float32) / 25
dst = cv2.filter2D(img, -1, kernel)
plt.subplot(121), plt.imshow(img), plt.title('Original')
plt.xticks([]), plt.yticks([])
plt.subplot(122), plt.imshow(dst), plt.title('Averaging')
plt.xticks([]), plt.yticks([])
plt.show()
Run Code Online (Sandbox Code Playgroud)

我正在尝试使图片平滑,但我不了解cv2.filter2d()的ddepth参数,其中值为-1。那么-1做什么,而且ddpeth意味着什么?

opencv

6
推荐指数
2
解决办法
6358
查看次数

“元组”对象不是使用 matplotlib 库的可调用错误?

1  def auto_correlate(x):
2     cor = np.correlate(x,x,mode="full")
3     return cor[N-1:]

4  c = np.zeros(N)
5  c = auto_correlate(x-ave)/N
6  plt.plot(c)
7  plt.xlim(-1000, 10000)
8  plt.xlabel(r'$i$',fontsize=16)
9  plt.ylabel(r'$\varphi(i)$',fontsize=16)
10 print('\sigma^2 = ', std**2)
11 plt.show()
Run Code Online (Sandbox Code Playgroud)

为什么我不断收到错误 'tuple' object not callable online 7 ?请解释

python-3.x

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

Tailwind CSS - 项目之间的垂直间距

我一直在尝试使用 Tailwind CSS 的 content- Between 来分配容器中的行,以便每行之间有相等的空间。请帮忙。

<div className="w-96 mx-10">
  <div className="flex flex-col content-between">
    <div className="bg-red-400">
      <h2 className="text-3xl">Technology Used</h2>
    </div>
    <div className="text-lg bg-blue-200">
      <ul>
        <li>ITEM1</li>
        <li>ITEM2</li>
        <li>ITEM3</li>
        <li>ITEM4</li>
      </ul>
    </div>
    <div className="bg-green-100">{project.description}</div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

css tailwind-css

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

顺风错误:需要伪类或伪元素

我已经为我的项目配置了 tailwindcss,但是在npm run start出现以下错误后。

(node:7032) UnhandledPromiseRejectionWarning: Error: Expected a pseudo-class or pseudo-element. at D:\projects\frontend\example1\src\styles\tailwind.css:5:3它指向下面的 tailwind.css 文件。

tailwind.css。

@tailwind base;
@tailwind components;

.input {
  @apply focus: outline-none focus:border-gray-500 p-3 border-2 text-lg font-light border-gray-200;
}

.btn {
  @apply py-3 px-5 bg-gray-800 text-white font-semibold mt-3 rounded-lg text-lg focus: outline-none hover:opacity-90;
}

@tailwind utilities;
Run Code Online (Sandbox Code Playgroud)

package.json 中的脚本是

"scripts": {
    "tailwind:build": "npx tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/styles.css",
    "apollo:codegen": "rimraf src/__generated__ && apollo client:codegen src/__generated__ --target=typescript --outputFlat",
    "start": "npm run apollo:codegen && npm run …
Run Code Online (Sandbox Code Playgroud)

reactjs tailwind-css

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

process.env.API_KEY 未定义

我正在使用 firebase 构建一个小型应用程序。我尝试将我的 firebase api 密钥放入API_KEY=somekey根文件夹中的 .env 文件中,但是当我使用 process.env.API_KEY 时,我在浏览器控制台中收到错误,如下图所示。

在此输入图像描述

但是,我已在 .env 中正确复制了我的 api-key。还有什么问题吗?

在使用 process.env.API_KEY 之前,是否需要在 package.json 中完成任何配置?

firebase reactjs dotenv

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

KeyError: 0 当尝试访问 pandas DataFrame 中的行时

我正在阅读《Hands on machine Learning with scikit-learn》一书来学习机器学习,下面是显示 MNIST 图像的代码,但当我keyError 0尝试从数据集中索引单个图像时,我得到了 。

from sklearn.datasets import fetch_openml

mnist = fetch_openml('mnist_784', version=1)

X, y = mnist["data"], mnist["target"]

some_digit = X[0]
Run Code Online (Sandbox Code Playgroud)

以下是在 jupyter 笔记本中运行单元时出现的错误。

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~\anaconda3\anaconda-py\envs\data-science\lib\site-packages\pandas\core\indexes\base.py:3621, in Index.get_loc(self, key, method, tolerance)
   3620 try:
-> 3621     return self._engine.get_loc(casted_key)
   3622 except KeyError as err:

File ~\anaconda3\anaconda-py\envs\data-science\lib\site-packages\pandas\_libs\index.pyx:136, in pandas._libs.index.IndexEngine.get_loc()

File ~\anaconda3\anaconda-py\envs\data-science\lib\site-packages\pandas\_libs\index.pyx:163, in pandas._libs.index.IndexEngine.get_loc()

File pandas\_libs\hashtable_class_helper.pxi:5198, in pandas._libs.hashtable.PyObjectHashTable.get_item()

File pandas\_libs\hashtable_class_helper.pxi:5206, in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 0

The above exception was the direct …
Run Code Online (Sandbox Code Playgroud)

python pandas

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

python super()函数错误?

class car(object):

    def __init__(self, make, model, year):
        self.make = make
        self.model = model
        self.year = year
        self.odometer_reading = 0

class electricCar(car):
    def __init__(self, make, model, year):
        super().__init__(make, model, year)

tesla = electricCar('tesla', 'model s', 2016)
print tesla.get_descriptive_name()
Run Code Online (Sandbox Code Playgroud)

TypeError:super()至少需要1个参数(给定0)

super()函数有什么问题?

python python-2.x

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

内容内容在 GraphQL 查询中显示两次

我正在学习 gatsby 和 contentful 来构建一个网站,但是当我从 Contentful 查询数据时,它会显示相同的内容两次,如下所示。可能是什么原因?

在此输入图像描述

content-management-system contentful graphql gatsby contentful-api

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