这是一个非常有趣的问题,所以让我设置场景.我在国家计算机博物馆工作,我们刚刚设法从1992年开始运行一台Cray Y-MP EL超级计算机,我们真的想看看它有多快!
我们认为最好的方法是编写一个简单的C程序来计算素数,并显示这需要多长时间,然后在快速的现代台式PC上运行程序并比较结果.
我们很快想出了这个代码来计算素数:
#include <stdio.h>
#include <time.h>
void main() {
clock_t start, end;
double runTime;
start = clock();
int i, num = 1, primes = 0;
while (num <= 1000) {
i = 2;
while (i <= num) {
if(num % i == 0)
break;
i++;
}
if (i == num)
primes++;
system("clear");
printf("%d prime numbers calculated\n",primes);
num++;
}
end = clock();
runTime = (end - start) / (double) CLOCKS_PER_SEC;
printf("This machine calculated all %d prime numbers under …Run Code Online (Sandbox Code Playgroud) 无论如何将帖子数据发送到PHP脚本而不是表单?(当然不使用GET).
我希望javascript在X秒后重新加载页面并同时将一些数据发布到页面.我可以用GET做,但我宁愿使用POST,因为它看起来更干净.
非常感谢.
编辑:是否可以使用PHP标头?我确信使用JQuery更好,但对于我目前的情况,我可以更容易/更快地实现它:)
干杯
我最终这样做了:
<script>
function mySubmit() {
var form = document.forms.myForm;
form.submit();
}
</script>
...
<body onLoad="mySubmit()";>
<form action="script.php?GET_Value=<?php echo $GET_var ?>" name="myForm" method="post">
<input type="hidden" name="POST_Value" value="<?php echo $POST_Var ?>">
</form>
</body>
Run Code Online (Sandbox Code Playgroud)
似乎对我来说工作正常,但请说出来是否有任何问题!
感谢大家.
基本上下面的代码应该只是一个白色页面,边缘有阴影.这在Chrome中运行良好,但我似乎无法在Firefox中使用它!
<html>
<head>
<style type=text/css>
body {
background:#ffffff;
font-family:arial;
margin:auto;
box-shadow:inset 0px 0px 100px #333333;
-moz-box-shadow:inset 0px 0px 100px #333333;
-webkit-box-shadow:inset 0px 0px 100px #333333;
}
</style>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在这里查看页面:
http://pastehtml.com/view/bagevr6ke.html
在Chrome和Firefox中查看它,告诉我你是否看到了区别:)
干杯
编辑:所以下面的帖子解释了如何修复上面的代码,CSS重置工作,我也学习了关于quirk模式和doctypes :)
然而,无论我使用什么重置,我正在处理的CSS页面仍然受到这个bug的影响.我目前没有使用Doctype,因为我不确定应该放什么,或者它是否会修复bug.
这是完整的网站:
http://middle.dyndns-server.com/results.html
和样式表:
body {
background:url('bg.png');
font-family:arial;
margin:auto;
box-shadow:inset 0px 0px 100px #333333;
-moz-box-shadow: inset 0px 0px 100px #333333;
-webkit-box-shadow:inset 0px 0px 100px #333333;
}
#footer {
padding-bottom:10px;
margin-top:30px;
}
#page {
width:960px;
height:auto;
background-color:#ffffff;
#background:url('bg2.png');
/*Space*/
padding-top:0px;
padding-bottom:0px;
padding-left:0px;
padding-right:0px;
margin-top:-10px; …Run Code Online (Sandbox Code Playgroud) 我有两个具有这些结构的文本文件:
档案1
Column1:Column2
Column1:Column2
...
Run Code Online (Sandbox Code Playgroud)
档案2
Column3
Column3
...
Run Code Online (Sandbox Code Playgroud)
我想创建一个具有此文件结构的文件:
Column1:Column3
Column1:Column3
...
Run Code Online (Sandbox Code Playgroud)
打开任何建议,但如果解决方案可以从Bash shell或sed/awk/perl/etc完成,那将是很好的...
这是为了大学任务.在我们学院,他们使用Microsofts的Active Directory来运行他们的网络.
每个月我们都会被要求更改我们的密码,当我们这样做时,它将不接受我们使用的前五个密码或类似的密码.例如,如果我的密码是'secretpassword1',下个月我就不能使用'secretpassword2'.
然而,我能看到这一点的唯一方法是,如果用于存储密码的散列算法存在缺陷; 密码不是经过哈希处理而是加密的; 或者更糟,它们以明文形式存储.
在快速的Google-Fu会话之后,似乎Active Directory将密码存储在常规Windows哈希中.所以有人能解释一下吗?
干杯
PS这可能是我们的想象力; 也许你可以重用一个略有不同的密码?
windows security passwords active-directory password-protection
interface Company {
id: string;
name: string;
}
type input = Company;
// This fails as the types don't match
const ACME: input = { id: '123', name: 'ACME', ceo: 'Eric' };
function mapIds(ids: string[]): input[] {
// This compiles, but it shouldn't, or is Array.map returning something different?
return ids.map(id => ({ id: '1', name: '1', ceo: 'Eric' }));
// This fails as types don't match
return [{ id: '1', name: '2', ceo: 'Eric' }];
}
?
Run Code Online (Sandbox Code Playgroud)
Given the …
在这个程序中,我创建一个fork,然后从它调用domultithreading.然后它创建一些线程.
sub domultithreading {
#Not my function
my ($num) = @_;
my @thrs;
my $i = 0;
my $connectionsperthread = 50;
while ( $i < $num ) {
$thrs[$i] = threads->create( \&doconnections, $connectionsperthread, 1 );
$i += $connectionsperthread;
}
my @threadslist = threads->list();
while ( $#threadslist > 0 ) {
$failed = 0;
}
}
sub kill {
#how can I kill the threads made in domultithreading?
kill 9, $pid;
print "\nkilling $pid\n";
}
Run Code Online (Sandbox Code Playgroud)
然后我希望能够杀死fork及其线程,但是我无法理解它.有什么建议?
非常感谢
可能重复:
如何:在PHP中重写URL?
网站如何使用您在URL中直接提供的参数?
例如,您可以访问:
然后,该网站上的脚本可以使用值www.google.com查看该网站是否已启动.
我可以这样做:
http://isup.me/index.php?url=ww.google.com
$url = $_GET['url'];
Run Code Online (Sandbox Code Playgroud)
但那不是很干净,我很想知道它是如何做到的.
非常感谢!pimvdb指出这是这个问题的重复:
我想在Windows上开发C,但我真的很喜欢在Linux上使用vim和gcc进行编译.Windows的IDE是否如此简单?
我只想要一个带编号行,语法高亮和编译/运行/构建按钮的编辑器!(我对C很新)
或者有没有办法让Vim for Windows编译C?
非常感谢
解决方案:设置MinGW,然后设置GVim,这样我就可以jtut up up vim并运行:make to compile :)