我在2个不同的服务器上有2个文件:
file1.php - 驻留在站点1 - 我传递一个参数,并且脚本echo-ed答案依赖于(是函数)传递的参数 - everithink在我通过浏览器访问文件时是可以的
http://site1.com/file1.php?parameterValue
Run Code Online (Sandbox Code Playgroud)
file2.php - 驻留在站点2上 - file2必须向file1.php发送一个参数并从中获取echo-ed输出作为变量.
我尝试用3种不同的方式做到这一点,但没有人工作.
方式1. -------
function get_data($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
$f="http://site1.com/file1.php?parameterValue";
$returned_content = get_data($f);
echo "=== $returned_content ===";exit;
Run Code Online (Sandbox Code Playgroud)
方式2. -------
$f="http://site1.com/file1.php?parameterValue";
$returned_content='';
$file = fopen ($f, "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
while (!feof ($file)) $returned_content.= fgets ($file, 1024);
fclose($file);
echo "=-= $returned_content =-=";exit;
Run Code Online (Sandbox Code Playgroud)
方式3. -------
$f="http://site1.com/file1.php?parameterValue";
$returned_content=implode('',file($f)); …Run Code Online (Sandbox Code Playgroud) 我需要从我的应用程序运行多个外部可执行文件的实例。此可执行文件的平均运行时间约为 3 分钟。我想重定向这些进程的输出,并更新我的 GUI 中的进度条。当然,我不想等到他们回来才能继续使用我的应用程序。
我想我应该为每个实例创建一个线程,并在线程完成时更新我的进度条。
这是正确的方法吗?
另外,您是否推荐了一个很好的资源/文档来了解它是如何工作的?我只找到了http://www.dotnetperls.com/threadpool。
编辑:这些进程是基于网络的,即:运行时间可能会因链接延迟/带宽而有很大差异。
关于进度条,我想在每次进程完成时更新它。有处理程序吗?稍后我将根据流程输出添加更详细的更新,以增加每个执行步骤完成的进度。
编辑2:
感谢您的投入。由于我可能需要运行很多进程(最多 20 个),而且我不想使带宽饱和,我将最多并行运行 5 个进程。每次进程完成时,我都会增加进度计数器(对于我的进度条),然后运行另一个进程,直到它们全部完成,使用:
Process p = new Process();
p.StartInfo.FileName = pathToApp;
p.EnableRaisingEvents = true;
p.Exited += OnCalibrationProcessExited;
p.Start();
private void OnCalibrationProcessExited(object sender, EventArgs e)
{
runAnotherOne function
}
Run Code Online (Sandbox Code Playgroud)
这是正确的还是有更优雅的方法来实现这一目标?当然,我不希望我的应用程序在执行过程中被阻止。为此使用后台工作人员会更好吗?
我一直在收到这两个错误,我似乎无法找到一个有效的解决方案.
LNK1120:1个未解析的外部
错误1错误LNK2019:未解析的外部符号"public:__thiscall Vector3D :: Vector3D(类Vector3D const&)"(?? 0Vector3D @@ QAE @ ABV0 @@ Z)在函数"public:class Vector3D __thiscall Vertex :: GetPosition"中引用(无效)"(?GetPosition @ Vertex @@ QAE?AVVector3D @@ XZ)
我认为它与我的Matrix运算符和我的Vector 3d类中的构造函数有关.任何帮助都会非常感激,因为我对C++很陌生
#ifndef MATRIX4_H
#define MATRIX4_H
#include "Vector3D.h"
class Matrix4
{
public:
Matrix4();
Matrix4(const Matrix4& rhs);
~Matrix4();
Vector3D Matrix4::operator *(Vector3D vector)
{
Vector3D newVector;
newVector.SetVector_X((m[0][0] * vector.GetVector_X()) + (m[0][1] * vector.GetVector_Y()) + (m[0][2] * vector.GetVector_Z()) + m[0][3]);
newVector.SetVector_Y((m[0][0] * vector.GetVector_X()) + (m[1][1] * vector.GetVector_Y()) + (m[1][2] * vector.GetVector_Z()) + m[1][3]);
newVector.SetVector_Z((m[0][0] * vector.GetVector_X()) + (m[2][1] …Run Code Online (Sandbox Code Playgroud) 当我创建一个JAR时,JAR将不会读取其中的文件夹,只有JAR所在的文件夹中的文件夹.好的,那不是很具描述性.所以这是我编辑支持的照片.
我希望你现在明白这个想法.那么我该如何解决这个问题呢?我已经在eclipse中拥有了res和stats构建路径的一部分,现在是什么?
我用来读取资源的代码:
Image player;
player = new ImageIcon("res/player.png").getImage();
我正在研究一个系统,我可以从多个位置更新一个小型数据库.我希望在我的家用计算机上托管数据库,并允许通过tcp/ip从其他两个位置连接到数据库.
到目前为止我做了以下事情:
我希望能够通过在其他PC上打开sql management studio并使用以下格式[ExternalIP]\SQLEXPRESS来连接到数据库但是到目前为止我还是无法这样做.我看过我的外部IP可能是什么,我得到两个不同的值:
86.XX.X.XXX 66.XXX.XX.XX
当所有内容都已正确配置时,我是否应该使用这种格式的这些值中的任何一个来连接其他sql管理工作室?有什么步骤我不知道了吗?
我有一个JS文件,它可以完美地工作,并执行其中的所有代码.
但我现在添加了以下JQuery:
$("#need2Know").click(function(){
window.location ="URLString";
return false;
});
$("#nice2Know").click(function(){
window.location ="URLString";
return false;
});
Run Code Online (Sandbox Code Playgroud)
当我在HTML文件中调用此部分代码时,onclick处理按预期执行.但是,只要我将其粘贴到JS文件中(在所有其他代码之上,其余代码仍然有效),onclick处理就不再起作用了.
我使用以下JQuery库:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
Run Code Online (Sandbox Code Playgroud)
我的JQ文件在此库之后调用.
对我来说很奇怪的是,代码在HTML中工作但在JS文件中没有,尽管代码的其余部分仍然像以前一样处理...
关于如何解决这个问题的任何建议,所以可以在JS中执行点击处理?
正如标题所说,我使用的是基本的 ProcessBuilder:
ProcessBuilder pb = new ProcessBuilder(new String[] {this.getExecutable(), "--version"});
pb.directory(pomDir);
pb.redirectOutput(appendTo(log));
Process p = pb.start();
p.waitFor();
Run Code Online (Sandbox Code Playgroud)
如果 getExecutable() 是路径上的 .exe(如 Python.exe)或 .cmd(如 npm.cmd),则此方法有效。
但是,如果它是 .bat(如 mvn.bat),则不是。
以下是相关的路径条目:
c:\Python27;
c:\Users\Matt\Tools\apache-maven-3.3.9\bin;
c:\Users\Matt\Tools\node;
Run Code Online (Sandbox Code Playgroud)
python --version 的输出:
Python 2.7.10
Run Code Online (Sandbox Code Playgroud)
mvn --version 的输出:
Exception in thread "main" java.lang.RuntimeException: Error running mvn init
at tech.project.trait.act(act.java:81)
at tech.project.admin.action.LastDependendantInvoker.invoke(LastDependendantInvoker.java:23)
at tech.project.admin.command.NewAppCommand.execute(NewAppCommand.java:71)
at tech.project.admin.command.init.InitCommand.execute(InitCommand.java:33)
at tech.project.admin.CLI.main(CLI.java:83)
Caused by: java.io.IOException: Cannot run program "mvn.bat" (in directory "c:\Users\Matt\Documents\Projects\foo"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source) …Run Code Online (Sandbox Code Playgroud) 我正在使用vue-svg-loader将外部 svg 作为 Vue 组件加载到我的 Vue 应用程序中:https : //www.npmjs.com/package/vue-svg-loader?activeTab=readme。我修改了加载程序配置以确保 ID 不会被删除:
{
test: /\.svg$/,
loader: 'vue-svg-loader', // `vue-svg` for webpack 1.x
options: {
// optional [svgo](https://github.com/svg/svgo) options
svgo: {
plugins: [
{removeDoctype: true},
{removeComments: true},
{cleanupIDs: false}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
我试图加载的 svg 看起来像这样:
<svg class="external-svg">
<g class="group-1">
<path id="a"></path>
<path id="b"></path>
<path id="c"></path>
</g>
<g class="group-2">
<path id="d"></path>
</g>
<g class="group-3">
<path id="e"></path>
<path id="f"></path>
<path id="g"></path>
</g>
<g class="group-4">
<path id="h"></path>
</g> …Run Code Online (Sandbox Code Playgroud) 我在尝试使用类型为 ExternalName 和入口控制器将流量重定向到外部服务时遇到问题。
我收到以下错误,我可以从主机访问该主机,但不能从 K8S 访问。此外,IP 10.96.0.10 与 kube-dns 服务相关联。
解析主机“internaldnsname.com”时出错:在 10.96.0.10:53 上查找 internaldnsname.com:没有这样的主机
我错过了什么?
入口规则
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: external-ingress
annotations:
kubernetes.io/ingress.class: “nginx”
nginx.ingress.kubernetes.io/ingress.class: “nginx”
nginx.ingress.kubernetes.io/preserve-host: “false”
spec:
rules:
- host:
http:
paths:
- backend:
serviceName: external-service
servicePort: 80
path: /
Run Code Online (Sandbox Code Playgroud)
服务定义
apiVersion: v1
kind: Service
metadata:
name: external-service
spec:
type: ExternalName
externalName: internaldnsname.com
Run Code Online (Sandbox Code Playgroud)