我想知道为什么log base 10 (1.5)python = 0.405465108108 的结果,而真正的答案= 0.176091259.
这是我写的代码:
import math
print math.log(1.5)
Run Code Online (Sandbox Code Playgroud)
有人能说出如何解决这个问题吗?
我一直在尝试验证Jar签名:
jarsigner -verify -verbose -certs example.jar
Run Code Online (Sandbox Code Playgroud)
我遇到了以下问题:
jarsigner: java.lang.SecurityException: invalid SHA1 signature file digest for o
rg/apache/log4j/net/DefaultEvaluator.class
Run Code Online (Sandbox Code Playgroud)
我有一些关于使用的建议,-digestalg SHA-1但我不知道我应该在哪里发表这个声明!
我希望你能帮我解决问题.
我有一个DropDownList,询问用户是否想加入俱乐部:
Do you want to join the club
Yes
No
Run Code Online (Sandbox Code Playgroud)
在此列表下,还有另一个列表,默认设置为禁用.这个名单有俱乐部的部门.在用户选择"是"之前,不会启用此列表.
我构建了以下代码,但我无法解决的问题是让我们假设用户选择是,然后他改变了他的决定,所以他将再次选择否.在这种情况下,部门列表仍然启用.当他再次选择No时,我希望它被禁用.
<html>
<head>
<script type="text/javascript">
function disable()
{
document.getElementById("mySelect1").disabled=true;
}
function enable()
{
document.getElementById("mySelect1").disabled=false;
}
</script>
</head>
<body>
<form>
<select id="mySelect" onChange="enable();">
<option onSelect="disable();">No</option>
<option onSelect="enable();">Yes</option>
</select>
<select id="mySelect1" disabled="disabled" >
<option>Dep1</option>
<option>Dep2</option>
<option>Dep3</option>
<option>Dep4</option>
</select>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我认为这样onSelect="disable();"可以解决问题,但仍然无效.
谢谢
在我的网页中,我想在当前时间等于例如下午5:00时播放声音.
我做的是:
<script type='text/css'>
var d = new Date();
var m = d.getMinutes();
var h = d.getHours();
if (h == 17 && m == 00){
document.write = "<embed src =\'notify.mp3\' hidden=\'true\' autostart=\'true\' loop=\'true\'></embed>";
}
</script>
Run Code Online (Sandbox Code Playgroud)
我寻找一个播放声音的特定功能,我发现document.write它不起作用,没有意义.
任何建议我应该做什么
是否有工具或方法来计算给定Java类中的分支数?例如,我想计算以下简单Java类中的分支数:
public class Testt {
public boolean getTest(int x) {
if (x > 5) {
return true;
} else {
return false;
}
}
public int getTest1(int x) {
int t = 0;
if (x == 10) {
t = 1;
} else if (x == 8) {
t = 3;
} else {
t = 11;
}
return t;
}
}
Run Code Online (Sandbox Code Playgroud) 在下面的下拉菜单中,当用户选择操作No时,我希望显示下一个下拉菜单
<select id="OperationType" onChange="check(this);">
<option value="OpNo">Operation No</option>
<option value="OpEmp">Employee No</option>
</select>
<select id=OperationNos>
<option value="1001">1001</option>
<option value="1002">1002</option>
</select>
Run Code Online (Sandbox Code Playgroud)
如果用户选择员工号,我希望隐藏最后一个下拉菜单,并显示以下文本字段:
<input type='text'>
Run Code Online (Sandbox Code Playgroud)
我做的是我把以下脚本但它不会隐藏这两个元素:
function check(elem) {
document.getElementById('OperationType').disabled = !elem.selectedIndex;
}
Run Code Online (Sandbox Code Playgroud)
它只是禁用它.我希望它是隐形的.谢谢
我想在文本中搜索一个单词,然后打印没有该单词的文本.例如,我们有"我和朋友在一起"的文字,我希望文字是"我和我的朋友".到目前为止我做了以下事情:
text=re.compile("[^was]")
val = "I was with my friend"
if text.search(val):
print text.search(val) #in this line it is obvious wrong
else:
print 'no'
Run Code Online (Sandbox Code Playgroud) 在下面的代码中,我试图用另一个名称打印每个名称一次:
myList = ['John', 'Adam', 'Nicole', 'Tom']
for i in range(len(myList)-1):
for j in range(len(myList)-1):
if (myList[i] <> myList[j+1]):
print myList[i] + ' and ' + myList[j+1] + ' are now friends'
Run Code Online (Sandbox Code Playgroud)
我得到的结果是:
John and Adam are now friends
John and Nicole are now friends
John and Tom are now friends
Adam and Nicole are now friends
Adam and Tom are now friends
Nicole and Adam are now friends
Nicole and Tom are now friends
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,它工作正常,每个名字都是另一个名字的朋友,但有一个重复Nicole and Adam,已经提到过 …
我有以下SPARQL查询:
PREFIX yago: <http://dbpedia.org/class/yago/>
SELECT distinct count (?Montreal) as ?Montreal count(?Toronto) as ?Toronto
WHERE
{
{?Montreal rdf:type yago:HospitalsInMontreal} UNION {?Toronto rdf:type yago:HospitalsInToronto}.
}
Run Code Online (Sandbox Code Playgroud)
此查询结果为:
蒙特利尔= 20多伦多= 28
我想要的是:我想编辑查询而不是给出20和28,我想比较结果,如果蒙特利尔的医院数量大于多伦多的医院数量那么:
蒙特利尔= 1多伦多= 2
如果多伦多的医院数量大于蒙特利尔的医院数量,那么:
蒙特利尔= 2
多伦多= 1
我试过这个查询,但它不起作用:
PREFIX yago: <http://dbpedia.org/class/yago/>
SELECT distinct count (?Montreal) as ?Montreal count(?Toronto) as ?Toronto
WHERE
{
{?Montreal rdf:type yago:HospitalsInMontreal} UNION {?Toronto rdf:type yago:HospitalsInToronto}.
LET( ?Montreal := IF( ?Montreal > ?Toronto, -1, 1 ).
}
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在学习如何创建SPARQL查询.目前,我正在使用Dbpedia数据集.
我尝试使用以下查询查询"加拿大有哪些机场":
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?name ?country WHERE {
?name rdf:type <http://dbpedia.org/ontology/Airport>;
?name rdf:type <http://dbpedia.org/ontology/Country>
}
LIMIT 20
Run Code Online (Sandbox Code Playgroud)
我仍然对构建SPARQL查询感到困惑,特别是对于资源和RDF图.
我需要的是上述查询的错误是什么?
谢谢
在下面的代码中,我试图通过char读取文件char并在控制台上显示每个char:
#include <stdio.h>
#pragma warning(disable:4996)
int main(){
FILE *file;
file = fopen("input.txt", "r");
int c;
while ((c = fgetc(file)) != EOF)
{
printf("%c ",(char)c );
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
有人可以帮我解决这个问题吗?