我正在 Angular8 中做一个项目并使用 ChartJS 创建图表。运行项目后,它将显示图表。但它会给出一个错误说:
Property 'getContext' does not exist on type 'HTMLElement'.
Run Code Online (Sandbox Code Playgroud)
我如何摆脱这个错误?
这是我的代码:
图表.component.html
<div id="container" style="width:350px;height:250px">
<canvas id="myChart" width=300 height=300></canvas>
</div>
Run Code Online (Sandbox Code Playgroud)
图表组件.ts
import {Component, OnInit} from '@angular/core';
import {Chart} from 'chart.js';
import {ChartService} from '../charts/chart.service';
import {HttpClient} from '@angular/common/http';
// import {DATA} from '../CHART/CHARTS.MODEL';
@Component({
selector: 'app-charts',
templateUrl: './charts.component.html',
styleUrls: ['./charts.component.scss']
})
export class ChartsComponent implements OnInit {
constructor(
private ChartItems: ChartService,
private httpClient: HttpClient
) { }
ngOnInit() {
this.getChartDetails();
}
getChartDetails() {
this.ChartItems.getChart().subscribe(data => { …Run Code Online (Sandbox Code Playgroud) 当我创建一个 PyTorch DataLoader 并开始迭代时——我得到了一个非常慢的第一个纪元(x10--x30 比所有下一个纪元都慢)。此外,此问题仅出现在来自 Kaggle 的 Google 地标识别 2020 的训练数据集上。我无法在合成图像上重现此内容,此外,我尝试创建一个包含来自 GLR2020 的 500k 图像的文件夹,并且一切正常。在PyTorch论坛中发现了几个类似的问题,没有任何解决办法。
import argparse
import pandas as pd
import numpy as np
import os, sys
import multiprocessing, ray
import time
import cv2
import logging
import albumentations as albu
from torch.utils.data import Dataset, DataLoader
samples = 50000 # count of samples to speed up test
bs = 64 # batch size
dir = '/hdd0/datasets/ggl_landmark_recognition_2020/train' # directory with train data
all_files = pd.read_csv('/hdd0/datasets/ggl_landmark_recognition_2020/train.csv')
files = np.random.choice(all_files.id.values, 50000)
files = …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试在我正在制作的电子应用程序上获得圆角。目前我已经尝试了几乎所有在线可用的解决方案,但没有一个有任何区别。
如何绕过 Electron 应用程序的四角?
我在我的 Windows 机器上安装了以下内容:
节点:v12.18.4
纱线:1.19.1
创建反应应用程序:3.4.1
我导航到文件夹 c:\temp,然后尝试使用以下命令创建 react 应用程序:
c:\temp>create-react-app react-test --scripts-version 1.1.5
在执行上述命令时,我看到以下错误:
Creating a new React app in C:\Temp\react-test.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
yarn add v1.19.1
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: unable to get local issuer certificate".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Temp\\react-test\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation …Run Code Online (Sandbox Code Playgroud) 我已经使用Vue有一段时间了,我注意到我可以将项目图像存储在assets文件夹或public文件夹中。
要从assetsVue 中的文件夹访问图像,可以这样做:src="require('@/assets/images/myimage.jpg')"
要从publicVue 中的文件夹访问图像,可以这样做:src="./static/images/myimage.jpg"
存储 Vue 项目图像的正确位置是什么?
使用两者的含义是什么?
它们如何影响我的项目?
我使用默认的 vue-cli 命令创建了一个 vue 项目。
当 webpack 构建时,它失败了,如图所示:
我没有使用任何特殊的 webpack 配置。我究竟做错了什么?
我的 package.json:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.4.4",
"firebase": "^7.6.2",
"register-service-worker": "^1.6.2",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-plugin-eslint": "^4.1.0",
"@vue/cli-plugin-pwa": "^4.1.0",
"@vue/cli-plugin-router": "^4.1.0",
"@vue/cli-plugin-vuex": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"babel-eslint": "^10.0.3",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.0",
"vue-template-compiler": "^2.6.10"
},
"browserslist": [
"> 1%",
"last 2 …Run Code Online (Sandbox Code Playgroud) 如果我的 lambda 函数内存使用量超过 lambda 内存大小的 80%,我设置了警报以通知我。我正在使用自定义指标捕获数据点,并且当内存使用量超过阈值时,我能够在 cloudwatch 控制台中看到警报。但是当警报采取行动向相应的 SNS 主题发送通知时失败并显示以下消息:
{
"actionState": "Failed",
"stateUpdateTimestamp": 1558142246126,
"notificationResource": "arn:aws:sns:us-east-1:5847563209:<myTopic>",
"publishedMessage": null,
"error": "null (Service: AWSKMS; Status Code: 400; Error Code: AccessDeniedException; Request ID: 6b7806a6-2c16-4582-9ecd-05100161746e)"
Run Code Online (Sandbox Code Playgroud)
}
SNS 主题使用 KMS 密钥加密,我允许 cloudwatch 访问密钥策略中的密钥:
{
"Sid": "Allow CloudWatch to use the key",
"Effect": "Allow",
"Principal": {
"Service": "cloudwatch.amazonaws.com"
},
"Action": [
"kms:GenerateDataKey",
"kms:Decrypt"
],
"Resource": "*"
}
Run Code Online (Sandbox Code Playgroud)
但行动仍然失败。我也试过events.amazonaws.com当校长,但没有运气。我很感激这方面的任何帮助。
// 在使用第三方网关托管表单之前创建会话
public function ezi_test() {
if (isset($_SESSION['form_data'])) {
unset($_SESSION['form_data']);
}
$this->common->maintain_log(array('collection_type'=>3,'org_id'=>'','log_path'=>'gateway_log/ezidebit/hosted_payment_formdata_creation_bef','log_data'=>json_encode($_REQUEST)));
parse_str($_REQUEST['data1'], $_REQUEST);
$_SESSION['paynow']['tnc']['email_id'] = isset($_REQUEST['email_id']) ? $_REQUEST['email_id'] : '';
$this->common->maintain_log(array('collection_type'=>3,'org_id'=>'','log_path'=>'gateway_log/ezidebit/hosted_payment_formdata_creation','log_data'=>json_encode($_REQUEST)));
$_SESSION['form_data'] = $_REQUEST
}
Run Code Online (Sandbox Code Playgroud)
// 在第三方回调上检索会话 public function ezi_hosted_payment() {
if (isset($_SESSION['ezi_hosted'])) {
unset($_SESSION['ezi_hosted']);
}
if (isset($_SESSION['form_data'])) {
$form_data = $_SESSION['form_data'];
unset($_SESSION['form_data']);
}
$this->common->maintain_log(array('collection_type'=>3,'org_id'=>'','log_path'=>'gateway_log/ezidebit/hosted_payment_log','log_data'=>json_encode($_REQUEST)));
$this->common->maintain_log(array('collection_type'=>3,'org_id'=>'','log_path'=>'gateway_log/ezidebit/hosted_payment_formdata','log_data'=>json_encode($form_data)));
$final = array_merge($_REQUEST, $form_data);
$_SESSION['pg_response'] = $_REQUEST;
$this->ezi_gateway_paynow_sub($final);
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 babel 配置 webpack (5),使用 babel-loader 转译为 ES5。不幸的是,输出不一致。基本上,它分为两部分:
如您所见,第一部分包含箭头函数,第二部分没有。我试图将@babel/plugin-proposal-class-properties和添加@babel/plugin-transform-arrow-functions到我的.babelrc文件中,但class-properties缺少(启用调试)。
我必须承认,我不确定这class-properties是问题所在,但在谷歌上花了几个小时后,这是我最好的尝试,所以也许我对问题的根源是错误的。
网络包文件:
export default {
entry: './src/index.js',
mode: 'production',
output: {
path: path.resolve(__dirname, '..', '..', 'dist'),
filename: 'bundle.prod.js'
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
.babelrc 文件:
{
"presets": [
[
"@babel/preset-env",
{
"corejs": {
"version": 3
},
"useBuiltIns": "usage",
"debug": true
}
]
],
"plugins": …Run Code Online (Sandbox Code Playgroud) 我创建了用户上传视频的应用程序,我想从该视频中使用nodejs中的ffmpeg提取50张图像,但在将其上传到特定文件夹后我无法获取该文件。我通过 multer 上传视频,因为它将视频存储在指定的文件夹中,之后我使用读取流读取该视频,但它没有提供有关该特定视频的正确信息
代码:
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var path = require('path');
var multer = require('multer');
var cfenv = require('cfenv');
var watson = require('watson-developer-cloud');
var ffmpeg = require('ffmpeg');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({"extended": false}));
app.use(express.static(__dirname + '/public'));
var storage = multer.diskStorage({
destination: function(req, file, callback){
callback(null, './public/class'); // set the destination
},
filename: function(req, file, callback){
callback(null, 199212+ '.avi'); // set the file name and extension
}
});
var upload = multer({storage: storage});
app.upload = …Run Code Online (Sandbox Code Playgroud)