Snow Leopard では NFS mount の指定方法がまた変わった。
ディスクユーティリティ: ファイル > NFS マウント
から指定する。これで最後かな。
Snow Leopard では NFS mount の指定方法がまた変わった。
ディスクユーティリティ: ファイル > NFS マウント
から指定する。これで最後かな。
2台目の MacBook を買ったので、久し振りに Synergy でも設定してみるかと 意気込んでみたものの、Snow Leopard でどうにも動かない。マウスは共有できるものの 、キーボードの入力が共有されない。 メンドクセーなーと調べていると、最近は teleport なるものが流行りらしい。
http://abyssoft.com/software/teleport/
うん、やりたかったことが全て解決。
Mac - Win な共有はできないけど、Windows は VMware Fusion で済ませているので関係ない。
Mac OSX 10.6.2, teleport 1.0.2 で順調に動作しています。
genshi とはテンプレートエンジンの一つ。 trac の見栄えを変更する必要があって色々調べてたけど、なかなかてごわい。
で、調べたことをちょっとずつメモ。
<py:with="..."> ... とかの意味:
http://genshi.edgewall.org/wiki/Documentation/xml-templates.html
Wondows Product Key Vie http://www.rjlsoftware.com/software/utility/winproductkey/download.shtml
これで現状のプロダクトキーを表示できるそうな。
loepard には apache が付属していますが、httpd.conf を数行書き換えるだけで WebDAV server として動作します。便利っす。
edit /private/etc/apache2/httpd.conf (snip) # Include /private/etc/apache2/extra/httpd-dav.conf .... コメントインする。
/private/etc/apache2/extra/httpd-dav.conf を見て、 DavLockDB, uploads directory, password file を作る。
システム環境設定から apache を起動
実は release と delete の違いがよく分からなかったんだけど、実はどうってことなかった。
http://en.wikipedia.org/wiki/DejaGnu
面白そう。ちょっと調べてみよう。
QMTest とかも見つけたけど、どうなんだろう?
http://www.codesourcery.com/qmtest
http://archives.free.net.ph/message/20061116.152652.ffd356bb.ja.html に 2 つを比較している話題があった。
setup.py 使うほどでもないライブラリのインストール。
python -m py_compile hogelib.py
で、できた *.pyc を site-packages とかにコピー。
最適化は -O オプション。
クラウド、という言葉は嫌いだけど、こういうアプローチは面白い。
クヌース先生の、tex のバグを見つけたら小切手、を大規模にしたようなもんか。
しかも割と成功しているみたい。日本でもサービスしてないのかな。
testlink はドキュメントと UI がイケてないと思う。 なんかすごいらしいって聞いて、インストールしたまではいいけど、この後どうしようも なくなちゃうんじゃないかな。
で、とっつきにくさの原因の一つは、用語の定義が抽象的で分かりにくい、だと 思うので、windows を例にまとめてみた
ここから質的に変わる。
NSOutlineView で最低限実装しなければならないメソッドは4つ。
#import <cocoa.h> @interface DataSource : NSObject { IBOutlet NSOutlineView *outlineView; } @end
#import "DataSource.h" @implementation DataSource // Data Source methods - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { NSLog(@"[numberOfChildrenOfItem] item:%@", item); return (item == nil) ? 2 : 2; } - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { NSLog(@"[isItemExpandable] item:%@", item); return ([item length] == 6) ? YES : NO; } - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item { NSLog(@"[child ofItem] index:%d item:%@", index, item); if (item == nil) { NSString *string = [[NSString alloc] initWithFormat:@"root-%d", index]; return string; } else { NSString *string = [[NSString alloc] initWithFormat:@"%@-%d", item, index]; return string; } } - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { NSLog(@"[objectValueForTableColumnd] item:%@", item); return (item == nil) ? @"/" : @"fuga/"; } @endBlogger Syntax Highliter は Objective-C に対応してないのね。がっくし。
とりあえずこの 3 つをおさえておけば大丈夫そう。
あまりにも testlink を持ち上げる人が多くて忌避していたんだけど、いろんな圧力に 負けて使ってみることにした。
で、testlinkjp.org の How to install がこれまたなえる内容だったので、 まとめなおしておこう。
日本語化はユーザの管理からlocaleをjapanにすることで変更できた。
$wspace cat.ws hogehoge # ユーザの入力 hogehoge # echo
0をstackにpush (読み込みデータを置くheapのアドレス) Read a character or a number 0をstackにpush (読み込みデータを置いたheapのアドレス) heap から retrieve
class Blogger: def __init__(self, email, password): # Authenticate using ClientLogin. self.service = service.GDataService(email, password) self.service.source = 'blogger.py-1.0' self.service.service = 'blogger' self.service.account_type = 'GOOGLE' self.service.server = 'www.blogger.com' self.service.ProgrammaticLogin() # Get the blog ID for the first blog. feed = self.service.Get('/feeds/default/blogs') self_link = feed.entry[0].GetSelfLink() if self_link: self.blog_id = self_link.href.split('/')[-1] def createPost(self, title, content, author_name, label, is_draft=False): # Create the entry to insert. entry = gdata.GDataEntry() entry.author.append(atom.Author(atom.Name(text=author_name))) entry.title = atom.Title(title_type='html', text=title) entry.content = atom.Content(content_type='html', text=content) if label: entry.category.append(atom.Category(term=label, scheme="http://www.blogger.com/atom/ns#")) if is_draft: control = atom.Control() control.draft = atom.Draft(text='yes') entry.control = control # Ask the service to insert the new entry. return self.service.Post(entry, '/feeds/' + self.blog_id + '/posts/default')ほとんど blogger api に付属のサンプルコードそのままなんですが、これを次のように使います。
from gdata import service import gdata import atom import os import re import sys from ConfigParser import SafeConfigParser from optparse import OptionParser from tempfile import NamedTemporaryFile PasswdFile = os.path.join(os.environ.get('HOME'), '.password') def sub_url(text): pattern = r''' \b ( (https?|ftp):[\w/#~:.?+=&%@!\-]+? ) (?= [.:?\-]* (?:[^\w/#~:.?+=&%@!\-] | $) )''' regex = re.compile(pattern, re.IGNORECASE|re.VERBOSE) result = regex.sub(r'\1', text) return result def createBlogData(): # edit temp blog data file temp_file = NamedTemporaryFile(suffix='.txt', prefix='blogger_py') editor = os.environ.get('EDITOR') if editor == '': editor = 'vi' # XXX: default stat = os.spawnlp(os.P_WAIT, editor, editor, temp_file.name) if stat != 0: raise EditError, 'edit tempfile failed: %s %s' % (editor, temp_file.name) # read blog data from temp file, publish a public post. title = temp_file.readline().rstrip('\r\n') label = temp_file.readline().strip() if label == '': _title = title.split(':') # title == 'LABEL: string' if len(_title) >= 2: label = _title[0] content = temp_file.read() author_name = "zakkie3" content = sub_url(content) title = title.decode('euc-jp') content = content.decode('euc-jp') temp_file.close() # temp_file will delete automatically return title, content, author_name, label def main(): email = '' password = '' author = '' # parse passord file cParser = SafeConfigParser() is_exists = cParser.read(PasswdFile) if is_exists and cParser.has_section('blogger.py'): if cParser.has_option('blogger.py', 'email'): email = cParser.get('blogger.py', 'email') if cParser.has_option('blogger.py', 'password'): password = cParser.get('blogger.py', 'password') if cParser.has_option('blogger.py', 'author'): author = cParser.get('blogger.py', 'author') # parse command-line options oParser = OptionParser() oParser.add_option("-e", "--email", dest="email", help="E-mail address"); oParser.add_option("-p", "--password", dest="password", help="E-mail address"); oParser.add_option("-u", "--author", dest="author", help="Blog author"); oParser.set_description('follow options can be set by ~/.password.') option, args = oParser.parse_args() if option.email: email = option.email if option.password: password = option.password if option.author: author = option.author if email == '' or password == '' or author == '': oParser.print_help() sys.exit(2) blogger = Blogger(email, password) title, content, label = createBlogData() blogger.createPost(title, content, author, label)~/.password に blogger のアカウント情報を以下のように書いておきます。
label = "hoge" entry = gdata.GDataEntry() entry.author.append(atom.Author(atom.Name(text=author_name))) entry.title = atom.Title(title_type='html', text=title) entry.content = atom.Content(content_type='html', text=content) if label: entry.category.append(atom.Category(term=label, scheme="http://www.blogger.com/atom/ns#"))
#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
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')
>>> a = [0,1,2,3] >>> for i, value in enumerate(a):