小编Pen*_*per的帖子

如何在C中实现struct的二维数组

我目前正在尝试理解如何在C中实现结构的二维数组.我的代码一直在崩溃,我真的要让它像我所有的方法一样坚定到C:垃圾.这就是我得到的:

typedef struct {
    int i;
} test;

test* t[20][20];
*t = (test*) malloc(sizeof(test) * 20 * 20);
Run Code Online (Sandbox Code Playgroud)

我的光荣错误:

错误:从类型'struct test*'分配类型'struct test*[20]'时出现不兼容的类型

我是否必须为每个第二维单独分配内存?我疯了.应该这么简单.有一天,我将构建一个时间机器并磁化一些c-compiler-floppies ......

c struct multidimensional-array

11
推荐指数
2
解决办法
4万
查看次数

用硒运行django-test时管道出现错误

在使用selenium(没有远程,没有xvfb)运行django测试时,我总是得到以下异常:

Creating test database for alias 'default'...

Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 127, in finish_response
self.write(data)
File "/usr/lib/python2.7/wsgiref/handlers.py", line 210, in write
self.send_headers()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 268, in send_headers
self.send_preamble()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 192, in send_preamble
'Date: %s\r\n' % format_date_time(time.time())
File "/usr/lib/python2.7/socket.py", line 324, in write
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 44089)
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
Traceback …
Run Code Online (Sandbox Code Playgroud)

python testing django selenium django-testing

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

如何通过"setInterval"传递范围

我现在想知道是否有更好的解决方案,而不是通过参数'e' 将此范围传递给lambda函数,然后使用call()将其传递给'funkyFunction' - 方法

setInterval(function(e){e.funkyFunction.call(e)}, speed, this)
Run Code Online (Sandbox Code Playgroud)

(抛出一些小问题:我一直在阅读有关javascript内存泄漏的内容.lambda函数如何影响我的内存?首先定义它var i = function(e)...然后将其作为参数传递给setInterval 更好吗?)

javascript lambda memory-leaks scope setinterval

6
推荐指数
3
解决办法
1万
查看次数

詹金斯随机崩溃

我的jenkins-server随机崩溃,因此我确保拥有最新版本并检查日志,但它们并没有向我提供有用的信息.我的问题是:如何调试这些崩溃?有没有办法增加日志级别?

这是我的日志输出:

Running

 from: /usr/share/jenkins/jenkins.war
Nov 5, 2012 12:42:33 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Jenkins home directory: /var/lib/jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Nov 5, 2012 12:42:35 PM winstone.Logger logInternal
INFO: HTTP Listener started: port=8080
Nov 5, 2012 12:42:35 PM winstone.Logger logInternal
INFO: Winstone Servlet Engine v0.9.10 running: controlPort=disabled
Nov 5, 2012 12:42:36 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Nov 5, 2012 12:42:36 PM hudson.ClassicPluginStrategy createPluginWrapper
INFO: Plugin cvs.jpi is disabled
Nov 5, 2012 12:42:36 PM hudson.ClassicPluginStrategy createPluginWrapper …
Run Code Online (Sandbox Code Playgroud)

jenkins

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

ImportError:无法导入名称normalize

我试图使用djangos i18n,因此必须安装gettext.现在,每当我尝试启动应用程序时,我都会遇到这个尴尬的错误:

Traceback (most recent call last):
  File "/var/www/mydjangoproject/manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
  File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/__init__.py", line 4, in <module>
    from optparse import OptionParser, NO_DEFAULT
  File "/usr/lib/python2.7/optparse.py", line 418, in <module>
    _builtin_cvt = { "int" : (_parse_int, _("integer")),
  File "/usr/lib/python2.7/gettext.py", line 581, in gettext
    return dgettext(_current_domain, message)
  File "/usr/lib/python2.7/gettext.py", line 545, in dgettext
    codeset=_localecodesets.get(domain))
  File "/usr/lib/python2.7/gettext.py", line 480, in translation
    mofiles = find(domain, localedir, languages, all=1)
  File "/usr/lib/python2.7/gettext.py", line 437, in find
    for nelang in _expand_lang(lang):
  File …
Run Code Online (Sandbox Code Playgroud)

python django locale gettext

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