小编Jos*_*son的帖子

如何在Xcode 4中指定命令行参数?

我刚刚升级到Xcode 4并且还没有找到很多关于它的文档,因为它只是黄金大师.我需要指定一个命令行参数来测试我的应用程序.

Xcode 3.2建议并没有帮助,因为一切都被移动了.

xcode command-line-arguments

93
推荐指数
2
解决办法
8万
查看次数

如何在supervisord中设置组?

所以我正在设置supervisord并尝试控制几个进程并且一切正常,现在我想设置一个组,这样我就可以启动/停止不同的进程集而不是全部或全部.这是我的配置文件的片段.

[group:tapjoy]
programs=tapjoy-game1,tapjoy-game2

[program:tapjoy-game1]
command=python tapjoy_pinger.py -g game1
directory=/go/here/first
redirect_stderr=true
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true

[program:tapjoy-game2]
command=python tapjoy_pinger.py -g game2
directory=/go/here/first
redirect_stderr=true
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
Run Code Online (Sandbox Code Playgroud)

现在,通过阅读文档,这看起来像它应该工作,但调用 supervisorctl restart tapjoy: 没有做任何事情.

我错过了什么吗?

添加星号不会产生错误,但也不会执行任何操作.

supervisorctl restart tapjoy:*
supervisorctl status
tapjoy_game1                     RUNNING    pid 4697, uptime 1 day, 21:56:23
tapjoy_game2                     RUNNING    pid 4698, uptime 1 day, 21:56:23
tapjoy_game3                     RUNNING    pid 4699, uptime 1 day, 21:56:23
tapjoy_game4                     RUNNING    pid 4700, uptime 1 day, 21:56:23
tapjoy_game5                     RUNNING    pid 4701, uptime 1 day, 21:56:23
Run Code Online (Sandbox Code Playgroud)

python configuration supervisord

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

SwiftUI 中“DocumentGroups”的“FileDocument”和“ReferenceFileDocument”有什么区别?

我正在尝试在我的应用程序中设置 a DocumentGroup,但还没有ReferenceFileDocument可用的示例。我知道 aFileDocument是什么,但ReferenceFileDocuments 有什么不同。

文档中它说的是:

与 ReferenceFileDocument 的一致性预计是线程安全的,并且反序列化和序列化将在后台线程上完成。

swiftui documentgroup

12
推荐指数
2
解决办法
1873
查看次数

为什么这个变量会在return语句后发生变化?

我有一个带签名的功能:

int exe(int stack[][STACKSIZE], int sp[], int reg[][REGISTERSIZE], int next_instruct[],
        int next_inst[], int cur_proc, int *terminate);
Run Code Online (Sandbox Code Playgroud)

它有最后两行:

printf("TWO cur_proc: %d\n",cur_proc);
return NORMAL;
Run Code Online (Sandbox Code Playgroud)

并且被称为这样:

printf("ONE cur_proc: %d\n",cur_proc);
msg = exe(stack,sp,reg, next_instruct, next_instruct, cur_proc, &terminate);
printf("THREE cur_proc: %d\n",cur_proc);
Run Code Online (Sandbox Code Playgroud)

而且我传入的cur_proc内容被认为是"只读"(并不是值得通过值传递)变量exe().做我的东西exe().

我的输出是:

ONE cur_proc: 1
TWO cur_proc: 1
THREE cur_proc: -1
Run Code Online (Sandbox Code Playgroud)

这对我来说非常混乱,因为我看不出有任何理由可以用负面覆盖这一点.

这种奇怪行为的可能原因是什么?

c variables return function

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

字符串分配seg fault - 为什么会发生这种情况?

可能重复:
获取分段错误

/*  Reverse a string in place
 */
#import <stdio.h>

void reverse(char * str);

int main()
{
    char * string = "This is a string.";
    printf("%s\n", string);
    reverse(string);
    printf("%s\n", string);
}

void reverse(char * str)
{   
    char * start = str;
    char * end = str;
    if(0==*str)
        return;

    //Find the end
    for(;0 != *(++end););

    end--;
    do
    {
        *end   = *end ^ *start;
        *start = *end ^ *start;
        *end   = *end ^ *start;
    }while(++start < --end);
}
Run Code Online (Sandbox Code Playgroud)

我不确定为什么这个seg会出错.是因为我用常量字符串初始化我的char*?

c reverse segmentation-fault

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

如何从python中的字符串中删除\

我无法让replace()工作

我试过my_string.replace('\\', '')re.sub('\\', '', my_string),但没有一个工作.

我以为\是反斜杠的转义码,我错了吗?

有问题的字符串看起来像

'<2011315123.04C6DACE618A7C2763810@\x82\xb1\x82\xea\x82\xa9\x82\xe7\x8c\xa9\x82\xa6\x82\xe9\x82\xbe\x82\xeb\x82\xa4>'

要么 print my_string <2011315123.04C6DACE618A7C2763810@????????????>

是的,它应该看起来像垃圾,但我宁愿得到 '<2011315123.04C6DACE618A7C2763810@82b182ea82a982e78ca982a682e982be82eb82a4>'

python string replace backslash

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