BRENDAのWebserviceを使う
酵素情報データベースBRENDAは今年から結構まともなWebserviceを提供している。
http://www.brenda-enzymes.info/soap/
上記ページではPHPとPythonでの使用例を挙げてくれている。
Pythonからの使用例中では大概返ってくる型がdictionaryになっているのだが、自分がやってみたところ、SOAPのオブジェクトがリストで返ってくる。
そこで下記のような関数を噛ませる必要があるように思うので晒します。
from SOAPpy import WSDL wsdl = 'http://www.brenda-enzymes.org/soap/brenda.wsdl' serv = WSDL.Proxy(wsdl) def getDic(soap_object): attributes = getattr(soap_object, 'item') dictionary = {} for attribute in attributes: key = getattr(attribute, 'key') value = getattr(attribute, 'value') dictionary[key] = value return dictionary soap_objects = serv.getKeggPathway({'ecNumber':'1.1.1.2'}) results = [] for soap_object in soap_objects: dic = getDic(soap_object) results.append(dic) print results
BRENDAはなぜdictionaryが返ってくると言っているのだろう?
SOAPオブジェクトが返ってくるのオレの環境だけ?
MoinMoin でユーザ作成を制限する
いろいろあるぽいが下記リンクの設定方法が一番楽と思った。
http://moinmo.in/FeatureRequests/DisableUserCreation#Solution_for_1.7
wikiconfig.pyに以下の内容を挿入する。
# stop new accounts being created actions_excluded = DefaultConfig.actions_excluded + ['newaccount']
以上。
Prism を使ってみた
vimperatorを使いつつGmailやGoogle Readerは素のキーボードショートカットで使いたいという人に便利かもしれない。
http://prism.mozilla.com/
使い方は
http://docs.google.com/
などでメニューバーのツールからConvert Website to Applicationをクリックするだけ。
チェックボックスの意味が理解できないと安心できないのは私だけではないでしょう。
私は以下のドキュメントを読んで理解できたような気がします。
https://wiki.mozilla.org/Prism/Config
ここまで書いておきながら何なんですが、手前のubuntu 64bit環境では上述の方法では動作しませんでした。
Desktopディレクトリがデスクトップという名前になってるのが問題なのかな? と考え
http://d.hatena.ne.jp/kozo-ni/20090228#1235769514
のようなことをやりましたが、それでも駄目でした。
stand alone版とかも解凍して中ちょろっと見たりしましたけど面倒くさくなってやめてしまいました。
もしかするとどっかに元々Linuxサポートしてないとか書いてるのかもしれない。
(追記)
下記リンク先の説明通りにやるとubuntuでも使えるようになりました。
Processing の examples その9 (Basics-Data-DatatypeConversion)
こど
/** * Datatype Conversion. * * It is sometimes beneficial to convert a value from one type of * data to another. Each of the conversion functions converts its parameter * to an equivalent representation within its datatype. * The conversion functions include int(), float(), char(), byte(), and others. */ size(200, 200); background(51); noStroke(); char c; // Chars are used for storing typographic symbols float f; // Floats are decimal numbers int i; // Ints are values between 2,147,483,647 and -2147483648 byte b; // Bytes are values between -128 and 128 c = 'A'; f = float(c); // Sets f = 65.0 i = int(f * 1.4); // Sets i to 91 b = byte(c / 2); // Sets b to 32 rect(f, 0, 40, 66); fill(204); rect(i, 67, 40, 66); fill(255); rect(b, 134, 40, 66);
Processing の examples その8 (Basics-Control-EmbeddedIteration)
こうど
/** * Embedding Iteration. * * Embedding "for" structures allows repetition in two dimensions. */ float box_size = 11; float box_space = 12; int margin = 7; size(200, 200); background(0); noStroke(); // Draw gray boxes for (int i = margin; i < height-margin; i += box_space){ if(box_size > 0){ for(int j = margin; j < width-margin; j+= box_space){ fill(255-box_size*10); rect(j, i, box_size, box_size); } box_size = box_size - 0.6; } }
出力
my訳
noStroke()までは省略
forループでxy座標を共にbox_spaceごとに移動しておるイメージ
jがx、iがyに対応してる
スタートは(7,7)から
yに12ずれる毎に濃さを段々白く、rect()をwidthとheightちっちゃくして書いてる
ふう。
Processing の examples その7 (Basics-Control-Conditionals2)
コードじゃ
/** * Conditionals 2. * * We extend the language of conditionals by adding the * keyword "else". This allows conditionals to ask * two or more sequential questions, each with a different * action. */ size(200, 200); background(0); for(int i=2; i<width-2; i+=2) { // If 'i' divides by 20 with no remainder // draw the first line else draw the second line if(i%20 == 0) { stroke(255); line(i, 40, i, height/2); } else if (i%10 == 0) { stroke(153); line(i, 20, i, 180); } else { stroke(102); line(i, height/2, i, height-40); } }
これが出るのじゃ。
コードをオレオレ日本語翻訳すると
黒背景にセット後
xが20刻みのとこでyが40から真ん中まで真っ白の線を引いて
xが10刻みだったらちょい灰色っぽくしてyが20から180のとこまで線を引いて
それ以外の2刻みのxのとこでさらに線色を黒っぽくしてyが半分から160まで線引く。
さいなら。
Processing の examples その6 (Basics-Control-Conditionals1)
コード
/** * Conditionals 1. * * Conditions are like questions. * They allow a program to decide to take one action if * the answer to a question is true or to do another action * if the answer to the question is false. * The questions asked within a program are always logical * or relational statements. For example, if the variable 'i' is * equal to zero then draw a line. */ size(200, 200); background(0); for(int i=10; i<width; i+=10) { // If 'i' divides by 20 with no remainder draw the first line // else draw the second line if(i%20 == 0) { stroke(153); line(i, 40, i, height/2); } else { stroke(102); line(i, 20, i, 180); } }
コレ出る
キャンバスの横10刻みでline()使って線を引いている。
20毎で線の色を白に近づけてy=40から画面の真ん中まで引いてる。