我正在尝试在Windows 10
in上编译一个项目Visual Studio Code
,我的设置如下:
1)npm
版本6.12
2)Node.js
版本12.13
3) Angular CLI: 8.3.19
我的问题是,当我尝试运行ng serve
我收到以下输入:ng : File C:\Users\name\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system
。其次是For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
到目前为止我尝试过的
1)我访问了网站,发现Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
应该是我必须在shell中输入的命令。因此,我所做的是:
PS C:\Users\raggi\OneDrive\Desktop\pitalkdashboard> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
但这导致了以下错误:
Set-ExecutionPolicy : Access to the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell is denied. To change the execution policy for the default (LocalMachine) scope, …
您好,我刚开始styled-components
在我的项目中使用。我的工作环境是:
1) npm version 6.12
2) Node.js version 12.13
3) VS Code
styled-components
从官方文档安装后:
sudo npm install --save styled-components
我的项目不再编译,抛出以下错误:
错误:元素类型无效:应为字符串(对于内置组件)或类/函数(对于复合组件)但得到:对象。您可能忘记从定义组件的文件中导出组件,或者您可能混淆了默认导入和命名导入。
检查 的渲染方法
Home
。
到目前为止我做了什么:
1)根据调试器的建议,我仔细检查了我的Home page
并尝试查看是否忘记了import
该组件。但是,它已正确导入,但仍然无法正常工作。
2)始终按照调试器的建议检查是否存在无效的类型元素。但是我认为语法是正确的。为了确保这一点,我查阅了有关如何正确引用这些类型组件的官方文档。不幸的是它也没有奏效。
3)经过更多研究,我发现了这篇有用的帖子。似乎这可能是由于对包含的引用不准确。但是,在我安装styled-components
. 所有import/export
我都以同样的方式做的。
我提供了以下出现错误的代码片段:
StyledHero.js
import styled from "styled-components"
const SimpleButton = styled.button`
color:red;
background:green;
`;
export default SimpleButton;
Run Code Online (Sandbox Code Playgroud)
主页.js
import React from 'react'
import Hero from "../components/Hero"
import Banner from "../components/Banner"
import {Link} from "react-router-dom" …
Run Code Online (Sandbox Code Playgroud) 我正在尝试读取.tif
或.tiff
浮点灰度图像OpenCV
。
我可以读取和写入常规文件格式,例如等png
,jpg
但我无法从桌面读取我以前从未使用过的格式(即.tif
或.tiff
格式)。
图像:我尝试读取的图像具有以下参数: 大小:
以及宽度和高度:
在一些文档和各种来源之后,我了解到可以使用函数在可用数据类型之间进行转换,可以在此处convertTo
找到来源。然而这并没有很好地工作,我实际上有一个编译错误:
OpenCV(3.4.1) 错误:imshow 中断言失败 (size.width>0 && size.height>0),文件 /home/to/opencv/modules/highgui/src/window.cpp,第 356 行在抛出后终止调用cv::Exception What() 的实例:OpenCV(3.4.1) /home/to/opencv/modules/highgui/src/window.cpp:356: error: (-215) size.width>0 && 大小。函数 imshow 中高度>0
我正在使用的代码如下:
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
Mat img = imread("/home/to/Desktop/example.tif");
cv::imshow("source",img);
Mat dst; // destination image
// check …
Run Code Online (Sandbox Code Playgroud) 我正在使用 HTML、CSS 和 JS 构建一个小型网站示例项目。我有一个按钮,点击后应该下载 PDF 示例数据(目前不需要将文档保存在哪里)。
问题:如何使用按钮下载 PDF 文档HTML
?
我正在为每个我想下载数据的组件使用reactstrap Card 。这仅是一个示例,真实的网站将为每张卡包含一个带有特定可下载信息的按钮。
以下SideBar.js
:
import React from 'react';
import { Card, CardImg, CardText, CardBody, CardTitle, CardSubtitle } from 'reactstrap';
import '../components/SideBar.css';
import { Link } from 'react-router-dom';
class DownloadLink {
render() {
return (
<form method="get" action={this.props.src}>
<button type="submit">{this.props.children}</button>
</form>
);
}
}
class MyButton {
render() {
return <DownloadLink src="/home/emanuele/Desktop/Projects/example1.pdf">Download Project Specs</DownloadLink>;
}
}
const Sidebar = () => (
<div className="map-sidebar"> …
Run Code Online (Sandbox Code Playgroud) 给定以下数据库和相关集合scows.tasks,如何导出 2GB 用于存储目的以腾出空间?
我一直在尝试使用各种方法来做到这一点,但没有一个奏效:
mongoexport --verbose --db scows --collection tasks --out tasks.json --verbose
mongoexport -vvvv --db scows --username='my_username' --password='my_passwd' --collection tasks --out /home/to/Desktop/storageMongo/tasks.json -f 'my_passwd'
mongoexport --host=127.0.0.1 --db scows --collection tasks --out tasts.json
Run Code Online (Sandbox Code Playgroud)
在这样做的过程中,我总是遇到同样的错误:
2020-02-13T12:55:17.183-0500 将监听 SIGTERM、SIGINT 和 SIGKILL 2020-02-13T12:55:20.690-0500 连接到数据库服务器时出错:没有可访问的服务器
我用来解决问题的帖子,但不幸的是并没有帮助我:
1)我用了这个,但什么也没发生
2)这也与上面的结果相同
3)这个来源很有用,但没有帮助我找出问题
4)最后这个帮助我执行命令,但我总是遇到同样的错误。
5)另外,正如官方文档中提到的,我使用Ubuntu 18.04
shell 作为终端来输入命令,而不是mongo
shell。
如何正确地将集合从 MongoDB 导出到我的计算机?
我使用的Visual Studio Code
版本1.42
我Ubuntu 18.04
。我刚刚sudo dotnet add package Google.Apis.Drive.v3
通过终端成功安装,但我找不到System.Web
在我的C#
项目上安装的方法。在做了一些研究之后,我发现了这个,它基本上解释了,我需要访问一个IHostingEnvironment env object
ASP.NET Core 会处理的。
我在解析本地文件路径时遇到问题。我的问题是我不熟悉这种类型的方法,想问问,鉴于下面的代码,有人可以告诉我如何修改它以使用IHostingEnvironment env object
.
问题出现在包含以下内容的行中:
HttpContext.Current.Server.MapPath("~/GoogleDriveFiles")
Run Code Online (Sandbox Code Playgroud)
这是代码的其余部分:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
//using System.Web;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace WebApi2.Models
{
public class GoogleDriveFilesRepository
{
//defined scope.
public static string[] Scopes = { DriveService.Scope.Drive };
// Operations....
//create Drive API service.
public static DriveService GetService()
{
//Operations....
public …
Run Code Online (Sandbox Code Playgroud) 我一直在试图安装铅笔项目上Ubuntu-18.04
实现它之前设计的用户界面。我一直遇到以下安装问题,我不知道为什么。下载后我只
sudo apt install ./pencil_3.1.0.ga_amd64.deb && sudo apt install -f
Run Code Online (Sandbox Code Playgroud)
在警告下方:
emanuele@pc:~/Downloads$ sudo dpkg -i penn_3.1.0.ga_amd64.deb && sudo apt install -f(正在读取数据库...当前安装的 257381 个文件和目录。)准备解包 pen_3.1.0.ga_amd64.deb 。 .. 在 (3.1.0.ga) 上解压铅笔 (3.1.0.ga) ... rm: 无法删除 '/usr/share/applications/pencil.desktop': 没有这样的文件或目录 rm: 无法删除 '/ usr/share/applications/pencil.png': 没有那个文件或目录设置铅笔 (3.1.0.ga) ... mv: 不能统计 'pencil.desktop': 没有那个文件或目录 mv: 不能统计 'pencil .png': 没有那个文件或目录 chmod: 无法访问 '/usr/share/applications/pencil.*': 没有那个文件或目录 正在读取包列表...完成 构建依赖树 读取状态信息...完成 0 升级, 0 新安装,0 删除,529 未升级。
而且我不确定为什么没有安装。我咨询了这个消息来源,并且这两个消息来源都说警告中指出的文件夹中缺少一个文件。似乎缺少一个图标或.png
。但是我是.deb
从官方文档下载的。并且简单地
sudo …
Run Code Online (Sandbox Code Playgroud) 我正在使用 AISHub 构建一个船舶可视化器。我能够使用纬度/经度找到我想要的船只并将它们显示在地图上。但是船只(标记)太多了,我不知道谁是谁。
问题:如何在单击如下标记后动态显示弹出窗口?
下面是我使用的代码最重要的部分:
class BoatMap extends Component {
constructor(props) {
super(props);
this.state = {
buttonEnabled: true,
buttonClickedAt: null,
progress: 0,
ships: [],
type: 'All',
shipTypes: [],
activeShipTypes: [],
logoMap: {}
};
this.updateRequest = this.updateRequest.bind(this);
this.countDownInterval = null;
}
// ... other operations
// ... other operations
render() {
return (
<div className="google-map">
<GoogleMapReact
bootstrapURLKeys={{ key: 'My_KEY' }}
center={{
lat: this.props.activeShip ? this.props.activeShip.latitude : 42.4,
lng: this.props.activeShip ? this.props.activeShip.longitude : -71.1
}}
zoom={8}
>
{/* Rendering all the …
Run Code Online (Sandbox Code Playgroud) 我正在编写一个由以下内容组成的小实用程序:
1) 4QToolBar
2) 1QToolBox
3) 1QMenu
4) 1QGraphicsView
我在 上有一些按钮QToolBox
,每个按钮代表一个具有不同间距的网格。每次用户单击QToolBox the spacing on the
QGraphicsScene`上的按钮时都会发生变化。
我每天都使用新的表示法,并且在我不得不使用“抽象”实体(例如QAbstractButton
方法)之前从未遇到过任何问题。
我遇到的问题是我似乎没有正确设置以下连接信号/插槽QAbstractButton
:
主窗口.h
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void backgroundButtonClicked(QAbstractButton *button);
private:
void createToolBox();
QButtonGroup *buttonGroup;
QButtonGroup *backgroundButtonGroup;
Run Code Online (Sandbox Code Playgroud)
主窗口.cpp
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
createToolBox();
scene = new DiagramScene(itemMenu,this);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(toolBox);
view = new QGraphicsView(scene);
QWidget *widget …
Run Code Online (Sandbox Code Playgroud)