小编cod*_*er5的帖子

无法启动postgresql.service?

我正在使用arch linux(4.8.13-1-ARCH).我正在尝试按照此处的说明设置PostgreSQL .

演出结束后

[postgres@BitBox ~]$ initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers …
Run Code Online (Sandbox Code Playgroud)

postgresql archlinux systemd

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

显示控制器和VGA兼容控制器有什么区别?

以下是我的Arch linux终端上的lscpci命令的输出。我正在使用Lenovo G 50-70笔记本电脑。

[code_master5@BitBox ~]$ lspci
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04)
00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation …
Run Code Online (Sandbox Code Playgroud)

linux drivers

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

Python:列表 vs 字典 vs 集合

“什么数据结构——集合、列表或字典——在 Python 中你会用来存储 1000 万个整数?查询操作包括找到一个数字在给定集合中出现的次数。最坏情况下的时间和空间复杂度是多少?所有的情况?”

这是一个样本面试问题。什么是最合适的答案?

data-structures python-3.x

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

在多线程环境中使用 SQLAlchemy 执行事务

我正在开发一个使用 Flask、SQLAlchemy 和 PostgreSQL 的应用程序。我必须编写一个在数据库上执行多个查询的事务。

def exec_query_1():
    with db.engine.connect() as connection:
        connection.execute(#some-query)

def exec_query_2():
    with db.engine.connect() as connection:
        connection.execute(#some-query)

def exec_query_3():
    with db.engine.connect() as connection:
        connection.execute(#some-query)

def execute_transaction():
    with db.engine.connect() as connection:
        with connection.begin() as transaction:
            exec_query_1()
            exec_query_2()
            exec_query_3()
Run Code Online (Sandbox Code Playgroud)

鉴于应用程序是多线程的,这段代码会按预期工作吗?如果是,怎么办?如果不是,那么使其发挥作用的正确方法是什么?

python postgresql sqlalchemy flask-sqlalchemy

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