小编Jac*_*cob的帖子

setTimeout停止工作

我有一个页面,我希望始终保持文件中的值.

基本上我有一个脚本保存一些数据供我在网站上以txt文件显示,然后我想在网上显示这些数据.文本文件中的数据每20秒左右更新一次.

它的工作效果很好,比如3分钟左右,然后页面就停止了.任何想法为什么会这样?

function updatepot(elementid) {
        var xmlhttp = new XMLHttpRequest();
        xmlhttp.onreadystatechange = function() {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById(elementid).innerHTML = this.responseText;
            }
        };
        xmlhttp.open("GET", "../readData.php?q=" + elementid, true);
        xmlhttp.send();

}

function updatePots()
{
       updatepot("pot0");
}
function keeprunning()
{
    setTimeout(updatePots, 1000);
    keeprunning();
}


<?php    
// get the q parameter from URL
$file = $_REQUEST["q"] . ".txt";
$myfile = fopen("potData/".$file, "r") or die("Unable to open file!");
$myData;
while(!feof($myfile)) {
  $myData =  $myData . fgets($myfile);
}
fclose($myfile); …
Run Code Online (Sandbox Code Playgroud)

html javascript php settimeout

5
推荐指数
2
解决办法
1080
查看次数

Raspberry makefile

我正在尝试将程序从我的cloud9-ide移动到我的覆盆子.但是当我移动它们时,makefile不再有效.

#
# Makefile
#
# Computer Science 50
# Problem Set 5
#


# compiler to use
CC = clang

# flags to pass compiler
CFLAGS = -ggdb3 -O0 -Qunused-arguments -std=c11 -Wall -Werror

# name for executable
EXE = myTest

# space-separated list of header files
HDRS = i2cContinuousRead.h

# space-separated list of libraries, if any,
# each of which should be prefixed with -l
LIBS =

# space-separated list of source files
SRCS = myTest.c i2cContinuousRead.c

# automatically …
Run Code Online (Sandbox Code Playgroud)

c makefile raspberry-pi

1
推荐指数
1
解决办法
164
查看次数

标签 统计

c ×1

html ×1

javascript ×1

makefile ×1

php ×1

raspberry-pi ×1

settimeout ×1