回归LAMP一些设置以及Django设置

Lighttpd 确实不错速度很快,可惜因为不支持Apache的.htaccess
这个情况直接导致原先的项目启动有问题
无奈只好将其删除换成Apache

回头看了下自己以前在W3POP写的东西,还是可以使用的,因为没装php的mod所以还是打算用fcgi来支持PHP
然后安装Apache 的时候很惊奇的发现默认的是使用mpm_work模式,很好。

原来可以用a2enmod来激活一些放在mod-avariable下面的模块,当然使用ln -s的方式也是可以的
把默认的site default删除掉,加入自己的虚拟主机设置文件

在fcgid.conf下面加入

<IfModule mod_fcgid.c>
  AddHandler fcgid-script .php .py .pl .fcgi
  IPCConnectTimeout 20
</IfModule>  

httpd.conf里面加入

<Directory />
        FCGIWrapper /usr/bin/php5-cgi .php
        Options ExecCGI SymLinksIfOwnerMatch
</Directory>

关于Django的设置
其实ubuntu 9.04里面的版本满新了,直接install一下就可以。
如果要加入支持mysql可以现安装一个python-setuptools,然后用easy_install MySQL-python
一下感觉轻松加愉快阿,呵呵

Add a comment

KUbuntu9.04 工作环境搭建备注

关于字体
将字体文件放在 ~/.fonts/ 下就可以
设置中文显示优先级则在 /etc/fonts/conf.d 下29,69,99这几个

关于网络设置
Kde4自带的那个绝对有问题,上手不能联网的会比较麻烦需要手动修改network的interface
拨号的话就pppoeconf吧,还算比较简单。
开关命令是:pon dsl-provider 跟 poff dsl-provider
局域网手动设置的例子:

auto eth0
iface eth0 inet static
address xxxxxxxx
netmask xxxxxxx
gateway xxxxxxxx

还得在 /etc/resolv.conf加个nameserver xxxxxx指向DNS服务器

ssh登录跟sshftp
其实是可以用自带的openssh终端连接的,但我怎么实验都没有成功指定了publickey一直显示密码错误,用putty解决吧,sshftp则可以用FIlezilla满强大的。

关于945gm很卡
换了新的2.6.30基本很流畅,下载地址:
http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30/linux-headers-2.6.30-020630-generic_2.6.30-020630_i386.deb
http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30/linux-headers-2.6.30-020630_2.6.30-020630_all.deb
http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.30/linux-image-2.6.30-020630-generic_2.6.30-020630_i386.deb
http://mirrors.kernel.org/ubuntu/pool/main/w/wireless-crda/wireless-crda_1.7_i386.deb

LLMP
开启两个模块,重写的模块可以在conf里去注释

#apt-get install lighttpd lighttpd-doc
#lighty-enable-mod fastcgi simple-vhost
#/etc/init.d/lighttpd force-reload

在conf-enabled里面修改simple-vhost.conf,下面是参照

## Simple name-based virtual hosting
##
## Documentation: /usr/share/doc/lighttpd-doc/simple-vhost.txt
##                http://www.lighttpd.net/documentation/simple-vhost.html
	
server.modules += ( "mod_simple_vhost" )
	
## The document root of a virtual host isdocument-root =
##   simple-vhost.server-root + $HTTP["host"] + simple-vhost.document-root
simple-vhost.server-root         = "/home/linyu/www"
simple-vhost.document-root       = "/default"
	
## the default host if no host is sent
simple-vhost.default-host        = "localhost"
	
$HTTP["host"] == "zjunion" {
server.document-root = "/home/linyu/www/zjunion/html"
server.errorlog = "xxxxxxx"
accesslog.filename = "xxxxxxx"
}

MYSQL

#apt-get install mysql-server

默认UTF8
my.cnf

[client]
character-set-server=utf8
collation-server=utf8_general_ci
default-character-set=utf8

PHP5

#apt-get install php5-cgi php5-sqlite php5-mysql

Add a comment

WinXP优先使用物理内存(禁用虚拟内存PageFile)

1. C:\WINDOWS\system.ini打开然后在最底下加一行参数ConservativeSwapfileUsage=1

2. CMD -> regedit

寻找HKEY_LOCAL_XXX\SYSEM\CurrentControlSet\Control\SessionManager\Memory Management点选Memory Management机码后请到右边寻找DisablePagingExecutive鼠标器点两下,把框框里原本的”0”改成”1”右边选十六进位。

Add a comment

Windows下Xdebug & Cachegrind

XDebug 官方网站为:http://www.xdebug.org/
下载的时候请注意跟自己的PHP版本匹配

.dll文件改成php_xdebug.dll,在php.ini中加入

extension=php_xdebug.dll
[XDebug]
zend_extension_ts="yourpath\ext\php_xdebug.dll"
xdebug.profiler_enable="on"
xdebug.trace_output_dir="yourpath\xdebug-trace" 
xdebug.profiler_output_dir="yourpath\xdebug-profile"

wincachegrind下载地址:http://sourceforge.net/projects/wincachegrind/

Add a comment

PostgreSQL笔记(SQL语言注意点)

连接查询
注意区别以下三种情况

SELECT *
    FROM weather, cities
    WHERE city = name;
SELECT *
    FROM weather 
    LEFT OUTER JOIN cities ON (weather.city = cities.name);
SELECT W1.city, W1.temp_lo AS low, W1.temp_hi AS high,
    W2.city, W2.temp_lo AS low, W2.temp_hi AS high
    FROM weather W1, weather W2
    WHERE W1.temp_lo < W2.temp_lo
    AND W1.temp_hi > W2.temp_hi;

在聚集函数使用下WHERE 和 HAVING 的基本区别
WHERE 在分组和聚集计算之前选取输入行(它控制哪些行进入聚集计算),而 HAVING 在分组和聚集之后选取输出行。因此,WHERE 子句不能包含聚集函数;因为试图用聚集函数判断那些行将要输入给聚集运算是没有意义的。相反,HAVING 子句总是包含聚集函数。当然,你可以写不使用聚集的 HAVING 子句,但这样做没什么好处,因为同样的条件可以更有效地用于 WHERE 阶段。

Add a comment