我在一个我正在研究的程序中遇到这个奇怪的问题.如果我尝试在Ada中使用get_line在已经执行过先前的问答后请求使用响应,则程序不会等待响应.我已经整理了一个复制问题的小程序.我不能在我的情况下使用无界字符串.我有使用绑定字符串的说明.
WITH Ada.Text_IO; USE Ada.Text_IO;
PROCEDURE StrPractice IS
Name : String (1 .. 5);
NextName : String (1 .. 10);
Len : Natural;
BEGIN
Put("Enter first name? "); --5 digit terry
Get(Name);
new_line;
Put_line("First Name: " & name);
New_Line;
Put("Enter next name:");
Get_Line(NextName, Len);
new_line(2);
Put_Line("Next name: " & NextName(1..Len));
END StrPractice;
Run Code Online (Sandbox Code Playgroud)
我不确定是什么导致了这个问题.我想也许缓冲区需要清除,所以我创建了一个字符变量c并使用了get(c),但这并没有纠正我的问题.我在这里搜索过,但没有看到同样的情况.任何帮助,将不胜感激.
我试图在Redhat机器上第一次启动Cassandra.我已经成功地在我的练习Ubuntu机器上这样做了,但由于某种原因,Redhat安装给了我以下错误:
INFO [main] 2017-06-29 20:11:42,369 YamlConfigurationLoader.java:89 - 配置位置:文件:/home/cassandra/apache-cassandra-3.10/conf/cassandra.yaml Exception(org.apache.cassandra.exceptions启动时遇到的.ConfigurationException:无效的yaml:file:/home/cassandra/apache-cassandra-3.10/conf/cassandra.yaml错误:null; 无法为标记构造java对象:yaml.org,2002:org.apache.cassandra.config.Config; exception =无法为JavaBean =org.apache.cassandra.config.Config@12405818创建property = data_file_directories; 没有为类找到单个参数构造函数[Ljava.lang.String ;; 在'reader',第10行,第1列:cluster_name:'Test Cluster'
^
无效的yaml:file:/home/cassandra/apache-cassandra-3.10/conf/cassandra.yaml错误:null; 无法为标记构造java对象:yaml.org,2002:org.apache.cassandra.config.Config; exception =无法为JavaBean =org.apache.cassandra.config.Config@12405818创建property = data_file_directories; 没有为类找到单个参数构造函数[Ljava.lang.String ;; 在'reader',第10行,第1列:cluster_name:'Test Cluster'
^错误[main] 2017-06-29 20:11:42,742 CassandraDaemon.java:752 - 启动时遇到异常:无效的yaml:file:/home/cassandra/apache-cassandra-3.10/conf/cassandra.yaml错误:null; 无法为标记构造java对象:yaml.org,2002:org.apache.cassandra.config.Config; exception =无法为JavaBean =org.apache.cassandra.config.Config@12405818创建property = data_file_directories; 没有为类找到单个参数构造函数[Ljava.lang.String ;; 在'reader',第10行,第1列:cluster_name:'Test Cluster'
我对yaml所做的唯一更改是我按如下方式设置数据和日志文件:
data_file_directories:/ var/lib/cassandra/data
commitlog_directory:/ var/log/cassandra/commitlog
这是一个单一节点,可以使它成为概念机的工作证明.我可以向更多有经验的用户征求一些帮助吗?
谢谢!
我正在寻找一个字符串和枚举的比较。我已经写了我要尝试的示例代码。由于String和枚举类型不同,如何在Ada中正确执行此操作?
WITH Ada.Text_IO; USE Ada.Text_IO;
PROCEDURE ColorTest IS
TYPE StopLightColor IS (red, yellow, green);
response : String (1 .. 10);
N : Integer;
BEGIN
Put("What color do you see on the stoplight? ");
Get_Line (response, N);
IF response IN StopLightColor THEN
Put_Line ("The stoplight is " & response(1..n));
END IF;
END ColorTest;
Run Code Online (Sandbox Code Playgroud)