我一直在尝试编辑pg_hba.conf文件,以便能够仅使用IP地址访问服务器,到目前为止,没有成功.
例如,我可以使用«localhost»访问,但我想使用我的路由器给我的IP地址访问它类似于192.168.1.X
这是mi pg_hba.conf:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication postgres trust
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
host all all 0.0.0.0/0 trust
Run Code Online (Sandbox Code Playgroud)
有帮助吗?
我在4Gb机器上的64位Linux操作系统中运行以下代码:
package main
import (
"fmt"
"math"
)
func main() {
r := make([]bool, math.MaxInt32)
fmt.Println("Size: ", len(r))
}
Run Code Online (Sandbox Code Playgroud)
当我运行这个时,我得到:
Size: 2147483647
Run Code Online (Sandbox Code Playgroud)
如果我改变math.MaxInt32了math.MaxUint32我得到:
fatal error: runtime: out of memory
Run Code Online (Sandbox Code Playgroud)
随着切片大小math.MaxUint32我的内存不足,我期待那样,但当我尝试使用时,math.MaxInt64我得到:
panic: runtime error: makeslice: len out of range
Run Code Online (Sandbox Code Playgroud)
所以显然我无法创建一个大小为的切片math.MaxInt64,这让我们想到了一个问题:如果内存不是问题,那么我在Go中创建的最大切片是什么?
我记得在Java中,原始数组索引是用类型管理的int,所以原始数组的最大大小是a的最大值int,如果你尝试用long它来引发异常(据我记得)和Go一样吗?Go中的切片索引绑定到一个特定类型?
编辑:
我使用struct{}而不是bool分配math.MaxInt64元素来运行测试.一切都按预期进行,并打印:
Size: 9223372036854775807
Run Code Online (Sandbox Code Playgroud)
那么,另一个问题是,为什么当错误看起来相同(内存不足)时会出现两个不同的错误消息?
弹出每个错误的条件是什么?
我和Gradle有一个Kotlin项目,有两个孩子.每当我尝试在IDEA中打开它时,其中一个孩子会在树上出现两次.
在树中,您可以在顶层看到两个项目,grpc和grp.问题是grpc(从顶层)与grp的grpc是同一个项目.
这是我的Gradle构建文件:
父gradle.build:
buildscript {
ext.kotlin_version = '1.0.1'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
Run Code Online (Sandbox Code Playgroud)
gradle.settings文件:
include ':grpstd', ':grpc'
Run Code Online (Sandbox Code Playgroud)
grpc gradle.build:
apply plugin: 'antlr'
apply plugin: 'application'
apply plugin: 'kotlin'
mainClassName = 'sron.grpc.MainKt'
compileKotlin.dependsOn generateGrammarSource
generateGrammarSource {
arguments += ['-package', 'sron.grpc.compiler.internal']
}
dependencies {
antlr 'org.antlr:antlr4:4.5.2-1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'commons-cli:commons-cli:1.3.1'
compile 'org.ow2.asm:asm:5.0.4'
compile project(':grpstd')
testCompile 'junit:junit:4.12'
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}
Run Code Online (Sandbox Code Playgroud)
grpstd gradle.build:
apply plugin: 'kotlin'
dependencies {
compile …Run Code Online (Sandbox Code Playgroud) 我正在Linux上使用Cython构建一个独立的可执行文件.
我有以下代码:
import psycopg2 as pg
conn = pg.connect('dbname=**** user=**** password=****')
cur = conn.cursor()
cur.execute('SELECT version()')
print(cur.fetchone())
Run Code Online (Sandbox Code Playgroud)
问题是当机器没有安装Python软件包psycopg2时,抛出以下异常:
Traceback (most recent call last):
File "test.py", line 2, in init test (test.c:872)
import psycopg2 as pg
ImportError: No module named 'psycopg2'
Run Code Online (Sandbox Code Playgroud)
我正在建设使用--embedcython标志.
我怎样才能让Cython编译那个特定的包呢?
例如:
int main(void) {
Int i = Int(3); //3-bit integer
i = 1; //Represented as: 001
}
Run Code Online (Sandbox Code Playgroud)