所以基本上我无法删除页面的顶部.它只是白色空间,无论我改变了多少css,我似乎无法改变任何东西.我希望我的导航栏位于页面顶部,没有填充或边框或任何东西.这是我的代码,我知道这可能是最简单的事情,只是我现在找不到它.
HTML
<!DOCTYPE html>
<html>
<head>
<meta name="Description" content="This is a test website!"/>
<meta name="author" content="Me!"/>
<title>test | Home</title>
<link type="text/css" rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div id="wrapper">
<nav id="navmenu">
<ul>
<li>Home</a>
<li>About</li>
<li>Tutorials</li>
<li>Services</li>
<li>Contact Us</li>
</ul>
<aside id="sidenews">
</aside>
<div id="center">
<section id="mainsection">
<article>
<header>
<hgroup>
<h1>This is a test</h1>
<h2>I like tests!</h2>
</hgroup>
</header>
<section>
<p>This is the main section of my section (sectception)</p>
</section>
<footer>
<p>Time and date</p>
</footer>
</article>
</section>
</div>
<footer id="cright">
<p>This is the …Run Code Online (Sandbox Code Playgroud) 我制作了一款目前存在帧速率问题的游戏。我确实认为问题在于我当前正在加载的图像数量相当大,所以我的问题是:“有没有办法预加载图像?所以基本上在使用之前就加载它们?”
我不知道这是否可行,但在我看来这听起来不错。所以基本上没有任何东西被绘制到屏幕上,但是图像已经准备好,没有任何延迟(或最小延迟)。
我正在尝试编写一个程序来读取未知大小/行大小的文件但我在检测新行字符时遇到了一些问题.
当我运行程序时,它永远不会到达while循环中的行点的末尾,readFile并且会不断运行.如果我运行打印每个字符,它会打印出一些未知的字符.
我已经尝试设置ch为一个int值和类型转换为char进行\n比较.它没有达到这个EOF条件,所以我不确定发生了什么.
码:
void readFile(FILE* file)
{
int endOfFile = 0;
while (endOfFile != 1)
{
endOfFile = readLine(file);
printf("%d\n", endOfFile);
}
}
int readLine(FILE* file)
{
static int maxSize = LINE_SIZE;
int currentIndex = 0;
int endOfFile = 0;
char* buffer = (char*) malloc(sizeof(char) * maxSize);
char ch;
do
{
ch = fgetc(file);
if ((ch != EOF) || (ch != '\n'))
{
buffer[currentIndex] = (char) ch;
currentIndex += 1;
} …Run Code Online (Sandbox Code Playgroud) 如果在程序关闭之前有办法执行某个操作,我就会徘徊.我正在运行一个程序很长一段时间,我确实希望能够关闭它并将数据保存在文本文件或其他东西中,但是我没有办法干扰while True我运行的循环,只是保存每个循环的数据都非常无效.
那么有什么方法可以保存数据,比如列表,当我点击x或销毁程序时?我一直在看atexit模块,但没有运气,除非我设置程序在某一点完成.
def saveFile(list):
print "Saving List"
with open("file.txt", "a") as test_file:
test_file.write(str(list[-1]))
atexit.register(saveFile(list))
Run Code Online (Sandbox Code Playgroud)
这是我整个atexit代码的部分,就像我说的那样,当我将它设置为关闭时,它运行正常while loop.
这是可能的,在应用程序终止时保存一些东西吗?