小编use*_*824的帖子

如何在Junit控制台中接受来自用户的输入

我正在尝试为下面给出的函数编写Junit测试用例:

class A{
  int i;
  void set()
  {
    Scanner in=new Scanner(System.in);
    i=in.nextInt();
  }
}
Run Code Online (Sandbox Code Playgroud)

现在我的问题是当我为它创建一个Junit测试用例时,除了用户的输入之外它没有:

 public void testSet() throws FileNotFoundException {
    System.out.println("set");
    A instance = new A();
    int i=1;
    instance.set(i);
    // TODO review the generated test code and remove the default call to fail.
    //fail("The test case is a prototype.");
}
Run Code Online (Sandbox Code Playgroud)

请建议我该怎么做才能接受用户的意见.

java junit junit4 junit3

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

运行autogen.sh时遇到麻烦

我从http://libspatialindex.github.com/下载了R tree

自从运行./autogen.sh后,我找不到文件/文件夹,因此我从github存储库下载了文件autogen.sh,如下所示:

https://raw.github.com/libspatialindex/libspatialindex/9a5a2f4d83c3ec7be4dbf2c8a86341703d837185/autogen.sh

现在当我运行./autogen.sh时,我得到"权限被拒绝"如果我运行sh ./autogen.sh我得到:

glibtoolize or libtoolize not found. Giving up!
Run Code Online (Sandbox Code Playgroud)

请建议我现在该怎么做

编辑:我也想在我的C++项目中使用libspatialindex.我正在使用netbeans.我的意思是我想在我的netbeans项目中使用libspatialindex中的函数.我应该如何使用相同的.现在我在一个单独的目录中运行config和make命令.我不知道如何在我的项目中使用它们.

linux bash ubuntu

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

连接psql时出现问题

我按照http://xadmin.info/?p=284上的说明安装了postgresql

# pg_ctl -D /var/lib/pgsql/data -l pglog.log start
server starting
postgres@linux-p0pl:~> psql
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on
 Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

我不知道为什么我在服务器启动时出现此错误...有人可以请帮助.

我的pglog.log文件显示以下输出:

2013-02-06 19:43:39 GMT   FATAL:  lock file "postmaster.pid" already exists
2013-02-06 19:43:39 GMT   HINT:  Is another postmaster (PID 23971) running in data directory "/var/lib/pgsql/data"?
2013-02-06 19:44:02 GMT   FATAL:  lock file "postmaster.pid" already exists
2013-02-06 19:44:02 GMT   HINT:  Is another postmaster (PID …
Run Code Online (Sandbox Code Playgroud)

linux postgresql opensuse

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

无需root用户即可访问postgres

我在postgres中创建了一个名为"databaseName"的postgres数据库.现在我可以通过访问这个data2database

 su - postgres
Run Code Online (Sandbox Code Playgroud)

然后输入我的密码

然后我通过以下方式进入数据库:psql databaseName

我通过以下方式创建了此数据库的用户:

   createuser -P userName1
Run Code Online (Sandbox Code Playgroud)

现在我不希望数据库的用户以root用户身份访问数据库.现在,当用户尝试登录postgres时

 su - postgres -u userName1 
        or through
 psql databaseName -u userName1
Run Code Online (Sandbox Code Playgroud)

我收到错误...有人可以指导我如何在不是root用户的情况下访问postgres和数据库吗?

sql postgresql postgresql-9.1 postgresql-9.2

2
推荐指数
1
解决办法
3588
查看次数

即使管理员将屏幕的chmod更改为700或777,如何继续运行屏幕命令

我是系统管理员.系统的用户使用屏幕在后台运行他们的程序.但是,如果我在用户程序运行时将屏幕模式更改为700或777,则会停止其程序.当用户运行时

      screen -r process_id
Run Code Online (Sandbox Code Playgroud)

然后它显示该过程无法恢复.有人可以指导用户应该如何运行他们的程序,即使在777和700的屏幕大小之后,他们的程序也不会停止.

linux ubuntu

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