用于检查我正在使用的csh脚本中是否存在任何文件
if [ -f /var/opt/temip/conf/.temip_config ]
Run Code Online (Sandbox Code Playgroud)
但我得到低于错误
if [ -f /var/opt/temip/conf/.temip_config ]
if: Expression Syntax.
Run Code Online (Sandbox Code Playgroud)
谁能告诉我怎么做?
Kafka 主题创建在以下情况下失败:
节点为kafka集群:4
复制因子:4
集群中启动并运行的节点数:3
下面是错误:
./kafka-topics.sh --zookeeper :2181 --create --topic test_1 --partitions 1 --replication-factor 4
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Error while executing topic command : Replication factor: 4 larger than available brokers: 3.
[2018-10-31 11:58:13,084] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 4 larger than available brokers: 3.
Run Code Online (Sandbox Code Playgroud)
这是 kafka 中的有效行为还是某些已知问题?
如果集群中的所有节点都应该始终启动并运行,那么容错呢?
更新 json 文件以增加已创建主题的复制因子:
$cat /tmp/increase-replication-factor.json …Run Code Online (Sandbox Code Playgroud) 我试图从字符数组复制到字符指针.我的代码:
char str[] = "Hello World";
char *result = (char *)malloc(strlen(str)+1);
int index=0;
while(index <= strlen(str))
{
*result = str[index];
result++;
index++;
}
Run Code Online (Sandbox Code Playgroud)
上面的代码不起作用,下面的代码工作正常
char str[] = "Hello World";
char *result = (char *)malloc(strlen(str)+1);
int index=0;
while(index <= strlen(str))
{
result[index] = str[index];
index++;
}
Run Code Online (Sandbox Code Playgroud)
谁能解释这种行为?
我正在使用 csh 脚本,我想在调试模式下执行 csh 脚本时查看行号。我正在做这样的事
csh -x 脚本名称
除此之外,我还需要做什么才能在调试模式下查看行号?
I have read that static variables in c/c++ only initialised once.
But when i tried to experiment with it. I found that they can be initialised multiple times
#include <iostream>
#include <string>
using namespace std;
void demo(int value)
{
// static variable
static int count = 0;
count = value;
cout << count << " ";
}
int main()
{
for (int i=0; i<5; i++)
demo(i+1);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
In above code my initialised static variable count multiple times.
output …