简短答案:
最快的解决方案是将VS代码终端从PowerShell切换到CMD。
在下拉下,选择CMD。
长答案:
只需在Powershell中设置路径即可。
打开PowerShell并将其作为管理员运行。
运行此代码:(复制,粘贴从这里)
“
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Program Files\Python35-32")“
注意:在这里,在路径中,添加您在系统中安装Python的路径,在我的情况下,它是“ C:\ Program Files \ Python35-32”。
它必须解决了错误。
要确认,请运行此代码:
“python --version”
通常,这些是只有一张记录(一种类型的保险)的成员:
SELECT
member,
COUNT(member) as total
FROM Table
GROUP BY member
HAVING COUNT(member) = 1;
这里的想法是,如果成员有一种保险,您会看到一张记录,因此计数为(1),但是如果成员有两种类型的保险,它们有两个记录,因此该成员的计数为(2),依此类推。
接下来,要更详细地看到它们,因为您现在知道您感兴趣的成员,只需使用该结果集再次加入原始表:
SELECT A.*
FROM Table A
INNER JOIN
(
SELECT
member,
COUNT(member) as total
FROM Table
GROUP BY member
HAVING COUNT(member) = 1
) B
ON A.member = B.member;
因此,现在您可以看到这些成员的详细信息(保险类型)。
现在,您说:“ B专栏具有显然包含重复项的保险类型。” ...这还不清楚,但是如果您的意思是这一点,那么您将不得不删除重复项,因此,与上面相同但使用更多数据清洁。例如,如果您的数据具有一个针对DTH类型的一行和TPD类型的两行的成员,则需要这是需要的,因此我们希望对(2)的该成员进行计数,而不是(3)!
SELECT
X.member,
COUNT(X.member) as total
FROM (SELECT DISTINCT member, type FROM Table) X
GROUP BY X.member
HAVING COUNT(X.member) = 1;
对于同一版本的完整版本:
SELECT DISTINCT A.*
FROM Table A
INNER JOIN
(
SELECT
X.member,
COUNT(X.member) as total
FROM (SELECT DISTINCT member, type from Table) X
GROUP BY X.Member
HAVING COUNT(X.member) = 1
) B
ON A.member = B.member
您可以尝试以下方法将.docx文件转换为.pdf文件。
https://simples.dev/simples.dev/java-convert -docx-file-to-pdf-file-using-xdocReport/
import fr.opensagres.poi.xwpf.converter.pdf.PdfConverter;
import fr.opensagres.poi.xwpf.converter.pdf.PdfOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
public class FileConverter {
public void convertWordToPdf(String docxFileName, String pdfFileName) {
try(InputStream inputStream = new FileInputStream(docxFileName);
OutputStream outputStream = new FileOutputStream(pdfFileName)) {
XWPFDocument document = new XWPFDocument(inputStream);
PdfOptions options = PdfOptions.create();
// Convert .docx file to .pdf file
PdfConverter.getInstance().convert(document, outputStream, options);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
String docxFileName = "D:\\SimpleSolution\\Data\\Document.docx";
String pdfFileName = "D:\\SimpleSolution\\Data\\Document.pdf";
FileConverter fileConverter = new FileConverter();
fileConverter.convertWordToPdf(docxFileName, pdfFileName);
您是否考虑过使用垂直线和水平线创建新图像,比原始图像略高略高,更宽,您粘贴了原始图像?
这样,您将有一个虚线的边框,并且适用于各种尺寸。
这可以如下所述完成:
from PIL import Image,ImageDraw
#this is your own image
yourimage = Image.open('/home/vancha/Documenten/python/pillu/square.png', 'r')
img_w, img_h = yourimage.size
border_width = 5
#this is the new image which holds the stripes
borderimage = Image.new('RGBA', (2000+(border_width * 2), 2000+(border_width *2)), (255, 255, 255, 255))
# Draw the lines
draw = ImageDraw.Draw(borderimage)
#starts drawing vertical lines form the very top
start = 0
end = borderimage.height#width or height, doens't matter since the image is square
step_size = border_width*4
#starts from border_width * 2, so that the very top and very left aren't made black with lines
for x in range(border_width*2, borderimage.width, step_size):
vertical_line = ((x, start), (x, end))
#the width is the thickness of the "dots" in the border
draw.line(vertical_line, fill=(0,0,0),width=border_width * 2)
horizontal_line = ((start,x), (end, x))
draw.line(horizontal_line, fill=(0,0,0),width=border_width *2)
#for good practice:
del draw
bg_w, bg_h = borderimage.size
#calculate the offset so that the image is centered
offset = ((bg_w - img_w) // 2, (bg_h - img_h) // 2)
#paste your old image over the one with the dots
borderimage.paste(yourimage, offset)
#save it wherever you want :)
borderimage.save('./border.png')
“>在您的情况下, 如果您将自己的图像粘贴在中心,则在2010年将是2010年的新图像,使您在两边都有5px。
假设您正在使用Tokio,请致电Tokio :: Spawn并不一定保证任务将在单独的线程上执行(尽管可能是)。
这里的问题是std :: thread :: sleep()完全阻止了任务正在运行的线程,这意味着您的ping会异步运行(不是阻止其他任务),但是当您继续进入当前的睡眠时,线程将执行接下来的4秒。
您可以使用非阻止版本的睡眠版本,例如Tokio https://docs.rs/tokio/latest/tokio/time/time/ftime/fn.sleep.html
因此,您的代码看起来像是
pub fn sending_ping(addr: Addr<MicroscopeClient>) -> Result<(), ()> {
info!("Pings started");
spawn(async move {
loop {
info!("Ping");
match addr.send(Ping {}).await {
Ok(_) => {
info!("Ping sended")
}
Err(e) => {
warn!("Ping error");
return;
}
}
tokio::time::sleep(Duration::from_millis(4000)).await;
}
});
return Ok(());
}
您确实想确保任务在另一个线程上散发出来您必须使用 std :: thread :: Spret :: Spawn 但是,您将不得不设置另一个异步运行时。相反,您可以使用 spawn_blocking 至少保证任务的保证是在期望阻止任务的线程上运行
检查您的Discord版本。如果它小于2.0.0,则可能需要导入旧的Discord-Py-slash-commands。这些是对我有用的版本:
discord==1.7.3
discord-py-slash-command==2.0.0
discord.py==1.7.3
Vnode对象不能像modrender
这样的组件中呈现在组件模板中。如果它们被用作通用方式来交换应用程序中的模板数据,那是一个问题。 Vnodes仍然可以直接用于组件渲染函数和功能组件,具有JSX或H
喜欢&lt; layout&gt; {rendermodule(state)}&lt;/layout;/layout&gt;
,这限制他们的用法。
AbstractModule
如果会导致不必要的代码,则可能需要重新考虑约定。从某个时候,需要与动态&gt;
一起使用“视图”的事实,并且它将尽可能简单地使用。
可能没有必要进行“模块”抽象,但是即使存在,module.view
也可以返回组件(功能或状态)而不是vnodes。或者它可以构建一个组件并使其作为属性可用,例如:
class MyModule {
constructor(state) {
this.viewComponent = (props) => h(ModuleView, { state, ...props })
}
}
父项目已经可用,只需重命名对其的引用即可防止两个“项目”,一个是父,一个是孩子,请参考正确的内容。
<v-data-table
:headers="headers"
:items="financialDocuments"
:single-expand="singleExpand"
item-key="finDocId"
show-expand
>
<template v-slot:expanded-item="{ item: finDoc }">
<td :colspan="attachmentHeaders.length">
<v-data-table
:headers="attachmentHeaders"
:items="finDoc.attachmentPlainDtos"
>
<template v-slot:[`item.attachmentActions`]="{ item }">
<v-icon large @click="removeAttachment(finDoc.Id, item.attachmentId)">
mdi-delete
</v-icon>
</template>
</v-data-table>
</td>
</template>
</v-data-table>
*NGFOR指令用于迭代值数组。 您使用 *ngfor来迭代单个原始值,这就是为什么您要获得此错误type'number'无法分配给'
在您的代码中, 单个值,您可以将NGIF与异步管一起使用
<div *ngIf="data$ | async as d">{{ d }}</div>
有些事情是正确的:
- 您从不称呼MyBody()
- MyBody是一个函数,而var
- rgb则是未定义的
<meta charset="utf-8" />
<html>
<head>
<title>Cuadro cambia color // By Abraham Gonzalez</title>
</head>
<body id="myBody">
<canvas id="canvas" width="400" height="400"></canvas>
</body>
<script>
function myBody() {
var myBodyt = document.getElementById('myBody');
myBodyt.addEventListener('click', btnRojoClic);
}
function btnRojoClic() {
console.log('clickkeked');
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = "#"+Math.floor(Math.random()*16777215).toString(16);
}
myBody();
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var posicion = 0;
var tamano = 0;
setInterval(function () {
ctx.clearRect(0, 0, 400, 400);
ctx.fillRect(posicion, 0, tamano, tamano);
posicion++;
tamano++;
if (posicion > 400) {
posicion = 0;
tamano = 0;
}
}, 30);
</script>
</html>
编辑仅在单击正方形时更改颜色。您不能直接在矩形(FillRect)上添加事件侦听器,但是可以在画布上进行操作。单击时,请检查事件位置(x,y)是否在广场上(checkCollision())。如果是这样,请更改颜色。
注意:不需要Square(),可以用class + square()内部的函数(特别是渲染)代替,负责用给定上下文绘制rect。
<!DOCTYPE html>
<meta charset="utf-8" />
<html>
<head>
<title>Cuadro cambia color // By Abraham Gonzalez</title>
</head>
<body id="myBody">
<canvas id="canvas" width="400" height="400"></canvas>
</body>
<script>
function btnRojoClic() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.fillStyle = '#' + Math.floor(Math.random() * 16777215).toString(16);
}
// you cann also use a class instead, the main idea is to check if the click event position was on the square surface.
function square() {
let position = 0;
let tamano = 0;
const increasePosition = () => {
position;
};
const increaseSize = () => {
tamano++;
};
const getPosition = () => {
return position;
};
const getTamano = () => {
return tamano;
};
const reset = () => {
position = 0;
tamno = 0;
};
const move = () => {
increasePosition();
increaseSize();
if (position > 400) {
reset();
}
};
const render = (context) => {
ctx.fillRect(position, 0, tamano, tamano);
};
return {
move,
render,
getPosition,
getTamano,
reset
};
}
/**
* Get cursor position relativly to canvas
*/
const getCursorPosition = (canvas, event) => {
const rect = canvas.getBoundingClientRect();
const x = event.clientX - rect.left;
const y = event.clientY - rect.top;
return { x, y };
};
/**
* Check if there is a collision (click position overlap square position)
* */
const checkCollision = (canvas, ev, square) => {
const { x, y } = getCursorPosition(canvas, ev);
if (
x >= square.getPosition() &&
x <= square.getPosition() + square.getTamano() &&
y >= square.getPosition() &&
y <= square.getPosition() + square.getTamano()
) {
canvas.getContext('2d').fillStyle =
'#' + Math.floor(Math.random() * 16777215).toString(16);
}
};
mySquare = square();
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
canvas.addEventListener('click', (ev) =>
checkCollision(canvas, ev, mySquare)
);
setInterval(function () {
ctx.clearRect(0, 0, 400, 400);
mySquare.move();
mySquare.render();
}, 30);
</script>
</html>
以下说明取自此页面 :
getElementsByClassName()方法返回文档中所有元素的集合,带有指定的类名称,作为Nodelist对象。
Nodelist对象表示节点的集合。节点可以是
通过索引号访问。索引从0。开始
提示:您可以使用Nodelist对象的长度属性来确定具有指定类名称的元素数量,然后您可以循环浏览所有元素并提取所需的信息。
因此,作为参数getElementsByClassName
将接受类名称。
如果这是您的html主体:
<div id="first" class="menuItem"></div>
<div id="second" class="menuItem"></div>
<div id="third" class="menuItem"></div>
<div id="footer"></div>
然后var menuitems = document.getElementsByClassName('menuitem')
将返回3上&lt; div&gt; div&gt;
的集合(而不是数组) S,因为它们匹配给定的班级名称。
然后,您可以在这种情况下迭代此节点(&lt; div&gt;
在这种情况下)收集:
for (var menuItemIndex = 0 ; menuItemIndex < menuItems.length ; menuItemIndex ++) {
var currentMenuItem = menuItems[menuItemIndex];
// do stuff with currentMenuItem as a node.
}
请参阅此帖子有关元素和节点之间的差异的更多信息。
不,将路由器嵌套在另一个路由器中是一种不变的违规行为。我认为您的情况不是无效的嵌套情况,而是与 有关,其中 sweetalert
正在渲染react jsx。从我回想起sweetAlert
它的内容中,它会在ReactTree之外进行内容。
您当然可以渲染多个路由器,只要它们没有嵌套,但是问题是您已经单独处理路由/导航的单独路由上下文,并且在一个路由上下文中进行导航不会更新其他路由。
我怀疑您可以使用单个自定义历史
参考并将其传递给所需的路由器,因此它们都在内部引用相同的历史记录上下文。
React-Router-dom@6
导出a 为此目的,历史记录
。
示例:
import { createBrowserHistory } from "history";
const history = createBrowserHistory({ window });
export default history;
...
import * as React from "react";
import * as ReactDOM from "react-dom";
import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom";
import history from "../path/to/history";
ReactDOM.render(
<HistoryRouter history={history}>
{/* The rest of your app goes here */}
</HistoryRouter>,
root
);
...
import { unstable_HistoryRouter as HistoryRouter } from "react-router-dom";
import history from "../path/to/history";
MySwal.fire({
html: (
<HistoryRouter history={history}>
...
</HistoryRouter>
),
})
注意unstable_historyRouter
:
当前,此API以
不稳定_
前缀为前缀,因为您可以
无意间将两个版本的历史记录
库添加到您的应用中,
您已添加到包装中的一个。
路由器内部使用。如果您的工具允许它,那是
建议不要将历史记录作为直接依赖性,而是依靠
在React-Router软件包的嵌套依赖性上。一旦我们有一个
检测错误匹配版本的机制,此API将删除其不稳定的_
前缀。
尝试添加此内容,我不确定它是否适用于该页面,但是当我使用WebView时,我总是可以确保所有
webSettings.setLoadsImagesAutomatically(true);
webSettings.setDatabaseEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(true);
}
您可以尝试 pinput ,或检查他们的实现并尝试制作自己的实现。
you can try pinput, or check their implementation and try to make your own one.
发送多个控制器作为一个控制器