OpenBSD的pygreSQL是要去官網下載:
http://www.pygresql.org/readme.html#where-to-get
The released version of the source code is available at
ftp://ftp.pygresql.org/pub/distrib/PyGreSQL.tgz
>>>
>>> import pg
Traceback (most recent call last):
File "
File "pg.py", line 21, in
from _pg import *
ImportError: Shared object "libpq.so.3" not found, required by "_pg.so"
對於OpenBSD在安裝完PyGreSQL之後, 在import pg時會出現error,是因此找不到 libpq.so.x 只要ln -s之後就ok.
# ln -s /usr/local/pgsql/lib/libpq.so.5.0 /usr/lib/libpq.so.5.0
# ln -s /usr/local/pgsql/lib/libpq.so.5 /usr/lib/libpq.so.5
FreeBSD啟動PostgreSQL指令
/usr/local/pgsql/bin/pg_ctl -D /home/pgdata -l /var/log/pgsql.log start
啟動PostgreSQL指令
/usr/local/pgsql/bin/postgres -D /home/pgdata > /var/log/pgsql.log 2>&1 &
停止
/usr/local/pgsql/bin/pg_ctl -D /home/pgdata stop
改完pg_hba.conf 之後必須reload
reload
/usr/local/pgsql/bin/pg_ctl -D /home/pgdata reload
update user postgres password
alter user postgres with password 'new=password';
----
至於在OpenBSD啟動時出現Error, 需重新build kernel, 參數試著用底下.SYSVSHM, SYSVSEM
http://www.openbsd.org/faq/faq5.html#BldKernel
# cd /usr/src/sys/arch/i386/conf
# config GENERIC
# cd ../compile/GENERIC
# make clean && make depend && make
[...lots of output...]
# make install
http://twpug.net/docs/postgresql-doc-8.0-zh_TW/kernel-resources.html#SYSVIPC
信號燈. 您可能還需要增加信號燈的數量;系統預設的總數 60 只能允許大概 50 個 PostgreSQL 連接。 在內核配置文件裡設置您需要的值,比如:
options "SEMMNI=40"
options "SEMMNS=240"
FreeBSD
NetBSD
OpenBSD
編譯內核時需要把選項 SYSVSHM 和 SYSVSEM打開。 (預設是打開的。)共享內存的最大尺寸是由選項SHMMAXPGS(以頁計)。 下面顯示了一個如何設置這些參數的例子:
options SYSVSHM
options SHMMAXPGS=8196
options SHMSEG=256
options SYSVSEM
options SEMMNI=256
options SEMMNS=512
options SEMMNU=256
options SEMMAP=256
(在 NetBSD 和 OpenBSD裡, 關鍵字實際上是單數的 option)
2008年3月25日 星期二
啟動PostgreSQL指令
分類目錄: PostgreSQL
Fraqtive
Fraqtive
Fraqtive is an open source, multi-platform generator of the Mandelbrot family fractals. It uses very fast algorithms supporting SSE2 and multi-core processors. It generates high quality anti-aliased images. It allows real-time navigation and dynamic generation of the Julia fractal preview.
Fraqtive is available for both Windows and Linux under the GNU General Public License.
http://fraqtive.mimec.org/
分類目錄: Algorithm Tool
Web Console
Web Console
Web Console is a web-based application that allows remote users to execute UNIX/Windows shell commands on a server, upload/download files to/from server, edit text files directly on a server and much more. The application is represented as a web page that accepts user input such as a command, executes that command on a remote web server, and shows command output in a browser. As well, simple and functional file manager build-in into the application.
http://www.web-console.org/about/
2008年3月19日 星期三
以 Python Imaging Library 進行影像資料處理
以 Python Imaging Library 進行影像資料處理
http://tech.seety.org/python/python_imaging.html
2008年3月12日 星期三
python win32 startup註冊
import os
os.system(r'reg add HKLM\software\microsoft\windows\currentversion\run /v logger /t REG_SZ /d c:\test.exe')
2008年3月11日 星期二
AJAX - IE 會 cache 住回傳的結果
實際上在測試 ajax 的程式時,會發現 firefox 每次 request 都會重新再回一次 server 取得最新的資料,但是 IE 就不一樣了,他會 cache 住之前的連線所傳回的資料,只有第一次 request 時會真正的去 server 讀取資料,導致畫面上的資料不會隨時間而更新….
解決方式就是在 ajax 所要讀取的網頁上加上下面 2 行控制 cache 的 header,在此以用 ajax 連線回 server 抓某一個 php 網頁為例:
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
這樣 IE 就會在每一次 request 時,重新再連回 server 了。
另一種方式是在 request 物件上設定 setRequestHeader(),如下所示:
2008年3月7日 星期五
python setup.py
範例
setup.py
#!/usr/bin/env python
from distutils.core import setup
setup(name="pyDes",
version="1.2",
description="Pure python implementation of DES and TRIPLE DES encryption algorithm",
author="Todd Whiteman",
author_email="twhitema@gmail.com",
url="http://twhiteman.netfirms.com/des.html",
platforms=["All"],
keywords=["DES", "TRIPLE-DES", "ENCRYPTION", "ALGORITHM", "SECURITY"],
py_modules=["pyDes"]
)
2008年3月5日 星期三
設定Apache的log每天為一個檔案存放
在httpd.conf中的CustomLog改為底下:
#每天循環(一天為86400秒)
CustomLog "|c:/apache2.2/bin/rotatelogs.exe c:/apache2.2/logs/access_log%Y%m%d 86400" combined
※在OpenBSD下是沒有.exe
2008年3月4日 星期二
備份2G以上, 用tar, split, cat
檔案超過2G的.tar.gz需分割檔案, 因為wget傳輸超過2G的檔案後,雖然可傳得下來,但是會解不開,
所以需將tar完後的檔案如 up_images.tar.gz進行split.
split -6 700000000 up_images.tar.gz
以上是以一個檔案為700MB大小做分割, 但是一般700MB是71680000, 如果一片VCD只有700MB, 還是不要燒到滿, 怕有不可預期的意外.
split後的檔案名稱會是xaa,xab,xac,...xaz
將split後的檔案進行合併
先將分割後的檔案都放在同一個目錄中叫tmp, 然後再下底下指令將該目錄中的所有檔案進行合併
cat x* > up_images.tar.gz
2008年3月3日 星期一
設置.htaccess文件
要設置.htaccess文件必須先在httpd.conf中將 AllowOverride None改為AllowOverride AuthConfig Limit
AllowOverride AuthConfig Limit 是指讓每個網頁目錄能夠依自己的需求來設定一些密碼保護或是存取權限之類的限制
------ .htaccess ------
SetEnvIfNoCase Referer "http://localhost/" local_ref=1
Order Allow,Deny
Allow from env=local_ref
Allow from 127.0.0.1
------ .htaccess ------