我正在尝试使用HTML并在页面上绘制一条线.
从我读过的所有内容建议HTML5 canvas标签是最好用的,但是我需要连接到页面上不在canvas标签中的东西的行,所以画布对我不好(想要/需要使用原生JS) .
我写了(从我发现的东西)一个功能,它做我需要的但问题是一旦出现线,页面的其他一切都消失了.
我发现每次我改变JavaScript的风格,但形状都会消失.
删除"document.write"结束时没有任何消失.
function draw(ax, ay, bx, by) {
var n, widthLine, i, x, y;
widthLine = 1;
if (Math.abs(ax - bx) > Math.abs(ay - by)) {
if (ax > bx) {
n = ax;
ax = bx;
bx = n;
n = ay;
ay = by;
by = n;
}
n = (by - ay) / (bx - ax);
for (i = ax; i <= bx; i++) {
x = i;
y = Math.round(ay + …Run Code Online (Sandbox Code Playgroud) 我有 Jetson TX2、python 2.7、Tensorflow 1.5、CUDA 9.0
Tensorflow 似乎工作正常,但每次运行该程序时,我都会收到此警告:
with tf.Session() as sess:
print (sess.run(y,feed_dict))
Run Code Online (Sandbox Code Playgroud)
...
2018-08-07 18:07:53.200320: E tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:881] could not open file to read NUMA node: /sys/bus/pci/devices/0000:00:00.0/numa_node Your kernel may have been built without NUMA support.
2018-08-07 18:07:53.200427: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1105] Found device 0 with properties:
name: NVIDIA Tegra X2
major: 6
minor: 2
memoryClockRate(GHz): 1.3005
pciBusID: 0000:00:00.0
totalMemory: 7.66GiB
freeMemory: 1.79GiB
2018-08-07 18:07:53.200474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1195] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: NVIDIA Tegra X2, pci bus id: …Run Code Online (Sandbox Code Playgroud) 首先我收到警告和致命错误。警告:
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Run Code Online (Sandbox Code Playgroud)
然后我用break替换了继续,警告就消失了。但即使更换后,致命错误仍然发生。致命错误:
PHP Fatal error: Uncaught Error: Call to undefined function each() in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(242): PHPUnit_Util_Getopt::getopt(Array, 'd:c:hv', Array)
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(138): PHPUnit_TextUI_Command->handleArguments(Array)
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 D:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main()
#4 {main}
thrown in D:\xampp\php\pear\PHPUnit\Util\Getopt.php on line 80
Fatal error: Uncaught Error: Call to undefined function each() in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(242): PHPUnit_Util_Getopt::getopt(Array, 'd:c:hv', Array)
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(138): PHPUnit_TextUI_Command->handleArguments(Array)
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用张量流的 keras 的顺序模型。当我执行以下语句时:
model.fit(x_train, y_train, epochs=20, verbose=True, validation_data=(x_dev, y_dev), batch_size=10)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
W tensorflow/core/platform/profile_utils/cpu_utils.cc:126] Failed to get CPU frequency: 0 Hz
F tensorflow/core/grappler/costs/op_level_cost_estimator.cc:710] Check failed: 0 < gflops (0 vs. 0)type: "CPU"
Run Code Online (Sandbox Code Playgroud)
我不明白如何解决它。谁能帮帮我吗。
从github上的这个问题,我了解到device.frequency()返回0可能是因为NominalCPUFrequency()返回1。但是,这个信息对我来说似乎太抽象了,我无法理解。
// Auto post ( Unique File Date ).
$postData = array(
'post_category' => array( $Category ),
'post_status' => $Post_Status,
'post_type' => $Post_Type
);
$post_id = wp_insert_post( $postData );
$getImageFile = 'http://localhost/Multisite/test2/wp-content/uploads/sites/4/Auto Post/twitter.png';
$attach_id = wp_insert_attachment( $postData, $getImageFile, $post_id );
require_once( ABSPATH . 'wp-admin/includes/image.php' );
$attach_data = wp_generate_attachment_metadata( $attach_id, $getImageFile );
wp_update_attachment_metadata( $attach_id, $attach_data );
set_post_thumbnail( $post_id, $attach_id );
Run Code Online (Sandbox Code Playgroud)
上面的代码成功发布了帖子,但没有设置帖子特色图像。我不知道我在这里做错了什么。
我在用着jquery-ui。两周后我无法解决这个问题。
我不知道为什么点击滑块后出现此错误:
\n火狐控制台:
\nTypeError: o.element is undefined[Learn More] jquery-ui.min.js:6:6058\nRun Code Online (Sandbox Code Playgroud)\n控制台镀铬:
\njquery-ui.min.js:6 Uncaught TypeError: Cannot read property \'toggleClass\' of undefined\n at t.(anonymous function).(anonymous function)._toggleClass (http://localhost:8000/assets/frontend/_js/jquery-ui.min.js:6:6067)\n at t.(anonymous function).(anonymous function)._addClass (http://localhost:8000/assets/frontend/_js/jquery-ui.min.js:6:5877)\n at t.(anonymous function).(anonymous function)._mouseCapture (http://localhost:8000/assets/frontend/_js/jquery-ui.min.js:6:14171)\n at t.(anonymous function).(anonymous function)._mouseCapture (http://localhost:8000/assets/frontend/_js/jquery-ui.min.js:6:1111)\n at t.(anonymous function).(anonymous function)._mouseDown (http://localhost:8000/assets/frontend/_js/jquery-ui.min.js:6:9414)\n at t.(anonymous function).(anonymous function)._mouseDown (http://localhost:8000/assets/frontend/_js/jquery-ui.min.js:6:1111)\n at HTMLDivElement.<anonymous> (http://localhost:8000/assets/frontend/_js/jquery-ui.min.js:6:8701)\n at HTMLDivElement.dispatch (http://localhost:8000/assets/frontend/_js/jquery-3.1.1.min.js:3:10315)\n at HTMLDivElement.q.handle (http://localhost:8000/assets/frontend/_js/jquery-3.1.1.min.js:3:8342)\nRun Code Online (Sandbox Code Playgroud)\n<script type="text/javascript" src="http://localhost:8000/assets/frontend/_js/jquery-3.1.1.min.js"></script>\n<!-- http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js -->\n<script type="text/javascript" src="http://localhost:8000/assets/frontend/_js/bootstrap.min.js"></script>\n<!-- https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js -->\n<script type="text/javascript" src="http://localhost:8000/assets/frontend/_js/jasny-bootstrap.min.js"></script>\n<script type="text/javascript" src="http://localhost:8000/assets/frontend/_js/bootstrap-select.min.js"></script>\n<script …Run Code Online (Sandbox Code Playgroud) 如何检查 WordPress 中的插件是否处于活动状态。我已经安装了 easy-digital-downloads(edd)。在目录:/wp-content/plugins/easy-digital-downloads插件文件位于/wp-content/plugins/easy-digital-downloads/easy-digital-downloads.php. 我尝试了这个,我知道该插件已激活。:
if (is_plugin_active(get_home_url() . '/wp-content/plugins/easy-digital-downloads/easy-digital-downloads.php')) {
echo 'plugin is active';
} else {
echo 'plugin is not active';
}
Run Code Online (Sandbox Code Playgroud)
上面的代码回显“插件未激活”,但插件已激活。
我认为问题是我的插件地址的目录。
如何使用Three.js中的新THREE.TextureLoader加载多个纹理?
目前我正在加载我的纹理:
var texture1 = THREE.ImageUtils.loadTexture('texture1.jpg');
var texture2 = THREE.ImageUtils.loadTexture('texture2.jpg');
var texture3 = THREE.ImageUtils.loadTexture('texture3.jpg');
var texture4 = THREE.ImageUtils.loadTexture('texture4.jpg');
var texture5 = THREE.ImageUtils.loadTexture('texture5.jpg');
...
Run Code Online (Sandbox Code Playgroud)
Google Chrome的开发者工具会发出以下警告:
THREE.ImageUtils.loadTexture已被弃用.请改用THREE.TextureLoader().
我尝试使用新的THREE.TextureLoader:
var loader = new THREE.TextureLoader();
loader.load('texture1.jpg',function ( texture1 ) {});
loader.load('texture2.jpg',function ( texture2 ) {});
loader.load('texture3.jpg',function ( texture3 ) {});
loader.load('texture4.jpg',function ( texture4 ) {});
loader.load('texture5.jpg',function ( texture5 ) {});
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我希望我TextureLoader使用标题授权来加载纹理:
let loader = new THREE.TextureLoader();
loader.headers = { . . . }; // I want this!
let myTex = loader.load('my_authorized_url');
Run Code Online (Sandbox Code Playgroud)
我想将自定义标头传递到通过网络发送的请求中。我看到了这个Loader#setWithCredentials()函数,但我不知道它是如何使用的(或者这是否是我应该使用的)。我应该考虑编写自己的加载程序吗?
编辑:在我看来,ImageLoader源代码中没有可以设置标头的地方。
我想加载cube.obj引用多个cube_*.mtl文件的文件,后者又使用纹理图像*.png(所有资源).加载多个mtl而不是一个mtl的原因是能够动态加载具有相同几何但不同材质的对象.
我找不到这样的例子所以我试图通过加载所有mtl,创建和加载obj 来混合MultiMaterial中的示例(不再受threejs支持)文档和webgl_loader_obj_mtlMultiMaterial:
var resources = 'cube/';
var materialsToLoad = [
'cube_red.mtl',
'cube_green.mtl',
'cube_blue.mtl'
];
var loadedMaterials = [];
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setPath(resources);
for (var i = 0; i < materialsToLoad.length; i++) {
mtlLoader.load(materialsToLoad[i], function(materials) {
materials.preload();
loadedMaterials.push(materials);
});
}
var multi = new THREE.MultiMaterial(loadedMaterials);
var objLoader = new THREE.OBJLoader();
objLoader.setPath(resources);
objLoader.setMaterials(multi); // #1
objLoader.load('cube.obj', function (object) {
scene.add(object);
});
Run Code Online (Sandbox Code Playgroud)
但这不起作用,抛出异常:
Uncaught TypeError: …Run Code Online (Sandbox Code Playgroud)