我正在尝试一个基本的ajax调用.所以我托管在测试服务器上以下测试PHP: http://voicebunny.comeze.com/index.php?numberOfWords=10 这个网页是我自己的测试已经整合到VoiceBunny API 的http:// voicebunny.com/developers.
现在我需要使用jQuery在其他网页上获取该网页打印的数据.正如您所看到的,网页echo是一些JSON.如何从其他网页获取此JSON?
这是我的代码:
$.ajax({
'url' : 'http://voicebunny.comeze.com/index.php',
'type' : 'GET',
'data' : {
'numberOfWords' : 10
},
'success' : function(data) {
alert('Data: '+data);
},
'error' : function(request,error)
{
alert("Request: "+JSON.stringify(request));
}
});
Run Code Online (Sandbox Code Playgroud)
我尝试了很多其他的变化,但我总是得到一个错误,而不是JSON.谢谢
我需要一些 python 代码来实现这个函数。我已经在 Ubuntu 中安装了 ffmpeg。
def convert_avi_to_mp4(avi_file.avi):
mp4_file = None
#some code to do the job
return mp4_file
Run Code Online (Sandbox Code Playgroud)
谢谢
您好我在Chrome和Opera上有一个有效的Polymer 1.0网页.现在我需要在Firefox和Safari中运行该页面.我有以下测试:
<!DOCTYPE html>
<html>
<head>
<?php use Cake\Routing\Router; ?>
<?php echo $this->Html->script('/bower_components/webcomponentsjs/webcomponents-lite.min.js'); ?>
<link rel="import" href="<?= Router::url('/'); ?>bower_components/polymer/polymer.html">
<dom-module id="test-element">
<template >
<h1>It works</h1>
</template>
<script>
Polymer({
is: "test-element"
});
</script>
</dom-module>
</head>
<body unresolved>
<test-element></test-element>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我试过改变
<?php echo $this->Html->script('/bower_components/webcomponentsjs/webcomponents-lite.min.js'); ?>
Run Code Online (Sandbox Code Playgroud)
至
<?php echo $this->Html->script('/bower_components/webcomponentsjs/webcomponents.js'); ?>
Run Code Online (Sandbox Code Playgroud)
要么
<?php echo $this->Html->script('/bower_components/webcomponentsjs/webcomponents.min.js'); ?>
Run Code Online (Sandbox Code Playgroud)
我认为webcomponents的Polyfill会处理html导入.但它不起作用.在Firefox中我收到以下错误:
ReferenceError: Polymer is not defined
Run Code Online (Sandbox Code Playgroud)
我无法用Safari测试它,但我期望得到类似的结果.
我做错了吗?我该怎么做才能做到这一点?
此外,我尝试删除webcomponents并运行bower更新再次安装它们.
谢谢
编辑:
我有两个文件.index.html的:
<!DOCTYPE html>
<html>
<head>
<?php use Cake\Routing\Router; ?>
<?php echo $this->Html->script('/bower_components/webcomponentsjs/webcomponents.js'); ?>
<link rel="import" …
Run Code Online (Sandbox Code Playgroud) 我有一些通过串行端口发送数据的nodejs代码。我的问题是我正在对arduino部分进行编码。由于我看不到arduino从串行读取的数据。
Node.js
serialport.write('3');
Run Code Online (Sandbox Code Playgroud)
Arduino的
char rcved = Serial.read();
Run Code Online (Sandbox Code Playgroud)
我需要看看我在rcved中得到了什么。但是当我尝试:
Serial.println(rcved);
Run Code Online (Sandbox Code Playgroud)
然后打开串行监视器,我得到串行端口正忙的错误。我知道Node.js正在使用它来发送数据。。但是我怎么才能看到我的arduino代码正在读取什么呢?
错误:
processing.app.SerialException: Error opening serial port 'COM4'.
at processing.app.Serial.<init>(Unknown Source)
at processing.app.Serial.<init>(Unknown Source)
at processing.app.SerialMonitor$3.<init>(SerialMonitor.java:94)
at processing.app.SerialMonitor.open(SerialMonitor.java:94)
at processing.app.Editor.handleSerial(Editor.java:2536)
at processing.app.EditorToolbar.mousePressed(EditorToolbar.java:357)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source) …
Run Code Online (Sandbox Code Playgroud) 我有一个非常简单的代码,我不明白为什么它不起作用.
所以,我的html中的一些地方我有一张桌子.而这在其中:
<tr>
<td class="tx-right" colspan="2"><strong>Price</strong></td>
<td class="td-speedy" id="speedy_price"></td>
<td class="td-casting" id="casting_price"></td>
<td class="td-search" id="snb_price"></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
现在这是我在ajax调用中的jQuery代码:
if(typeof r.casting === 'undefined'){
alert("a");
("#casting_price").html("<div class='alert'>Not available for this language and accent</div>");
alert("d");
}
else
{
alert("b");
$("#casting_price").text("$"+ r.casting+" USD");
}
alert("c");
Run Code Online (Sandbox Code Playgroud)
好吧,现在当r.casting有一个值,它工作正常并提醒:"b"和"c"但是当r.casting未定义时,没有打印任何内容,我得到了"a"警报,但没有别的!
这里发生了什么?
嗨,在下面的简单程序中发生了一些非常奇怪的事情.该程序采用2位数的ASCII数字,因为我只需要读取数字,"@"符号和"." 符号.并找出这个字节的ASCII符号是什么.
int main(int args, char* argv[])
{
unsigned int ch;
char aux[256];
strcpy(aux,argv[1]);
char a[0];
char buff[50];
char result[512];
int i=0;
while(i lessThan strlen(argv[1]))
{
a[0]=aux[i];
a[1]=aux[i+1];
a[2]='\0';
ch = atoi(a);
printf("el int:%d \n",ch);
sprintf(buff,"%c",ch);
printf("el char: %s \n", buff);
i=i+2;
}
}
Run Code Online (Sandbox Code Playgroud)
好的,这是有效的,并且在变量buff中以正确的方式打印所有ASCII符号.但是你可以看到我有一个char[]
从未使用过的被叫结果.所以我删除它.当我再次运行程序时,我得到了不同的结果:O.由于某种原因,该程序不会读取'.' 字符了:(为什么????请有人解释我,我很害怕哈哈!
我的结果与变量结果声明:
./try3 494650526450
el int:49
el char: 1
el int:46
el char: .
el int:50
el char: 2
el int:52
el char: 4
el int:64
el char: @
el int:50
el char: …
Run Code Online (Sandbox Code Playgroud) jquery ×2
arduino ×1
c ×1
c++ ×1
ffmpeg ×1
firefox ×1
html ×1
html-imports ×1
javascript ×1
node.js ×1
polyfills ×1
polymer ×1
python ×1
serial-port ×1