我正在使用 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 …
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意味着什么?
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 ?请解释
我一直在尝试使用 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) 我已经为我的项目配置了 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) 我正在使用 firebase 构建一个小型应用程序。我尝试将我的 firebase api 密钥放入API_KEY=somekey根文件夹中的 .env 文件中,但是当我使用 process.env.API_KEY 时,我在浏览器控制台中收到错误,如下图所示。
但是,我已在 .env 中正确复制了我的 api-key。还有什么问题吗?
在使用 process.env.API_KEY 之前,是否需要在 package.json 中完成任何配置?
我正在阅读《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) 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 ×2
reactjs ×2
tailwind-css ×2
contentful ×1
css ×1
dotenv ×1
firebase ×1
gatsby ×1
graphql ×1
nestjs ×1
opencv ×1
pandas ×1
postgresql ×1
python-2.x ×1
python-3.x ×1
typeorm ×1