小编Da *_* Li的帖子

Ubuntu psql:无法连接到服务器

我本地安装了 postgresql。正如我所得到的,它不会启动:

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

手动启动不起作用:

sudo /etc/init.d/postgresql restart
  * Restarting PostgreSQL 9.4 database server
  * The PostgreSQL server failed to start. Please check the log output:
       2015-03-09 17:41:39 CET [3769-1] FATAL:  could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
Run Code Online (Sandbox Code Playgroud)

好的,权限有问题。让我们看看它们:

ls -all /var/run/
drwxr-xr-x 27 root        root         900 Mar  9 17:36 .
drwxr-xr-x 25 root        root        4096 Feb …
Run Code Online (Sandbox Code Playgroud)

ubuntu psql

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

Scala:在reflect.runtime.universe.Type上进行模式匹配?

如何在reflect.runtime.universe.Type上进行模式匹配?

def test(t: reflect.runtime.universe.Type) {
  t match {
    case Int => \\ ...
    case Double => \\ ...
    case String => \\ ... 
    case _ =>  \\ ...
  }
}    
Run Code Online (Sandbox Code Playgroud)

这不起作用,因为翻译抱怨:

error: pattern type is incompatible with expected type;
 found   : Int.type
 required: reflect.runtime.universe.Type
Note: if you intended to match against the class, try `case _: Int`
         case Int => // ...
              ^
Run Code Online (Sandbox Code Playgroud)

尝试该建议也不起作用:

def test(t: reflect.runtime.universe.Type) {
  t match {
    case _: Int => \\ ...
    case _: Double …
Run Code Online (Sandbox Code Playgroud)

types scala pattern-matching

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

标签 统计

pattern-matching ×1

psql ×1

scala ×1

types ×1

ubuntu ×1