Xephyr 使用方法

Xephyr is a X server that runs as a small window within your current X session.

Xephyr 是一个 Xnest 的替代产品,因为 Xnest 不提供现代 X server 的一些高级特性,比如图形加速的支持。简而言之,Xephyr 是一个 X server,但是 它执行在一个存在的 X server 里面,这个可以用来做很多事情,比如需要通 过 XDMCP 连接到另外一台主机,那么不需要另外打开一个新的 X server;又 比如正在写一个 window manager,那么在一个 X server 里面打开的 X server 里面调试,将会比直接在现有的 X server 里面替换现有的 window manager 方便很多。对于热衷于更换自己的 window manager 的狂热爱好 者,Xephyr 提供了绝佳的试验环境。右图是我在 arch 下的 gnome-desktop 中的 Xephyr,其中开了个 awesome。

Mysql 最小化资源配置

小内存 vps 很多,有时我们只是用来安装一个博客而已,但是 MySQL 默认的配置比较迟资源

Setting Default Minimum
innodb_buffer_pool_size 128M 5M
innodb_log_buffer_size 1M 0
query_cache_sizequery_cache_size 1M 0
max_connections 151 1(although 10 might be more reasonable)
key_buffer_size 8388608 8
thread_cache_size (autosized) 0
host_cache_size (autosized) 0
innodb_ft_cache_size 8000000 1600000
innodb_ft_total_cache_size 640000000 32000000
thread_stack 262144 131072
sort_buffer_size 262144 32K
read_buffer_size 131072 8200
read_rnd_buffer_size 262144 8200
max_heap_table_size 16777216 16K
tmp_table_size 16777216 1K
bulk_insert_buffer_size 8388608 0
join_buffer_size 262144 128
net_buffer_length 16384 1K
innodb_sort_buffer_size 1M 64K
binlog_cache_size 32K 4K
binlog_stmt_cache_size 32K 4K

PHP SQLite 函数库

PHP SQlite 数据库对于拥有相当经验的 PHP 程序员来说是不会陌生的,但是要想完全掌握 PHP SQlite 数据库的相关函数的应用也不是一件易事。下面为大家总结一些 PHP SQlite 数据库的相关函数。

sqlite_array_query

// 发送一条 SQL 查询,并返回一个数组。

sqlite_unbuffered_query

// 发送一条 SQL 查询,并不获取和缓存结果的行。

sqlite_busy_timeout

PHP SQLite 示例

介绍下 SQLite API 所支持的重要方法,提供一个能够用在你开发中的简单脚本模板,从而告诉你如何使用 PHP 与 SQLite 数据库进行交互操作。假设你已经安装好了 (Apache/nginx) & PHP。

你的系统上并不是一定非要安装可交互的 SQLite 程序;但是为了能够简化创建本教程所需要的一系列初始表格,你应该下载和安装这个程序。然后,为你的 SQL 查询创建一个示例表格,方法是创建一个空白的文本文件,将该文件名作为下列命令(列表A)的参数在交互命令提示符下执行二进制程序:

sqlite> CREATE TABLE users (id INTEGER PRIMARY KEY, username TEXT, country TEXT);
sqlite> INSERT INTO users VALUES (1, 'john', 'IN');
sqlite> INSERT INTO users VALUES (2, 'joe', 'UK');
sqlite> INSERT INTO users VALUES (3, 'diana', 'US');

SELinux 基本用法

看了很多网络上有关于 SELinux 的文章以及到书店去翻了一下有提到 SELinux 的 Linux 书籍。看完了的感觉不是很好,几乎都沒提到什么是 SELinux?SELinux 的运作机制是什么?

大部份提到的解决办法,都是 “停用 SELinux”,这样也只不过是治标而不是治本的方法。

SELinux 的配置

/etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted