我创建了一个数组并在其中插入了一个setInterval,但是tmp[0]不起作用
tmp = new Array();
v = new Array();
for(i=0; i<2; i++){
j = 0;
tmp[i] = setInterval("if(j<10+(i*5)){alert(i+' '+j);j++;}else{clearInterval(tmp[i])}", 1000);
}
Run Code Online (Sandbox Code Playgroud) 有没有办法获得 xmlHttpRequest 加载时间?
否则我必须设置一个函数来计算它,所以呢?
我试图在二进制文件中查找0x0D0A.但是strchr在找到0x00时停止并且我没有得到正确的位置.
请告诉我为什么它不起作用
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
main(){
FILE *f;
long size;
char *buffer;
f = fopen(filename, "rb");
if(f==NULL){fputs("File error",stderr); exit(1);}
// obtain file size
fseek(f, 0, SEEK_END);
size = ftell(f);
rewind(f);
// allocate memory to contain the whole file
buffer = (char*) malloc(sizeof(char)*size);
if(buffer == NULL){fputs("Memory error",stderr); exit(2);}
// copy the file into the buffer
if((size_t)fread(buffer,1,size,f) != size){fputs("Reading error",stderr); exit(3);}
fclose(f);
// get positions
char *p;
p = strchr(buffer, 0x0D0A);
while(p != NULL){
printf("found at %d\n", …Run Code Online (Sandbox Code Playgroud) 我写了这段代码来发送帖子请求
$ch = curl_init("http://www.exemple.com");
curl_setopt($ch, CURLOPT_COOKIE, "PHPSESSID=32chars; prsess_******=32chars; login_******=55chars");
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("type" => "1"));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: application/x-www-form-urlencoded; charset=UTF-8"));
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$page = curl_exec($ch);
print $head = curl_getinfo($ch, CURLINFO_HEADER_OUT);}
curl_close($ch);
Run Code Online (Sandbox Code Playgroud)
但我把它作为标题
POST / HTTP/1.1
User-Agent: Mozilla/5.0 ...
Host: www.exemple.com
Accept: */*
Referer: http://www.exemple.com/page.php
Cookie: PHPSESSID=32chars; prsess_******=32chars; login_******=55chars
Content-Length: 140
Expect: 100-continue
Content-type: application/x-www-form-urlencoded; charset=UTF-8; boundary=----------------------------0636ec3c1d17
Run Code Online (Sandbox Code Playgroud)
有人能告诉我为什么type=1没有列出?
setInterval 在此代码中无法正常工作
<script language="javascript">
x = y = 0;
function mvtb(p, g){
i = 0;
tmp = setInterval(function (){
if(i < 100 && i >= 0){
document.getElementById("plan").scrollTop = 200*(y+((y-g)*(i/100)));
document.getElementById("plan").scrollLeft = 660*(x+((x-p)*(i/100)));
i++;
}
else if(i == 100){
clearInterval(tmp);
}
}, 10);
x = p; y = g;
}
</script>
Run Code Online (Sandbox Code Playgroud)
CSS
<style>
#plan {overflow: hidden; height: 200px; width: 660px; background: #444;}
.plan {width: 1980px;}
.plan table {height: 200px; width: 660px;}
</style>
Run Code Online (Sandbox Code Playgroud)
HTML
<body style="background: black; color: white;">
<center>
<div id="plan"> …Run Code Online (Sandbox Code Playgroud) 编译时我得到"错误:错误的寄存器名称'%% ecx'"
#include <stdio.h>
int main(void){
asm("mov 3, %%ecx\n\t");
// ...
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我尝试asm("hlt");在win8 上做,但提示Windows错误窗口.
有什么方法可以让HLT继续运行一段时间吗?