我想在滚动时播放或暂停视频,如果滚动大于300,则应暂停,否则应播放。这是我的视频标签
<video width="100%" controls >
<source src="video.mp4" type="video/mp4" >
</video>
Run Code Online (Sandbox Code Playgroud)
还有 Jquery
$(document).ready(function(){
var scroll = $(window).scrollTop();
if(scroll > 300){
$('video').attr('autoplay':'false')
}
else{
$('video').attr('autoplay':'true')
}
})
Run Code Online (Sandbox Code Playgroud)
现在我不直接使用自动播放属性。请帮助我如何解决这个问题?
编辑 :
i updated my code to this
$(document).ready(function(){
$(window).scroll(function(){
var scroll = $(window).scrollTop();
if(scroll > 300){
$('#videoId').get(0).pause() ;
}
else{
$('#videoId').get(0).play();
}
})
})
Run Code Online (Sandbox Code Playgroud)
仍然不起作用
glib a提供g_atomic_int_get
原子读取标准C int
类型的函数.是不是将32位整数从存储器读入寄存器还不能保证是处理器的原子操作(例如mov <reg32>, <mem>
)?
如果是,那么glib g_atomic_int_get
功能的目的是什么?
我下载并安装了 Visual Studio 和 Anaconda,以访问 Anaconda 预安装的所有软件包。我试图弄清楚如何运行代码,使其在交互式 shell 中运行。现在,当我按 F5 时,Anaconda 3 cmd 行窗口会出现提示“按任意键继续...”。我的问题是:我怎样才能做到当我按下 F5 时,我的代码在交互式 Python shell 中执行,就像它在 Python 附带的基本 IDLE 上执行的一样。
这似乎是一个简单的 Google 搜索可以解决的问题,但由于某种原因我找不到答案。我做了一些谷歌搜索,并观看了有关它的 Visual Studio python 官方 Microsoft 系列。其中一个视频涉及使用交互式 shell,但即使在视频中,当他单击“开始(运行)”按钮时,代码也在命令行中运行。
我过去使用过 IDLE,现在我认为是时候换一个更大的 IDE 了。我喜欢 Visual Studio 的代码完成和模板,我迫不及待地想解决这个(菜鸟)问题。
谢谢
我尝试从 AngularJS 应用程序请求 Google Timezone API。
\n\n但是当我提出请求时,我在预检请求中收到此错误:
\n\nXMLHttpRequest cannot load https://maps.googleapis.com/maps/api/timezone/json?location=48.8709,2.3561×tamp=14912286400&key=MY_KEY. Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.\n
Run Code Online (Sandbox Code Playgroud)\n\n\n\n我尝试通过设置标头来禁用预检请求Content-Type: \'text/plain\'
,但始终存在预检请求。
您认为上述错误是由预检请求引起的还是您认为我应该看看另一个方向?
\n\n提前致谢
\n\n编辑:我知道如何在我的服务器上启用 CORS,这不是重点。我想要的是从我的 AngularJS 应用程序访问 Google API,而不在我的服务器上创建 \xc3\xa0 WS(如果可能的话)。如果我别无选择,我就会这么做,但在这种情况下,我知道该怎么做。
\n\n回答:感谢@Sebas,我解决了window.fetch()
API 的问题。这在 IE 上不起作用,但这里有一个很棒的 polyfill: https: //github.com/github/fetch。\n我不知道这是否是解决我的问题的最佳选择,但它确实有效。
我对肠杆菌基因组中的 4 个管家基因感兴趣。
所以我有我的管家基因,我在 NR 上大放异彩并下载了比对的序列。
我使用 MEGA7 软件和最大似然法制作了系统发育树。Boostrap 方法进行了 200 次迭代。
我将树导出为 newick 文件。
所以现在,我的 4 个管家基因有 4 棵树。我想用我的 4 棵树创建一个共识树。
就我个人而言,我尝试使用 Bio.Phylo 的共识树(http://biopython.org/DIST/docs/api/Bio.Phylo.Consensus-module.html#strict_consensus)(http://biopython.org/wiki/Phylo)。我选择了 Majority_consensus 函数,它运行得很好。但我有一个问题。
我的“脚本”是这样的:
import os
import sys
from Bio import Phylo
from Bio.Phylo.Consensus import *
fichier=sys.argv[1]
fichier2=sys.argv[2]
fichier3=sys.argv[3]
fichier4=sys.argv[4]
tree1=Phylo.read(fichier, 'newick')
tree2=Phylo.read(fichier2, 'newick')
tree3=Phylo.read(fichier3, 'newick')
tree4=Phylo.read(fichier4, 'newick')
trees=tree1,tree2,tree3,tree4
majority_tree = majority_consensus(trees, 0.5)
Phylo.draw(majority_tree)
Run Code Online (Sandbox Code Playgroud)
问题在于共识树依赖于顺序。例如,当我try trees = tree1,tree2,tree3,tree4
和trees = tree2,tree4,tree1,tree3
有人知道另一种软件可以从 newick 文件中制作共识树吗?
我需要帮助Bio.Phylo
。如果有人了解更多有关此包的信息,那就太好了。
我有一个 URL,它成为具有该http_build_query
函数的查询字符串。
但是我有一个timestamp
无法编辑的参数。并×
成为乘号x
。
有解决方法吗?
这是我传递给http_build_query
函数的数组。
$parameters = array(
"transaction_id"=>uniqid("FF-"),
"timestamp"=> time(),
"order_total"=>$_SESSION['total_price'],
"order_total_with_vat"=>$_SESSION['total_price'] * 1.21,
"order_vat"=>"21",
"payment_method"=>"ideal",
"payment_status"=>"1",
"customer_name"=>$_SESSION['customer_data']['naam'],
"customer_address"=>$_SESSION['customer_data']['address'],
"customer_city"=>$_SESSION['customer_data']['city'],
"customer_zipcode"=>$_SESSION['customer_data']['zipcode'],
"customer_country"=>$_SESSION['customer_data']['country'],
"customer_email"=>$_SESSION['customer_data']['email'],
"customer_telephone"=>$_SESSION['customer_data']['telephone'],
);
Run Code Online (Sandbox Code Playgroud)
网址输出:
http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9×tamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5
Run Code Online (Sandbox Code Playgroud)
首选输出:
http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9×tamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5
Run Code Online (Sandbox Code Playgroud)
http_build_query
功能:
case 'POST':
curl_setopt( $curlHandler, CURLOPT_POST, true );
$url .= '?' . http_build_query( $parameters );
break;
Run Code Online (Sandbox Code Playgroud) 空值和所有列均为空的行类型之间是否有区别?Postgres查询似乎能够分辨出差异(显示空列而不是空白),我想知道是否有什么我应该注意的。例如
CREATE TYPE node AS (
rank integer
, id integer
);
CREATE TABLE hierarchy (
node node
);
INSERT INTO hierarchy (node) VALUES (null);
INSERT INTO hierarchy (node) VALUES ((null, null));
SELECT *, node IS NULL AS check_null FROM hierarchy;
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)node | check_null ------+------------ | t (,) | t
postgresql null distinct row-value-expression postgresql-9.6
我正在开发一个 Django 项目,并尝试为我的数据创建一些链接模型,我认为这些模型正在工作,但我似乎无法弄清楚如何访问链接数据。
class One(models.Model)
name = models.CharField(max_length=50)
list = models.ArrayField(models.CharField(max_length=50), blank=True)
def __str__(self):
return self.name
class Many(models.Model)
name = models.CharField(max_length=50)
related = models.ForeignKey(One, null=True, blank=True)
def __str__(self):
return self.name
Run Code Online (Sandbox Code Playgroud)
这是我建立的一般关系。
我想做的是,在模板中可以访问所有“Ones”的列表,并且通过每个“Ones”,可以访问每个“Many”及其相关属性。我可以看到如何访问单个“一个”的属性,但不知道如何传递所有这些属性及其相关的“许多”模型以及每个模型的相关属性。本质上,我想要的输出会有一个包含 One 的下拉列表,当提交此列表时,一些 Javascript 将使用“Many”模型中的列表来执行一些操作。
任何建议将不胜感激。
我已经创建了我的第一个bot应用程序,但它在Bot框架模拟器中运行时出错.它显示我发送的消息的状态,如"无法发送".请建议我可能是什么原因.
我需要在Watson Conversation对话框模型中创建一个条件,如下所示:
如果"今天的日期"<04-15-2017做某事.否则做别的事.
我不想向用户询问当前日期并保存.
我尝试了很多方法但是它们不起作用,我也尝试输出日期(不起作用):
{
"context": {
"currdate": "@sys-date:today"
},
"output": {
"text": {
"values": [
"here it is $currdate"
],
"selection_policy": "sequential"
}
}
}
Run Code Online (Sandbox Code Playgroud) python ×3
javascript ×2
angularjs ×1
biopython ×1
botframework ×1
c ×1
cors ×1
distinct ×1
django ×1
glib ×1
html ×1
ibm-cloud ×1
ibm-watson ×1
jquery ×1
json ×1
null ×1
php ×1
phylogeny ×1
postgresql ×1
preflight ×1
query-string ×1
video ×1