2009年4月27日月曜日
cvs: merge, pullup
いまさらだけど、CVS の merge, pullup 方法についてまとめておく。
cvs diff -kk -c -r1.19 -r1.21 foo.c > patch
patch < patch
とするか、
cvs update -kk -j1.19 -j1.21 foo.c
とする。2つは同等の結果をもたらす。
$Id$ とかで patch があたらなくなるが、-kk でこれを回避できる。
あとは diff を確認して、問題なければ commit する。
http://www.netbsd.org/ja/developers/releng/howto-pullup.html
http://www.sodan.org/~penny/vc/cvs-ja_5.html
2009年4月22日水曜日
postfix: SMTP認証を使う (lenny編)
ハマった。
saslpasswd2 コマンドで認証DBが/etc/sasldbにできるが、debian のpostfixはchrootするため、これを参照できない。
cp -p /etc/sasldb /var/spool/postfix/etc とする必要がある。
以下のページが参考になった。
http://www.jp-z.jp/linux/postfix_tls.html
2009年4月9日木曜日
mac: nfs mount
Directory Utilityで "nfs://example.com/exports" "/Volume/hoge" の様に指定する。
resvport オプションが必要かもしれない。
resvport
Use a reserved socket port number. This is useful for mounting servers that require clients to use a reserved port number on the mistaken belief that this makes NFS more secure. (For the rare case where the client has a trusted root account but untrustworthy users and the network cables are in secure areas this does help, but for normal desktop clients this does not apply.)
misc: 常駐型サーバーのデバッグ手法(ドラフト版)
WEB+DB Press に掲載された記事のドラフトのようで。
http://kzk9.net/publications/webdb48/debug.html
2009年4月7日火曜日
python, cocoa: C から python のコードを利用する
http://www.python.org/doc/2.2.3/ext/high-level-embedding.htmlを参考に。
#include <Python.h> int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString("from time import time,ctime\n" "print 'Today is',ctime(time())\n"); Py_Finalize(); return 0; }- compile Leopard$ gcc -I/opt/local/include/python2.5 -L/opt/local/lib/python2.5/config -lpython2.5 -lm -lpthread -ldl -lutil -lreadline -ltermcap pytest.c -Wl,--export-dynamicが必要かも。 - run Leopard$ ./a.out Today is Tue Apr 7 01:25:52 2009
2009年4月3日金曜日
2009年4月2日木曜日
2009年4月1日水曜日
blogger: コードのハイライト
Blogger Syntax Hibhlibhter
参考: http://www.kuribo.info/2008/06/blogger-syntax-highlighter.html
python: 元の文字コードを自動判別して utf-8 に変換
http://www.freia.jp/taka/blog/571 で見付けた
def guess_charset(data): f = lambda d, enc: d.decode(enc) and enc try: return f(data, 'utf-8') except: pass try: return f(data, 'shift-jis') except: pass try: return f(data, 'euc-jp') except: pass try: return f(data, 'iso2022-jp') except: pass return None def conv(data): charset = guess_charset(data) u = data.decode(charset) return u.encode('utf-8')
python: loop counter
enumerate() を使うとループカウンタが簡単になる。
>>> a = [0,1,2,3] >>> for i, value in enumerate(a):
登録:
投稿 (Atom)