我试图在 Windows 操作系统上构建一个 docker 文件。但我得到了这个。
muhammad.iqbal@IQBAL MINGW64 /d/DockerTest
$ docker build .
Sending build context to Docker daemon 73.36 MB
Step 1/3 : FROM php:7.1.27-apache
Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: no such host
Run Code Online (Sandbox Code Playgroud)
我试图重新启动并重新启动 docker 应用程序,但没有任何变化。我读过这个和这个。但它在 LInux 操作系统上,但如何在 Windows 操作系统上做到这一点。
我正在使用 Microsoft Azures Vision API 来识别本地 JPEG 图像中的手写文本。我正在编辑 Microsoft 的源代码,以允许从本地源而不是从 URL 识别图像。但是,我不确定如何处理此错误:“TypeError:字节类型的对象不是 JSON 可序列化的”。
image_path = "/Users/FelixWallis/Downloads/IMG_2430.jpg"
image_data = open(image_path, "rb").read()
headers = {'Ocp-Apim-Subscription-Key': subscription_key}
params = {'mode': 'Handwritten'}
response = requests.post(
text_recognition_url, headers=headers, params=params, json=image_data)
response.raise_for_status()
operation_url = response.headers["Operation-Location"]
analysis = {}
poll = True
while (poll):
response_final = requests.get(
response.headers["Operation-Location"], headers=headers)
analysis = response_final.json()
time.sleep(1)
if ("recognitionResult" in analysis):
poll= False
if ("status" in analysis and analysis['status'] == 'Failed'):
poll= False
polygons=[]
if ("recognitionResult" in analysis):
# Extract …
Run Code Online (Sandbox Code Playgroud) 遍历具有一些数据和一些null
或not defined
值的javascript数组,它通过for循环提供了有趣的行为,而while循环则没有。当它应该停留在无限循环中时它不返回
我已经广泛地研究了输出,数组中是否存在数字的条件永远不会被评估为true
,只有ever false
,但是有时它会进入if语句区域,就像它是真的一样。这似乎是任意的。
//function called within this code
function randomArrayOfIndexes() {
var randNumbArray = new Array(4);
var indexToAssign = Math.floor(Math.random() * Math.floor(4));
randNumbArray[0] = indexToAssign;
for (i = 1; i < randNumbArray.length; i++) {
indexToAssign = Math.floor(Math.random() * Math.floor(4));
while (arrayContains(randNumbArray, indexToAssign)) {
indexToAssign = Math.floor(Math.random() * Math.floor(4));
}
randNumbArray[i] = indexToAssign;
}
return randNumbArray;
}
//this works
function arrayContains(arrayin, numberIn) {
var i = arrayin.length;
while (i--) { //takes one from …
Run Code Online (Sandbox Code Playgroud) 我想提供/dist
位于 Nest 项目外部文件夹中的静态 HTML 文件。index.html
已成功加载但无法加载任何 JS 文件(404
错误)。
我有一个 Node/Express.js 项目,它使用
app.use('/', express.static('../client/dist'))
Run Code Online (Sandbox Code Playgroud)
它工作得很好。
然而,在 Nest 项目中,
app.setBaseViewsDir(join(__dirname, '../../client/dist'))
Run Code Online (Sandbox Code Playgroud)
不做的伎俩。
在AppController
我试过
import { Response } from 'express';
@Get()
get(@Res() res: Response) {
res.sendFile('index.html', {
root: '../client/dist',
});
}
Run Code Online (Sandbox Code Playgroud)
但没有运气。
如前所述,index.html
已成功加载。所以问题不是走错路。问题也不是 src-paths 错误,index.html
因为在 Express 项目中使用了完全相同的文件。
/dist
|-index.html
|-main.js
|-etc.
Run Code Online (Sandbox Code Playgroud)
在 index.html 中:
<script type="text/javascript" src="main.js"></script>
Run Code Online (Sandbox Code Playgroud)
当我将 dist 文件夹放入 Nest 项目(并调整路径)时,它也不起作用。
我现在使用 express 模块:
import * as express from 'express'; …
Run Code Online (Sandbox Code Playgroud) 我想将我的预测结果与另一个人的预测结果进行比较。在文章中,作者表示“使用均方根的相对百分比(RMS%)来评估性能”。这就是我想与我的预测进行比较的内容。
目前我正在计算均方根误差,但是我不明白如何将其表示为百分比
这就是我使用 Python 计算均方根误差的方法
rmse = math.sqrt(mean_squared_error(y_test,y_predict)
Run Code Online (Sandbox Code Playgroud) 我正在学习在 python 中使用电子 js,我正在使用python-shell,所以我有以下简单的 python 脚本:
import sys, json
# simple JSON echo script
for line in sys.stdin:
print(json.dumps(json.loads(line)))
Run Code Online (Sandbox Code Playgroud)
在我的 main.js 中:
let {PythonShell} = require('python-shell')
let pyshell = new PythonShell('/home/bassel/electron_app/pyapp/name.py', {mode : 'json'});
pyshell.send({name:"mark"})
pyshell.on('message', function (message) {
// received a message sent from the Python script (a simple "print" statement)
console.log("hi");
});
Run Code Online (Sandbox Code Playgroud)
但是hi
没有打印出来,有什么问题?
我不习惯this
和尝试使一些简单的函数来回传递它。我不太确定javascript期望什么,但是我认为我做的不正确。
$(".search-result").each(function() {
var x = $(this).find('.past-positions ol').children()
console.log(x)
//this prints as expected
pastJobs(this)
// this does not
})
function pastJobs() {
var x = $(this).find('.past-positions ol').children()
console.log(x)
// this prints as undefined
}
Run Code Online (Sandbox Code Playgroud)
我认为它可以传递this
给函数,但是我认为我做的方法不正确。
我究竟做错了什么?
如果要关闭Sublime文本左侧装订线中的GIT集成(又称粘液绿线),只需将其切换为false:
26 "show_git_status": false
Run Code Online (Sandbox Code Playgroud)
但是,在首选项中进行设置时,出现错误:
尝试解析设置时出错:Packages \ User \ Preferences.sublime-settings:26:2中出现意外字符,预期逗号或右括号。
显然我是一个逗号或短括号,但是我不知道它应该在哪里或什么格式。谁能启发我?
tl; dr:如何将javax.activation.DataSource
依赖项添加到通过App Engine Maven插件运行的服务器上?
我正在使用App Engine Maven插件部署到本地App Engine服务器,并且正在尝试使用Blobstore API上载文件。我正在使用Java 11。
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.happycoding</groupId>
<artifactId>blobstore-test</artifactId>
<version>1</version>
<packaging>war</packaging>
<properties>
<!-- App Engine currently supports Java 8 -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-spec</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.59</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.71</version>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
index.jsp
<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head> …
Run Code Online (Sandbox Code Playgroud) java google-app-engine maven blobstore appengine-maven-plugin
我正在实现一项功能,用于显示财产的收入/费用,还提供了1个月,3个月,6个月和12个月的筛选器。
因此,我必须根据选择的过滤器显示“月”标签,例如,如果选择“ 3个月”过滤器,则需要显示“三月”,“二月”和“一月”,但当前未在XAxis上显示什么标签。
这是我的代码,请纠正任何问题:
private void setChart() {
ArrayList<BarEntry> incomeEntries = getIncomeEntries();
ArrayList<BarEntry> expenseEntries = getExpenseEntries();
BarDataSet set1, set2;
set1 = new BarDataSet(incomeEntries, "Income");
set1.setColor(Color.rgb(65, 168, 121));
set1.setValueTextColor(Color.rgb(55, 70, 73));
set1.setValueTextSize(10f);
set2 = new BarDataSet(expenseEntries, "Expense");
set2.setColors(Color.rgb(241, 107, 72));
set2.setValueTextColor(Color.rgb(55, 70, 73));
set2.setValueTextSize(10f);
ArrayList<IBarDataSet> dataSets = new ArrayList<>();
dataSets.add(set1);
dataSets.add(set2);
BarData data = new BarData(dataSets);
barChart.setData(data);
barChart.getDescription().setEnabled(false);
barChart.setDrawBarShadow(false);
barChart.setDrawValueAboveBar(true);
barChart.setMaxVisibleValueCount(10);
barChart.setPinchZoom(false);
barChart.setDrawGridBackground(false);
barChart.animateY(1400, Easing.EaseInOutQuad);
barChart.animateXY(3000, 3000);
Legend l = barChart.getLegend();
l.setWordWrapEnabled(true);
l.setTextSize(14);
l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.CENTER);
l.setOrientation(Legend.LegendOrientation.HORIZONTAL);
l.setDrawInside(false);
l.setForm(Legend.LegendForm.CIRCLE);
XAxis xAxis = …
Run Code Online (Sandbox Code Playgroud)