我本地安装了 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) 如何在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)