ときどきの雑記帖 3mm方眼紙編

最新ページへのリンク
目次ページへのリンク

一つ前へ 2011年2月(中旬)
一つ後へ 2011年3月(上旬)

ホームへ

2011年02月28日

■_

ブックドラフトが起きてアップロードしている余裕がなかったw

■_ 混ざってる混ざってる

無限の住人 沙村広明総合スレ 第四十一幕

33 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 23:57:29.08 ID:+mrNHFM50 Be:
    なんとかって数学者は肺を患っていたが、なんとかいう定理を証明した翌日決闘に行き負けて死んだ 

肺を患ってはアーベルで、決闘に行きはガロアだよねえ。 でもどちらも定理を証明した翌日ってこたないと思うけど。

■_ もしも

【ナポレオン】長谷川哲也31【アイゼンファウスト】

529 名無しんぼ@お腹いっぱい [sage] 2011/02/25(金) 13:44:24.35 ID:qaIUqpC50 Be:
    長谷川先生が描いた「皇国の守護者」を見てみたいとふと思った 

530 名無しんぼ@お腹いっぱい [sage] 2011/02/25(金) 14:19:30.67 ID:GnKi0brM0 Be:
    全裸で雪原を踏破する皇国兵とか胸熱だなw 

531 名無しんぼ@お腹いっぱい [sage] 2011/02/25(金) 14:47:02.66 ID:wuOZ26T70 Be:
    飯配ってた将校がいい味出しそうだな
    副官はまんまフェルニッヒ姉妹か 

532 名無しんぼ@お腹いっぱい [sage] 2011/02/25(金) 18:04:13.98 ID:I6kY53ms0 Be:
    >>526
    なるほど、ドイツ訛りだから「~だぁ」とか「~がぁ」とか濁音が多いのか 

533 名無しんぼ@お腹いっぱい [sage] 2011/02/25(金) 23:40:19.67 ID:UjkeiYLU0 Be:
    佐藤大輔って漫画家が思う通りに描かないとヘソ曲げて放り出すって噂なのに
    はせがー先生に描かせたら、連載第一話のネーム見ただけでエロゲの世界に深く没入しちまうぞ 

534 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 08:49:53.17 ID:UKkYp8tn0 Be:
    >>530
    もしも八甲田山の行軍がスヴォーロフ指揮だったら・・・ 

535 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 09:47:11.72 ID:UX25R9MF0 Be:
    新城直衛とはせがーのナポは内面的に結構似てると思うので
    仮にナポのキャラそのままに新城を描いたとしても違和感があまりなさそうだ 

536 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 10:44:25.02 ID:cuvLdoGY0 Be:
    やめてくれ 

537 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 11:09:30.69 ID:jy+89EK/O Be:
    >>533
    放置を良いことに
    好き勝手やり始めるはせがー先生 

538 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 11:13:37.63 ID:pQhcEAZ40 Be:
    皇国軍は史上最強ォォォ 

539 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 11:54:18.59 ID:JOkAcGz90 Be:
    >>535
    新城は人を従えることを喜んだりはしないし
    ナポは敵将の前で小胆を認めて震える手を晒したりしないだろ。 

540 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 12:22:22.28 ID:5paS2Squ0 Be:
    はせがーナポは大胆不敵な自信家で内省的でも自虐的でもないしなあ
    艦隊ボコボコにされても風呂で絶叫したらもう立ち直ってるし超人的タフネス 

541 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 13:49:30.88 ID:UX25R9MF0 Be:
    >>539>>540
    そうやって挙げてみると全然違った件
    似てると感じたのは軍勢を操る指揮官としての才能的なものだったかな 

542 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 14:28:42.99 ID:Jjp/13wa0 Be:
    士官学校で散々いじめられて、機会が到来するといじめたヤツラに対して
    徹底的に復讐したがるのは似ている 

543 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 14:32:09.83 ID:wBpw65y50 Be:
    粘着質なところか 

544 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 14:54:41.28 ID:2CTEOwd/0 Be:
    そうか?あくまで戦況判断で愚図を見殺しにしただけだろ、新城は。恨みが先ではない。
    笹嶋にも状況が仕方なかったと許してるぐらいに客観性ある。

    ナポレオンみたいな新城だとしたら欲得も恨みもものすごいエネルギー発散しそうだが。 

545 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 14:56:45.39 ID:LK9FyEea0 Be:
    今のボニーは恨みよりとにかく野心だな
    フェリポーに復讐したい気持ちもあったが現実とすりあわせて撤退したわけだし 

546 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 15:10:18.67 ID:5jUHUnst0 Be:
    こういう話は軍板のデブスレでやろうよ 

547 名無しんぼ@お腹いっぱい [sage] 2011/02/26(土) 16:35:44.32 ID:cuvLdoGY0 Be:
    まったくだ 

漫画版の皇国の守護者があそこで終わっちゃったのはなあ。 とはいえ次に切りがいいところと言うとなかなかないのだけど。

■_ 解禁

liftの意味が最初わからなかったw

Let s get PEP 380 into Python 3.3

From: Guido van Rossum <guido <at> python.org>
Subject: Let's get PEP 380 into Python 3.3
Newsgroups: gmane.comp.python.devel
Date: 2011-02-25 22:43:01 GMT (2 days, 15 hours and 45 minutes ago)

Now that the language moratorium is lifted, let's make sure to get PEP
380 implemented for Python 3.3. I think there are some minor issues to
be resolved, but I don't think that should stop someone from doing a
first pass of the implementation (especially since a version for 2.6
already exists).

(OTOH I am not much enamored with cofunctions, PEP 3152.)

-- 
--Guido van Rossum (python.org/~guido)

liftの意味 - 英和辞書 - goo辞書

2 〈禁止令・税金などを〉撤廃する;〈封鎖・妨害などを〉解く;〈砲火を〉一時中止する;〈痛みなどを〉取り除く

なるほどね。

結構盛り上がってます Guido van Rossum: Let s get PEP 380 into Python 3.3 : Python

■_

2011年02月27日

■_

・J
10万円切るところもあるのかあ。うむむ。 価格.com - パナソニック Let's note J10 CF-J10PYAHR [シフォンホワイト] 価格比較

・積むや積まざるや(違)
まったく手をつけていないもの、ちょっとでも読んだもの含めて溜まってきてる
JavaScript: The Good Parts ―「良いパーツ」によるベストプラクティス 数学ガール/乱択アルゴリズム いかにして問題をとくか イシューからはじめよ―知的生産の「シンプルな本質」 逆説の日本史17 江戸成熟編 アイヌ民族と幕府崩壊の謎

・ビューティフルデータ
ざっと目を通したけど、 自分にとっては急いで買うものでもないなと判断してイベント用(ってなに)に。 DDDの翻訳本も近いしなあ。
ビューティフルデータ

・TAPL読書会
正直、これがいったいなんの役に立つのかと思わないでもない(笑)>今日やったところ

■_

ここ数日Jスレに地道に投稿が。

J言語 

86 デフォルトの名無しさん [sage] 2011/02/01(火) 21:48:23 ID: Be: 
 APLなら、 
 
 (0=3|x)/x←( ̄1+ι1+9) 
 
 ▲△△▲いまさらQUICK BASIC▲△△▲ 
 >>http://hibari.2ch.net/test/read.cgi/tech/1104072815/30 
 > BASICの最大の利点は、エディタと実行環境が一緒くたな所にある。 
 > 100 DEFINT A-Z 
 > 110 FOR I=0 TO 9 SKIP 3 
 > 120 PRIN I 
 > 130 NEXT 
 > run 
 > Syntax Error in 120 // エラーメッセージ適当w 
 > Ok 
 > 110 PRINT I 
 > run 
 > 0 
 > 3 
 > 6 
 > 9 
 > Ok 
 > この手軽さは今見てもすごくね? 
 
87 デフォルトの名無しさん [sage] 2011/02/17(木) 20:19:36 ID: Be: 
 +/や×/に相当するものは、伝統的な数学の記法ではΣとΠになりますね。 
 そして、それ以外の演算に対しては固有の記号は用意されていない。 
 
 Iversonの記法の/は、任意の演算に対してこれが拡張されている。 
 この拡張が必要なものだったかどうかには疑問符を付くかもしれないですね。 
 
88 デフォルトの名無しさん [sage] 2011/02/26(土) 03:00:23.16 ID: Be: 
 今日始めたので検索したらスレがあったw 
 まだまとめwikiとこのスレみただけの知識だが 
 
 fold / 
 filter (a cmp b) # b 
 無名関数は>>5 >>48 
 mapはどう書けばいい? 
 
 フック(単項)はSコンビネータ 
 フォーク(単項)はArrowだね 
 floor関数が組み込みにあるのをみるとなんか感慨深い 
 
89 デフォルトの名無しさん [sage] 2011/02/26(土) 03:08:37.56 ID: Be: 
 ああ、mapはf arrayでいいのか 
 
90 デフォルトの名無しさん [sage] 2011/02/26(土) 09:11:55.22 ID: Be: 
 まあ、learning J をざっと流し読みすれば大まかな姿がつかめると思うよ。 
 
91 デフォルトの名無しさん [sage] 2011/02/26(土) 09:21:32.00 ID: Be: 
 >>88-89 
 lisperの人ね。 
 Rのスレでは、なぜかRとschemeの類似点が強調される。 
 しかし、lispを使わない自分にはAPL系の言語にしか見えない。 
 
92 デフォルトの名無しさん [sage] 2011/02/26(土) 10:03:08.33 ID: Be: 
 floorとceilingってIversonが提唱したものだったんだ。 
 知らなかった。 
 HPやTIの電卓には普通にある。 
 消費税の切り捨てとか結構便利。 
 
93 デフォルトの名無しさん [sage] 2011/02/26(土) 10:21:08.78 ID: Be: 
 俺はバッカス先生のFunction Level Programmingが試せて 
 実用性もある言語ってことで使ってるけど、そっち方面からの 
 侵入者は少ないんだろうなw 
 
94 デフォルトの名無しさん [sage] 2011/02/26(土) 20:33:44.66 ID: Be: 
 >>93 
 > Function Level Programming 
 
 Wikipediaの日本語版にも載ってない概念。 
 翻訳して載せない? 
 
 variable-freeって、変数使わないってこと? 
 Jってそんなパラダイムの言語なの? 
 
 今までAPLの一方言みたいなイメージしかなかった。 
 APLは←(代入)とか→(goto)とか見るからにダサいけど。 
 
95 デフォルトの名無しさん [sage] 2011/02/26(土) 22:57:09.34 ID: Be: 
 wikipediaに書いてるのは百科事典的要約のようだし、あれを訳して 
 読むよりはバッカス先生のチューリング賞受賞講演を読む方がいいと思う。 
 (共立からでてた「ACMチューリング賞講演集」に翻訳が載ってる。) 
 
 Jでどうやってfuction level なスタイルで書くかはlearning Jのチャプター 
 8~11、14、15を読めばいいけど、結構前のチャプターの内容を 
 引用してるところ多いし、最初から読んだほうがいいと思う。 
 
 まあ、同じ人間がデザインした言語だけど、APLからJへ乗換える人 
 向けのチュートリアルとかアドバイスとかあるみたいだし、結構 
 違うんだろうな。 
 
96 デフォルトの名無しさん [sage] 2011/02/26(土) 23:34:42.44 ID: Be: 
 >>89 これかな、ありがとう 
 http://www.rogerstokes.free-online.co.uk/book.htm 
 しばらくはそこと、これを眺めながら文法を覚えてみる 
 http://www.jsoftware.com/help/dictionary/vocabul.htm
 
 自分が始めたのはGLSの影響から。 
 J=ポイントフリーって印象はあって 
 Haskellでポイントフリーになれたのでそろそろ挑戦してみようかなと 
 
 「ポイントフリーだから簡潔で読みやすい」←Haskellの人 
 「ポイントフリーだから簡潔で読みにくい」←Jの人(暗黙の定義について) 
 後者が真理だと思うw 
 
97 デフォルトの名無しさん [sage] 2011/02/26(土) 23:40:57.83 ID: Be: 
 >>95 
 > (共立からでてた「ACMチューリング賞講演集」に翻訳が載ってる。) 
 
 面白そうな本を紹介していただきました。 
 
 工学部のある大学の図書館なら置いてあるという次元の本ですね。 
 
 '66~'85なら、'79のIversonも含まれていますね。 
 
 他、ミンスキー、マッカーシー、ダイクストラ、クヌース、 
 ニューウェル、サイモン、コッド、ケン・トンプソン、リッチー、ヴィルト 
 誰でも知っているビッグネームが並んでます。 
 
98 デフォルトの名無しさん [sage] 2011/02/27(日) 01:05:23.15 ID: Be: 
 アイバーソンの講演も入ってた記憶が。 
 
 >>96 
 Haslellは知らんけど(GLSも知らない。人?)、Jで引数なしで書くのはそんなに難しくないと思う。 
 読むのはアレだが、それでも解らん定義があったら、コンソールに食わせるとBOXに入った形 
 で返してくるんで、それ見ればたいてい読める。 
 
99 デフォルトの名無しさん [sage] 2011/02/27(日) 08:58:24.73 ID: Be: 
 >>96はアンカみす、>>90宛 
 
 >>98 
 Guy L. Steele, Jrはschemeの作者の一人 
 今まで触ってきたのが2引数関数を2つ合成すると3引数になる世界だったので 
 フックにより二項→単項として扱われることがあるのと 
 演算子のオーバーロード(スカラー/アレイ/テーブル)が 
 色々と動作の理解の妨げになってる感じ 
 (2&* 1&+) i.10とか、想像を超えた動き 
 
 ところで、マニュアルの、なんか重要っぽい 
 "< _ 0 0"等の数値や_の意味がわかる人います? 
 http://www.jsoftware.com/help/dictionary/d010.htm
 
100 デフォルトの名無しさん [sage] 2011/02/27(日) 10:05:31.13 ID: Be: 
 その動詞がとる引数の次元(J用語では"rank")だな。 
 0~2はそのまんまの意味で、_は無限大(どんな次元の引数でも受付ける) 
 順番は(単項の場合)(二項の左引数)(〃右引数)の順番だったと思う。 
 
 で、そう言うのを定義するのに何の意味があるかというと、例えば3次元の引数を1次元の 
 引数を受付ける動詞に評価させようとすると、Jは自動的に引数を1次元の配列にバラして 
 その動詞に食わせる。これは(多分)全ての動詞に適用されるんで、オーバーロード 
 と言うよりは、Jそのものの仕組みとして覚えたほうがいいと思う。 
 
 詳しくはLJ(learning J)のチャプター7を見れば分かる。 
 
101 デフォルトの名無しさん [sage] 2011/02/27(日) 10:07:06.27 ID: Be: 
 んで、LJはオフラインでpdf版を使うほうが一括検索も効くし便利だと思う。 
 
  http://www.elliscave.com/APL_J/Learning_J.pdf 
 
102 デフォルトの名無しさん [sage] 2011/02/27(日) 10:40:19.44 ID: Be: 
 (2&* 1&+) i.10とか、想像を超えた動き 
 
 これは 2&* が 二項動詞になってるのが罠だな。 
 
 x 2&* y は2&*をyにx回適用するって意味になる。 
 例えば、 
 
 0 (2&*) 3 
 3 
 1 (2&*) 3 
 6 
 2 (2&*) 3 
 12 
 
103 デフォルトの名無しさん [sage] 2011/02/27(日) 23:04:29.70 ID: Be:
    >>100
    1足して2倍する動詞ということなら

    2&* @ (1&+) i.10
    2 4 6 8 10 12 14 16 18 20

    とか

    (2 * 1 + ]) i.10
    2 4 6 8 10 12 14 16 18 20

    かな。

チューリング賞の講演ってあの本に載っているより後のって翻訳されていないのだっけ? あの本も絶版のままにしておくのはもったいないと思うんだけどねえ。 といって数が出るような本でもないか。

■_ csv →

そいや、Python の csv ファイル読み取り速度が速いのを調べようと思って 手をつけたのをそのまま年単位で放置しているな。 途中まで追いかけたのだけどフローを見失ったんだっけか。 で。

Boostのfusionとspiritやばい - 名古屋313の日記


#include <fstream> 
#include <iostream> 
#include <vector> 
#include <boost/fusion/include/adapt_struct.hpp> 
#include <boost/range/algorithm/for_each.hpp> 
#include <boost/range/algorithm/transform.hpp> 
#include <boost/spirit/include/phoenix.hpp> 
#pragma warning(disable: 4819) // VCだと文字コードがどうとかうるさいので警告を消す 
#include <boost/spirit/include/qi.hpp> 
#pragma warning(default: 4819) 
#include <pstade/oven/copied.hpp> 
#include <pstade/oven/stream_lines.hpp> 
#include <pstade/oven/transformed.hpp> 
 
struct data { 
    std::string namae; 
    int wanryoku; 
    int kiyosa; 
    int subayasa; 
    int tairyoku; 
    int maryoku; 
    int seishin; 
    int miryoku; 
}; 
 
BOOST_FUSION_ADAPT_STRUCT( 
    data, 
    (std::string, namae) 
    (int, wanryoku) 
    (int, kiyosa) 
    (int, subayasa) 
    (int, tairyoku) 
    (int, maryoku) 
    (int, seishin) 
    (int, miryoku) 
) 
 
struct parse { 
    template <typename T> 
    struct result { 
        typedef data type; 
    }; 

    data operator ()(const std::string &x) const { 
        data d; 
        boost::spirit::qi::parse(x.begin(), x.end(), *(boost::spirit::qi::char_ - ",") >> "," >> 
        boost::spirit::qi::int_ >> "," >> 
        boost::spirit::qi::int_ >> "," >> 
        boost::spirit::qi::int_ >> "," >> 
        boost::spirit::qi::int_ >> "," >> 
        boost::spirit::qi::int_ >> "," >> 
        boost::spirit::qi::int_ >> "," >> 
        boost::spirit::qi::int_, d); 
       return d; 
   } 
}; 
 
int main() { 
    std::ifstream fin("data.csv"); 
    const std::vector<data> v = pstade::oven::stream_lines(fin) | pstade::oven::transformed(parse()) | pstade::oven::copied; 
    boost::for_each(v, [](const data &x) {
(略)

速度はどんなもんなんだろか。

■_ JavaScriptに乗り換え

reddit から。

Why I switched from Lua to Javascript : javascript
 
 1. The V8 implementation is free and on par with Lua's in terms of code quality.
    V8 の実装は free であり、コードの質も Lua のそれに匹敵するものである。

 2. Javascript is everywhere there is a browser. Lua could be, but at this point, why?
    JavaScript はブラウザーのあるところならどこにでもある。
    この点において Lua はどうだろうか?

 3. {} vs begin/end. I grew up on C programming. My affinity for {} is too strong
    {} と begin/end 対。わたしはもっぱら C でプログラミングをしてきたので
    {} の方がずっとしっくりくる。

 4. 0 vs 1 based arrays. This one, while well intentioned, seems to break a lot of
    basic ideas in computer science.
    配列の基点が0か1かの違い。
    この点はよく考えた上でそうなって(1オリジン)となっているのだろうが、
    コンピューター科学における基本的な考え方の多くを破壊しているように思える
    #じしんねー

 5. V8 is faster than the stock Lua implementation, but slower than LuaJIT. It's not
    enough for me to care though.
    V8 は stock lua 実装よりも高速である。しかし LuaJIT には劣る。
    とはいえそれはわたしにとっては考慮しなければならないほどのものではない。
 
 
What are you using it for? Scripting for your programs or just to make stuff with? 
 
 
My switch is for general use. Javascript and Lua have a lot in common, so much so that 
anything I can think to do in Lua I can do in Javascript. I might still use Lua if I'm 
embedding a scripting language in a native application. Lua's C API is about as 
straight forward as you can get and makes embedding a breeze. 
 
 
  Lua's C API is about as straight forward as you can get and makes embedding a breeze. 
 
Well, you should look at LuaJit's FFI library. It takes "a breeze" to almost 
absurd levels: 
 
 local ffi = require("ffi") 
 ffi.cdef[[ 
 int printf(const char *fmt, ...); 
 ]] 
 ffi.C.printf("Hello %s!", "world") 
 
 
I wish Javascript had the metaprograming power that Lua has. 
 
 
I actually just started playing with V8 (embedding it as a scripting language for a 
small game). It's a very strange, yet usable library. Few problems so far: 
 
1) Almost no documentation -- This is the worst. Their API docs aren't complete at all; 
   information on the web is sparse and out-dated. 
 
2) Doesn't officially support MinGW. I got it to compile anyway, but only in debug mode
   (release compiled, but doesn't work). 
 
3) No strong C++ binding libraries (yet). I found a diverse ecosystem of binding libraries,
   from half-assed to overly complex. None of them seemed well rounded, though, so I'm
   having to just write my own (which is fun, so shrugs). A library like Boost::Python for
   V8 would be fantastic on so many levels. 
 
I think Lua beats V8 on all the problems I listed, especially with regards to 
documentation and stability of the API. 
 
Overall, I'd say it's great to have the freedom of choice! 
以下略

■_

2011年02月26日

■_

JavaのBigDecimalって「固定小数点」数なんですかね

・ダムエー
オリジンは…んー。TVなり映画なりに沿った話でなければダメとか嫌とか 言う気はないのだけど、それにしてもこの展開は。
GUNDAM A (ガンダムエース) 2011年 04月号 [雑誌]
GUNDAM A (ガンダムエース) 2011年 04月号 [雑誌]
HIDEKI の方は新世紀宣言のところでひっぱる。

今月の皇帝陛下
「エロイカ」ではどう描かれてたっけか>ナポレオンの妹(の一人)。

・買った
神様ドォルズ 8 (サンデーGXコミックス)
神様ドォルズ 8 (サンデーGXコミックス)
話が動いてきた。アニメじゃどこまでやるのかねえ。

■_ それは

これソースコードはどこなんだろう。

grep 2.7 on Windows 7 Professional

I am using grep 2.4.2 without problems. Now I would like to use new option --include. 

I have downloaded grep 2.7 for windows 32 bits from 
http://i18n-zh.googlecode.com/files/gzip-2.7-w32.zip, and it seems it cannot obtain 
directory listing information here (Windows 7 Professional 32 bits). 
 
This works OK: 
grep toolbar prueba.py 
 
 
But this doesn't work: 
grep toolbar *.py 
grep: *.py: No such file or directory 
 
 
Probably this is not a bug of grep but perhaps you can tell me where to download a 
working binary 2.7 for Windows 7. 

Thank you.

以前の期待通り動いてたやつの出自もわからんけど、これは十中八九 ワイルドカード展開をしてないせいでしょう。 ダウンロードのリンクから調べてみるとこんなプロジェクト?のようで。

i18n-zh - Project Hosting on Google Code

* 愿意加入我们的可以参看任务列表。 
 * 国际化(i18n),修改不支持i18n或支持不彻底的软件 
 o apr 
 o ... 
 * 本地化(l10n),即维护没有中文支持,中文支持不完整或翻译质量不佳的软件 
 o binutils 
 o coreutils 
 o neon 
 o sed 
 o nano 
 o subversion 
 o tortoisesvn 
 o ... 
 

「本地化」ていうのか>l10n シェルもここで手を入れているものがあって、それで使う前提なのかなあ。

■_ それにつけても

金の欲しさよ

■_ Excel と Access

こんな本が出てたのね。日本語版が出てないのは、Access の使われ具合の差。なんだろうか。 Access 絡めてちょっとやりたいことがあるから、参考になりそうなら買ってみるかなあ。 Integrating Excel and Access - O'Reilly Media

■_

GW-Basic → TurboPascal → C/C++ → Java → Python か。

Interview with Jamis Buck | LessCode

Interview with Jamis Buck 

Posted by LessCode on februari 23, 2011 
 
Please tell us a bit about yourself and your background. 

Jamis Buck 

I've been programming since I was in high school, starting with GW-Basic and 
progressing through TurboPascal, C/C++, Java, Python, and eventually discovering Ruby 
around 2001 or 2002. I worked for about five years at BYU, until I met David at the 
2004 RubyConf. A few months later I found myself happily employed at 37signals, where 
I've been ever since! 
 
Why did you choose Ruby? 
 
Just before finding Ruby, I had been playing with Python. I liked a lot of things 
about it, but eventually grew tired of the significant whitespace. I went searching 
again, and found Ruby. Everything about it clicked for me: the blocks, the ubiquitous 
objects, everything. 

Rubyを見つける直前にはPythonを試していました。
Pythonについては概ね好きであったのですが、その significant whitespace に
うんざりするようになったのです。さらに探してみたところでRubyを見つけたのです。
ブロック、遍在するオブジェクト (ubiquitous objects)、すべてがわたしの心を
捉えたのです。

Why is Ruby a good language to learn? 
 
It might not actually BE a good language for everyone. It was for me, because there 
was very little mismatch between Ruby's syntax, and how I thought about problems. I've 
been teaching Ruby to my son now, too, and it's been interesting to see where match is 
not so seamless for him as it was for me. It's still a great language for him to be 
learning, but among other things, the auto-coercion of values (both when it happens, 
and when it doesn't) is surprising to him. 
 
以下略

万人にとっての「good lanugage」ではないかもしれない。か。 まあそれは確かに。

■_ あとでよむ

bytecode interpreters for tiny computersbytecode interpreters for tiny computers

■_ 統計クラスタ

ちょっと前の記事ですが、見返していたら Mid-Major ってくくりのところで 妙に統計関連の言語が固まっていたのが目につきました。

2010 State of the Computer Book Market, Post 4 - The Languages - O'Reilly Radar

Mid-Major Programming Languages — 3,000 — 9,999 units in 2010 
 
The news in this category is that the statistical languages are doing really well. As 
noted above, these languages have grown by 102.87% from 2009 to 2010. The most 
impressive growth is for the eight titles for the R language: the overall category is 
led by R in a Nutshell. 

*Mid-Major* U N I T S T I T L E S M A R K E T S H A R E 

Language    2010 Units 2009 Units 2010 Titles 2009 Titles 10Mkt Share 09Mkt Share 

SAS           9,035     7,974           27          21      0.65%         0.56% 
SPSS          8,973     6,818           16          10      0.65%         0.48% 
MatLab        7,857     6,752           22          17      0.57%         0.47% 
R             7,800     2,817           15          12      0.56%         0.20% 
Processing    6,996     6,038            8           6       .51%          .42% 
Shell Script  6,073     7,116           19          16       .44%          .50% 
Basic         5,540     5,277            7           9       .40%          .37% 
Lua           4,677     5,570            7           6       .34%          .39% 
Assembly      4,391     4,359           18          14       .32%          .31% 
MDX           3,890     4,838            8           8      0.28%         0.34% 
UnrealScript  3,028     2,440            3           3       .22%          .17% 
 
Here are the top titles for the Mid-Major languages.

grown by 102.87% from 2009 to 2010 100% の成長。 てーとほぼ倍ですか。で、R の本が8タイトルと。 日本でもたくさんでてるものなあ。

■_ Boostのあれ

Boost.勉強会 #4 : ATND 行ってきました。

で、まあいろいろ発表があったのですが、 まずは shinhさんのコメントをひいておいて。

はじめてのにき(2011-02-26)

shared_ptr …は話者の仕事でレガシーなものを 割と無理矢理 RAII な感じにしようとしてて 
発生した問題色々、って感じなのかなぁと思った。 どうも一般性に欠ける感があったんだけど。 
基本カスタムデリータとか使った時点で負けてる感が強いというか… 
 

確かに何のためにそれを持ち込んだの? というのはわたしも感じました。 あと、失敗したのはいいとしてその後どうなったのかというのがちと気になる。 いや、そのプロジェクト(ゲーム)がではなく、 次に別の何かを持ち込もうとしたときに 「お前前にも~」で一顧だにされなくなってしまったとか言うオチがあるんじゃないかとか。 また、失敗を反省するにしても「吊るし上げ」で終わったんじゃないかなあとか。

■_

■_ こういう使い方をみて

ちょっと iPad がほしくなったw

2011年02月25日

■_

・PASMO
数日前から、自動改札を通るときになんかメッセージが出ることがあるなあ (出ないときもあった)と思ってたのですが、じっくりとそのメッセージを確かめる 余裕がなくて(パイプラインハザード起こすと顰蹙ですしw)放置していたのですが、 ようやく今日になってこれだということが判明。 オートチャージの有効期限 | ご購入・チャージ(入金) | PASMO(パスモ) 確かに、一ヶ月ほど前に新しいカードが送られてきてました。 で、PASMOのオートチャージ用のカードは使わずにしまいこんでるので 中にあったお知らせもろくに見てなかったので気がつかなかったのですね。うひ。 鉄道会社によっては自動券売機で手続きできるともあるんですが、 さて最寄の駅ではどうなんだろうか。

・星を継ぐ者
連載開始。つーことでビッグコミックオリジナル無印を買う。 なんかダブルフェイスが最終回でした。確かに話が大詰めの感はありましたが 最終回だけ読んでしまうと単行本最終巻(5月予定だとか)を読むときの楽しみがががが。

・アフタヌーン
あれとあれが最終回。 ヴィンサガはお休み。

あんま問い詰められなかった。 懇親会ではどうだったんだろうか。

■_

めずらしく正規表現スレが伸びてると思ったら。

正規表現 Part7 

865 デフォルトの名無しさん [] 2011/02/23(水) 19:59:15.01 ID: Be: 
 質問させてください。 
 「<img」以外の「<」を「&lt;」に置き換えるにはどう書けば良いでしょうか? 
 #「img(中略)>」以外の「>」も「&gt;」に置き換える必要ありがますが、そちらはまた別途考えるとして。。 
 言語はPHPです。よろしくお願いします。 
 
866 デフォルトの名無しさん [sage] 2011/02/23(水) 20:26:52.60 ID: Be: 
 <(?!img) 
 < 
 とりあえず正規表現はこれ 
 PHPでどうやるかはわからん 
 
867 デフォルトの名無しさん [sage] 2011/02/23(水) 20:29:14.89 ID: Be: 
 おっと2行目は「<」ね 
 
868 デフォルトの名無しさん [sage] 2011/02/23(水) 20:29:54.53 ID: Be: 
 あれ?半角で書くと勝手に変換されんのか 
 
869 865 [sage] 2011/02/23(水) 20:38:31.16 ID: Be: 
 >>866 
 できました! ありがとうございます。 
 
 >#「img(中略)>」以外の「>」も「&gt;」に置き換える必要ありがますが、そちらはまた別途考えるとして。。 
 こっちも何かヒント頂けたら嬉しいです。ためしに 
 '/(?!<img[^>]*)>/'; 
 とやってみましたが駄目でした 
 
870 デフォルトの名無しさん [sage] 2011/02/23(水) 20:51:59.61 ID: Be: 
 ほい 
 (?!img)(.*)(>) 
 \1&gt; 
 
871 865 [sage] 2011/02/23(水) 22:06:05.47 ID: Be: 
 >>870 
 /(?!img)(.*?)>/ で判定かけてみたのですが、 
 文字列"01234>abcdefg<img src>"ですと 
 abcdefg<img src> 
 が引っかかってしまって、imgを含んでいても弾いてくれません。 
 
 単独の>、<を弾きつつ、imgの変換を除外するとなると、一発で判定するのは無理で、 
 (1) /(.*?)>/の判定後にimgが含まれていないか判定するか、 
 (2) /<(?!img)(.*?)>/ と(単独の>、<の変換を諦めて)セット<>で判定 
 でしょうか? 
 
872 デフォルトの名無しさん [sage] 2011/02/23(水) 22:34:52.18 ID: Be: 
 だめだわからん 
 ほかの人待ち 
 
873 デフォルトの名無しさん [sage] 2011/02/23(水) 22:44:01.15 ID: Be: 
 > を全部&gt;に変えた後、img の次の&gt;を > に戻せばいい。 
 
874 デフォルトの名無しさん [sage] 2011/02/23(水) 22:44:38.74 ID: Be: 
 <(.*?)> 
 
875 デフォルトの名無しさん [sage] 2011/02/23(水) 22:50:10.94 ID: Be: 
 <(^o^)> 
 
876 デフォルトの名無しさん [sage] 2011/02/23(水) 22:54:25.37 ID: Be: 
 >873 
 あ、なるほど 
 
877 デフォルトの名無しさん [sage] 2011/02/23(水) 23:10:16.82 ID: Be: 
 >>873 
 それだと元から&gt;が合ったときに死ぬる 
 
 <img src="...&gt;..." /> 
          ↓ 
 <img src="...&gt;..." /&gt; 
          ↓ 
 <img src="...>..." /&gt; 
 
 最初にアンパサンドを&amp;に変換して最後に戻すとかしないと 
 
878 デフォルトの名無しさん [sage] 2011/02/24(木) 00:03:15.27 ID: Be: 
 >>875 
 syntax err 
 
879 デフォルトの名無しさん [sage] 2011/02/24(木) 03:43:12.62 ID: Be: 
 >>865 
 preg系で 
 '/(?!<img )<([^>]*)>/i' 
 '&lt;\\1&gt;' 
 
880 デフォルトの名無しさん [sage] 2011/02/24(木) 04:19:37.11 ID: Be: 
 被ってる部分と、文字クラスを修正 
 '/<(?!img )([^<>]*)>/i' 
 
881 デフォルトの名無しさん [sage] 2011/02/24(木) 04:47:19.41 ID: Be: 
 駄目だ 
 ereg系(POSIX)も調べたけど、否定先読みが出来ない…orz 
 つー訳で、>>879-880のpreg系(PCRE)を使ってくれ 
 
882 872 [sage] 2011/02/24(木) 14:24:33.92 ID: Be: 
 これでどうかな 
 <((?!img)[^<>]*)> 
 
883 デフォルトの名無しさん [sage] 2011/02/24(木) 14:36:38.69 ID: Be: 
 よくみたらすぐ上に同じやつ書いてあったわ(^p^) 
 
884 デフォルトの名無しさん [sage] 2011/02/24(木) 14:50:23.58 ID: Be: 
 ((<(img[^<>]*>|(?!img))|(?<=>))[^<>]*)> 
 \1&gt; 
 
 一応、"<"より先に変換することを想定。後でも基本的に問題ないが 
 
 <img <>     → マッチする 
 <img &lt;> → マッチしない 
 
 という違いがある 
 
885 デフォルトの名無しさん [sage] 2011/02/24(木) 16:09:25.08 ID: Be: 
 Perl なら 
 
 s/<([^\s]+)([^>]*)>/$1 eq 'img' ? "<$1$2>" : "<$1$2>"/eg 
 
 とかできるけどPHPでは出来ねぇの? 
 
886 デフォルトの名無しさん [sage] 2011/02/24(木) 16:22:04.48 ID: Be: 
 preg_replace_callback使えばできるよ 
 
887 デフォルトの名無しさん [sage] 2011/02/24(木) 16:22:04.76 ID: Be: 
 preg_replace_callback使えばできるよ 
 
888 デフォルトの名無しさん [sage] 2011/02/24(木) 17:22:40.99 ID: Be: 
 >>871 
 >が引っかかってしまって、imgを含んでいても弾いてくれません。 
 >単独の>、<を弾きつつ 
 
 >(2) /<(?!img)(.*?)>/ と(単独の>、<の変換を諦めて)セット<>で判定 
 
 単独(タグ以外?)の「>」と「<」は、上を見ると、変換したくない意味に見えるし、 
 下を見ると、変換したいようにも見えるけど、最終的に、変換したいの?したくないの? 
 
889 デフォルトの名無しさん [sage] 2011/02/24(木) 19:13:26.82 ID: Be: 
 例えばダブルクォーテーションで括った部分が文字列とする場合は 
 単に/"[^"]*"/でマッチできるけど、文字列以外の部分をマッチさせるには 
 どうすればいい 
 

このあとやり取りもこっちの方向に。

■_ ハードウェアスタック

Island Life - スタックが無かった頃のお話

大学でIBMのメインフレームの互換機を授業で使ったことがあるのですが (確か370互換)、やはりスタックを持っていませんでした。 なもんで、サブルーチン呼び出しが結構面倒でした。 14番レジスタをどうこう。だったかなあ。 RISC での呼び出しにちょっと似てたような。

EDSACでのサブルーチン呼び出しネタも書こう書こうと思いつつなかなか手がつかない。

ところで最初にハードウェアスタック持ったコンピューターってなんざんしょ?

と書いておくときっと誰か調べてくれる。といいなあ。

■_

■_

あれ。Dropbox の同期がうまくいってない? あと二つほどネタを仕込んでおいたのが見当たらない。

2011年02月24日

■_

やる気ゲージが上がりません。

■_ HASZERO

気になったので 0~255の数値に対して -1、ビット反転、その bitwise and さらにそのMSBだけと…というのをやってみた。

ONES =01010101
HIGHS=80808080
x	x-1	~x	x-1&~x	x-1&~x&HIGHS
00	ff	ff	ff		80
01	00	fe	00		00
02	01	fd	01		00
03	02	fc	00		00
04	03	fb	03		00
05	04	fa	00		00
06	05	f9	01		00
07	06	f8	00		00
08	07	f7	07		00
09	08	f6	00		00
0a	09	f5	01		00
0b	0a	f4	00		00
0c	0b	f3	03		00
0d	0c	f2	00		00
0e	0d	f1	01		00
0f	0e	f0	00		00
10	0f	ef	0f		00
11	10	ee	00		00
12	11	ed	01		00
13	12	ec	00		00
14	13	eb	03		00
15	14	ea	00		00
16	15	e9	01		00
17	16	e8	00		00
18	17	e7	07		00
19	18	e6	00		00
1a	19	e5	01		00
1b	1a	e4	00		00
1c	1b	e3	03		00
1d	1c	e2	00		00
1e	1d	e1	01		00
1f	1e	e0	00		00
20	1f	df	1f		00
21	20	de	00		00
22	21	dd	01		00
23	22	dc	00		00
24	23	db	03		00
25	24	da	00		00
26	25	d9	01		00
27	26	d8	00		00
28	27	d7	07		00
29	28	d6	00		00
2a	29	d5	01		00
2b	2a	d4	00		00
2c	2b	d3	03		00
2d	2c	d2	00		00
2e	2d	d1	01		00
2f	2e	d0	00		00
30	2f	cf	0f		00
31	30	ce	00		00
32	31	cd	01		00
33	32	cc	00		00
34	33	cb	03		00
35	34	ca	00		00
36	35	c9	01		00
37	36	c8	00		00
38	37	c7	07		00
39	38	c6	00		00
3a	39	c5	01		00
3b	3a	c4	00		00
3c	3b	c3	03		00
3d	3c	c2	00		00
3e	3d	c1	01		00
3f	3e	c0	00		00
40	3f	bf	3f		00
41	40	be	00		00
42	41	bd	01		00
43	42	bc	00		00
44	43	bb	03		00
45	44	ba	00		00
46	45	b9	01		00
47	46	b8	00		00
48	47	b7	07		00
49	48	b6	00		00
4a	49	b5	01		00
4b	4a	b4	00		00
4c	4b	b3	03		00
4d	4c	b2	00		00
4e	4d	b1	01		00
4f	4e	b0	00		00
50	4f	af	0f		00
51	50	ae	00		00
52	51	ad	01		00
53	52	ac	00		00
54	53	ab	03		00
55	54	aa	00		00
56	55	a9	01		00
57	56	a8	00		00
58	57	a7	07		00
59	58	a6	00		00
5a	59	a5	01		00
5b	5a	a4	00		00
5c	5b	a3	03		00
5d	5c	a2	00		00
5e	5d	a1	01		00
5f	5e	a0	00		00
60	5f	9f	1f		00
61	60	9e	00		00
62	61	9d	01		00
63	62	9c	00		00
64	63	9b	03		00
65	64	9a	00		00
66	65	99	01		00
67	66	98	00		00
68	67	97	07		00
69	68	96	00		00
6a	69	95	01		00
6b	6a	94	00		00
6c	6b	93	03		00
6d	6c	92	00		00
6e	6d	91	01		00
6f	6e	90	00		00
70	6f	8f	0f		00
71	70	8e	00		00
72	71	8d	01		00
73	72	8c	00		00
74	73	8b	03		00
75	74	8a	00		00
76	75	89	01		00
77	76	88	00		00
78	77	87	07		00
79	78	86	00		00
7a	79	85	01		00
7b	7a	84	00		00
7c	7b	83	03		00
7d	7c	82	00		00
7e	7d	81	01		00
7f	7e	80	00		00
80	7f	7f	7f		00
81	80	7e	00		00
82	81	7d	01		00
83	82	7c	00		00
84	83	7b	03		00
85	84	7a	00		00
86	85	79	01		00
87	86	78	00		00
88	87	77	07		00
89	88	76	00		00
8a	89	75	01		00
8b	8a	74	00		00
8c	8b	73	03		00
8d	8c	72	00		00
8e	8d	71	01		00
8f	8e	70	00		00
90	8f	6f	0f		00
91	90	6e	00		00
92	91	6d	01		00
93	92	6c	00		00
94	93	6b	03		00
95	94	6a	00		00
96	95	69	01		00
97	96	68	00		00
98	97	67	07		00
99	98	66	00		00
9a	99	65	01		00
9b	9a	64	00		00
9c	9b	63	03		00
9d	9c	62	00		00
9e	9d	61	01		00
9f	9e	60	00		00
a0	9f	5f	1f		00
a1	a0	5e	00		00
a2	a1	5d	01		00
a3	a2	5c	00		00
a4	a3	5b	03		00
a5	a4	5a	00		00
a6	a5	59	01		00
a7	a6	58	00		00
a8	a7	57	07		00
a9	a8	56	00		00
aa	a9	55	01		00
ab	aa	54	00		00
ac	ab	53	03		00
ad	ac	52	00		00
ae	ad	51	01		00
af	ae	50	00		00
b0	af	4f	0f		00
b1	b0	4e	00		00
b2	b1	4d	01		00
b3	b2	4c	00		00
b4	b3	4b	03		00
b5	b4	4a	00		00
b6	b5	49	01		00
b7	b6	48	00		00
b8	b7	47	07		00
b9	b8	46	00		00
ba	b9	45	01		00
bb	ba	44	00		00
bc	bb	43	03		00
bd	bc	42	00		00
be	bd	41	01		00
bf	be	40	00		00
c0	bf	3f	3f		00
c1	c0	3e	00		00
c2	c1	3d	01		00
c3	c2	3c	00		00
c4	c3	3b	03		00
c5	c4	3a	00		00
c6	c5	39	01		00
c7	c6	38	00		00
c8	c7	37	07		00
c9	c8	36	00		00
ca	c9	35	01		00
cb	ca	34	00		00
cc	cb	33	03		00
cd	cc	32	00		00
ce	cd	31	01		00
cf	ce	30	00		00
d0	cf	2f	0f		00
d1	d0	2e	00		00
d2	d1	2d	01		00
d3	d2	2c	00		00
d4	d3	2b	03		00
d5	d4	2a	00		00
d6	d5	29	01		00
d7	d6	28	00		00
d8	d7	27	07		00
d9	d8	26	00		00
da	d9	25	01		00
db	da	24	00		00
dc	db	23	03		00
dd	dc	22	00		00
de	dd	21	01		00
df	de	20	00		00
e0	df	1f	1f		00
e1	e0	1e	00		00
e2	e1	1d	01		00
e3	e2	1c	00		00
e4	e3	1b	03		00
e5	e4	1a	00		00
e6	e5	19	01		00
e7	e6	18	00		00
e8	e7	17	07		00
e9	e8	16	00		00
ea	e9	15	01		00
eb	ea	14	00		00
ec	eb	13	03		00
ed	ec	12	00		00
ee	ed	11	01		00
ef	ee	10	00		00
f0	ef	0f	0f		00
f1	f0	0e	00		00
f2	f1	0d	01		00
f3	f2	0c	00		00
f4	f3	0b	03		00
f5	f4	0a	00		00
f6	f5	09	01		00
f7	f6	08	00		00
f8	f7	07	07		00
f9	f8	06	00		00
fa	f9	05	01		00
fb	fa	04	00		00
fc	fb	03	03		00
fd	fc	02	00		00
fe	fd	01	01		00
ff	fe	00	00		00

なるほど 00 ff ff ff 80 これだけは上のビットが生き残るのね。

プログラムはこんなんで。

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define ALIGN (sizeof(size_t)-1)
#define ONES ((size_t)-1/UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX/2+1))
#define HASZERO(x) ((x)-ONES & ~(x) & HIGHS)


int
main()
{
       unsigned int i;

       printf("ONES =%08x\n", ONES);
       printf("HIGHS=%08x\n", HIGHS);
       printf("x\tx-1\t~x\tx-1&~x\t\tx-1&~x&HIGHS\n");

       for (i=0; i<=UCHAR_MAX; i++) {
               printf("%02x\t%02x\t%02x\t%02x\t%02x\n",
                 i,
                 (unsigned char)(i-1),
                 (unsigned char)~i,
                 (unsigned char)((i-1) & (~i)),
                 (unsigned char)((i-1) & (~i))
                 );
       }

       return 0;
}

■_ New Interview Questions for Senior Software Engineers

New Interview Questions for Senior Software Engineers - Scott Hanselman

New Interview Questions for Senior Software Engineers 

I'm putting together some practice interview questions for a friend who lost his job. 
I thought it'd be useful to crowd-source some questions from you, Dear Reader. 
 
These questions should be more software design focused, less technical trivia like my 
previous two lists of interview questions: 
 
 * What Great .NET Developers Ought To Know (More .NET Interview Questions) 
 * ASP.NET Interview Questions (7 years ago, can you believe it?) 

UPDATE:
(略)

Here's what I have so far. 
 
 * What is something substantive that you've done to improve as a developer in your career?

 * Would you call yourself a craftsman (craftsperson) and what does that word mean to you?

 * Implement a <basic data structure> using <some language> on 
   <paper|whiteboard|notepad>.

 * What is SOLID?
   SOLID とはなにか?

 * Why is the Single Responsibility Principle important?
   なぜ Single Responsibility の原則が重要なのか?

 * What is Inversion of Control? How does that relate to dependency injection?
   Inversion of Control (制御の反転) とはなにか?
   それは dependency injection (依存性の注入) とどのように関係しているか?

 * How does a 3 tier application differ from a 2 tier one?

 * Why are interfaces important?
   なぜインターフェースが重要なのか?

 * What is the Repository pattern? The Factory Pattern? Why are patterns important?
   Repository パターンとはなにか? ファクトリーパターンとは?
   なぜそういったパターンは重要なのか?

 * What are some examples of anti-patterns?

 * Who are the Gang of Four? Why should you care?
   Gang of Four とはどういった人たちか?
   なぜ注意を払うべきなのか?

 * How do the MVP, MVC, and MVVM patterns relate? When are they appropriate?
   MVP、MVC、MVVM といったパターンはどのように関連しているか?
   それぞれが適切な状況とは?

 * Explain the concept of Separation of Concerns and it's pros and cons.

 * Name three primary attributes of object-oriented design. Describe what they mean
   and why they're important.

 * Describe a pattern that is NOT the Factory Pattern? How is it used and when?

 * You have just been put in charge of a legacy code project with maintainability 
   problems. What kind of things would you look to improve to get the project on a stable 
   footing?

 * Show me a portfolio of all the applications you worked on, and tell me how you 
   contributed to design them.

 * What are some alternate ways to store data other than a relational database? Why 
   would you do that, and what are the trade-offs?

 * Explain the concept of convention over configuration, and talk about an example of 
   convention over configuration you have seen in the wild.

 * Explain the differences between stateless and stateful systems, and impacts of 
   state on parallelism.

 * Discuss the differences between Mocks and Stubs/Fakes and where you might use them 
   (answers aren't that important here, just the discussion that would ensue).
   Mocks と Stub(やFakes) とはどのように違うのか、またそれらを使う状況の相違について
   論ぜよ (回答が重要ではない。)
   

 * Discuss the concept of YAGNI and explain something you did recently that adhered to 
   this practice.
   YAGUNI というコンセプトについて論ぜよ。また、この practice を適用した最近の
   事例について説明せよ。

 * Explain what is meant by a sandbox, why you would use one, and identify examples of 
   sandboxes in the wild.
   sandbox の意味について説明せよ。なぜそれを使うのか、また、現実世界における
   sandbox の例を identify せよ。

 * Concurrency 
   o What's the difference between Locking and Lockless (Optimistic and Pessimistic) 
     concurrency models?
     locking cocurrency モデルと lockless concurrency モデル (もしくは楽観モデルと
     悲観モデル) との間の相違とは?

   o What kinds of problems can you hit with locking model? And a lockless model?
     locking モデルにおいて遭遇する可能性のある問題の種類とはなにか?
     lockless モデルの場合は?

   o What trade offs do you have for resource contention?
     リソース競合に対してあなたがとるトレードオフはなにか?

   o How might a task-based model differ from a threaded model?
     タスクベースモデルとスレッドモデルとはどのように異なる可能性があるだろうか?

   o What's the difference between asynchrony and concurrency?
     非同期処理と並行処理との違いとは何か?

 * Are you still writing code? Do you love it?
   まだコードを書いていますか? コードを書くのは好きですか?

 * You've just been assigned to a project in a new technology how would you get 
   started?
   あなたは新しい技術を使うプロジェクトにアサインされた。どのように始めるか?

 * How does the addition of Service Orientation change systems? When is it appropriate 
   to use?

 * What do you do to stay abreast of the latest technologies and tools?

 * What is the difference between "set" logic, and "procedural" 
   logic. When would you use each one and why?

 * What Source Control systems have you worked with?
   使ったことのあるソース管理システムは?

 * What is Continuous Integration? Have you used it and why is it important?
   Continuous Integration とはなにか?
   それを使ったことがあるか? またそれは重要なものであるか?

 * Describe a software development life cycle that you've managed.
   あなたが manage したソフトウェア開発のライフサイクルについて説明せよ

 * How do you react to people criticizing your code/documents?

 * Whose blogs or podcasts do you follow? Do you blog or podcast?
   誰のblog や podcast をフォローしているか?
   あなたは blog もしくは podcast をしているか?

 * Tell me about some of your hobby projects that you've written in your off time.

 * What is the last programming book you read?
   一番最近読んだプログラミングの本は何か?

 * Describe, in as much detail as you think is relevant, as deeply as you can, what
   happens when I type "cnn.com" into a browser and press "Go".

 * Describe the structure and contents of a design document, or a set of design 
   documents, for a multi-tiered web application.

 * What's so great about <cool web technology of the day>?

 * How can you stop your DBA from making off with a list of your users' passwords?

 * What do you do when you get stuck with a problem you can't solve?
   解決できない問題に遭遇したときにあなたが行うことは?

 * If your database was under a lot of strain, what are the first few things you might 
   consider to speed it up?

 * What is SQL injection?
   SQLインジェクションとはなにか?

 * What's the difference between unit test and integration test?
   ユニットテストと結合テストとの間の違いとは何か?

 * Tell me about 3 times you failed.

 * What is Refactoring ? Have you used it and it is important? Name three common 
   refactorings.
   リファクタリングとはななにか? それを使ったことはあるか? また、それは重要なものであるか?
   一般的なリファクタリング三つの名前を挙げよ。

 * You have two computers, and you want to get data from one to the other. How could 
   you do it?
   二台のコンピューターがある。一台からもう一台へデータを転送したいとしたときに
   あなたはどのように転送するか?

 * Left to your own devices, what would you create?

 * Given Time, Cost, Client satisfaction and Best Practices, how will you prioritize 
   them for a project you are working on? Explain why.

 * What's the difference between a web server, web farm and web garden? How would your 
   web application need to change for each?

 * What value do daily builds, automated testing, and peer reviews add to a project? 
   What disadvantages are there?
   デイリービルドや自動化されたテスト、ピアレビューをプロジェクトで行う価値とは何か?
   それらの短所は何か?

 * What elements of OO design are most prone to abuse? How would you mitigate that?

 * When do you know your code is ready for production?
   自分のコードがいつ ready for production と判断するのはいつですか?

 * What's YAGNI? Is this list of questions an example?
   YAGNI とはなにか? この質問のリストは一例になっているか?

 * Describe to me some bad code you've read or inherited lately.
   最近あなたが読んだり引き継いだりしたなんらかのひどいコード (bad code) について
   説明してください。
 
Your thoughts? I'll add good questions from the comments throughout the day.

■_

■_ 明日(25日)は

みずしまさんを問い詰めないといけないらしい。

2011年02月23日

■_

Amazon.co.jp: 定本Javaプログラマのためのアルゴリズムとデータ構造: 近藤 嘉雪: 本 クイックソートのところで、改良案(のひとつ)としてイントロソートの説明らしい記述があるのに イントロソートって名前を出してないのはなにか理由があるのだろうか。

・Emacs
Emacs のソースの変遷をわかりやすくまとめたところ…なんてないよなあ。

やのさん監訳のあの本まだ買ってない。

どうしようかなあ
大魔法峠 〈期間限定生産〉 [DVD]
初回版でそろえてんだけどね。

■_ ping

わたしは「グ」はほとんど発音しない派です。

やばいプログラマ迷言集 

10 仕様書無しさん [sage] 2011/02/03(木) 00:54:56 ID: Be: 
 A「ping飛ばしてみて!」 
 
 B「ペンギンの?」 
 
35 仕様書無しさん [sage] 2011/02/21(月) 16:10:25.18 ID: Be: 
 >>34 
 ピンと発音すべきところをピングとグまでつけてしまって 
 田舎モノ丸出しなAをBが茶化す形でたしなめてるんだよね 
 
36 仕様書無しさん [sage] 2011/02/21(月) 18:32:11.55 ID: Be: 
 ピンで通じるとわかってる相手以外はピングにしとく。 
 
37 仕様書無しさん [sage] 2011/02/22(火) 06:55:45.25 ID: Be: 
 沈黙の艦隊を読んだ直後はピンガーと言ってた。 
 
38 仕様書無しさん [] 2011/02/22(火) 19:30:40.36 ID: Be: 
 >>37 
 懐かしいな。 
 今度ping打つときは「よし、一回だけピンを打つか。」とか言ってみるか。 
 
40 仕様書無しさん [sage] 2011/02/22(火) 23:25:29.68 ID: Be: 
 >>38 
 2回目は実弾ですか?

なにかの本で、 ネットワークの不調を見つけ出すのに ping を面白い形で使って解決したってのを読んだなあ。 チーパーネット (10BASE-2) のケーブルの断線箇所だったかな。

■_ 歴史あり

この辺から Abstract Heresies: An early LISP program (circa Feb. 1960) An early LISP program (circa Feb. 1960) : lisp

An early LISP program (circa Feb. 1960) : lisp

1960: 
1960年の Lisp プログラム

DEFINE 
(((COLLAPSE,(LAMBDA,(L),(COND, 
    ((ATOM,L), (CONS,L,NIL)) 
    ((NULL,(CDR,L)), 
        (COND,((ATOM,(CAR,L)),L),(T,(COLLAPSE,(CAR,L))))) 
    (T,(APPEND,(COLLAPSE,(CAR,L)),(COLLAPSE,(CDR,L)))) 
))))) () 
COLLAPSE ((((A,B),((C))),((D,(E,F)),(G),((H))))) () 
COLLAPSE ((A,(B,(C,(D,(E))),F,(G,(H,J))))) () 
COLLAPSE ((((((A),B),C),D),E)) () 
   STOP))))))))))STOP 
 
Fifty-one years later: 
その50年後

> (defun collapse (l) 
    (cond ((atom l) (cons l nil)) 
    ((null (cdr l)) 
    (cond ((atom (car l)) l) 
          (t (collapse (car l))))) 
    (t (append (collapse (car l)) 
               (collapse (cdr l)))))) 

COLLAPSE 
 
> (collapse '(((A B) ((C))) ((D (E F)) (G) ((H))))) 
(A B C D E F G H)

cond?

■_ これ

二日前のやつで

Programming Interview Questions

Linked Lists 

This is an extremely popular topic. I've had linked lists on every interview. 
You must be able to produce simple clean linked list implementations quickly. 
 
 * Implement Insert and Delete for 
   o singly-linked linked list 
   o sorted linked list 
   o circular linked list 
 
 int Insert(node** head, int data) 
 int Delete(node** head, int deleteMe) 
 
 * Split a linked list given a pivot value 
    void Split(node* head, int pivot, node** lt, node** gt) 
 * Find if a linked list has a cycle in it. Now do it without marking nodes. 
 * Find the middle of a linked list. Now do it while only going through the list once.
   (same solution as finding cycles)

最後の問題、リストを一度だけなめて中間で分割しろというものですが ポインターを二つ持って先頭からよーいどんでたどってくというのは 「一回だけ」とみなしてもらえるんでしょうか。 もし認められるなら簡単だけど、そうでないとしたら…できるのか?(^^;

■_

2011年02月22日

■_

こう、いろいろと。

■_

ハッカーのたのしみ―本物のプログラマはいかにして問題を解くか

6 ワードの探索 に、HASZEROで見たようなパターンが。

■_ Algol-W

マニュアルから抜き出し。

5.2.3 Examples
 integer array H(1::100)
 real array A, B(1::M, 1::N)
 string (12) array STREET, TOWN, CITY(J::K+1)

配列の上下限の区切りは :: なんですねー。 Algol-60、Pascal では : なのになぜ?

「関数」。

6.2 Function Designators
6.2.1 syntax
6.2.2 semantics
 A function designator defines a value which can be obtained by
a process performed in the following steps:

Step 5. The copy of the function procedure body, modified as
indicated in steps 2-4, is executed. Execution of the expression
which consistuies or is part of the modified procedure body
consists of evaluation of that expression, and the resulting value
is the value of the function designator. The type of the function
procedure declaration.

最後に評価した値が関数の戻り値になる。ってPerlのような。 ここからとったんだろうか? Algol-60とPascalでは、関数と同じ名前の変数に代入するとそれが戻り値になります。

型。


integer: the value is a 32 bit integer
real: the value is a 32 bit floating point number
long real: the value is a 64 bit floating point number
complex: the value is a complex number composed of two numbers of type real
long complex: the value is a complex number composed of two long real numbers
logical: the value is a logical value
bits: the value is a linear sequence of 32 bits
string: the value is a linear sequece of at least one and at most 256 characters
reference: the value is a reference ot a record

array: the value is a an ordered set of values, all of identical type
record: the value is an ordered set of values

最大で256文字ってのは時代を感じさせますねー。 実装もなんとなく透けて見えそう。 いわゆるPascal型文字列というやつ?

コメント。

The symbol "comment" followed by any sequence of characters not
containg semicolons, followed by a semicolon, is called  a comment.

コメントが "comment" という文字列から始まってセミコロンで終わるとか なんでこんな仕様に。と思ったけどあれか、 記号があまりないからかなあ。

といいつつ、終端記号をみると

true false " null # '
integer real complex logical bits string
refernce array procedure record
, ; : _ ( ) begin end if then else
case of + - * / ** div rem shr shl is
abs long short and or ¬ _ = ¬= <
<= > >= ::
:~ goto | go to | for step until do while
comment value result assert algol fortran

否定の記号が。


real procedure SQRT (real value X);
    comment the positive square root of X,
      domain : X >= 0 ;

long real procedure LONGARCTAN (long real value X) ;
    comment arctangent (radians) of X,
      range : -PI/2 < ARCTAN(X) < PI/2 ;

あー、なんとなく docstring みたいに見えなくも。

型変換


the significance of character in the prototype formats is as follows:

D decimal digit in a mantissa or integer
E decimal digit in an exponent
A hexadecimal digit in a mantissa or integer
B hexadecinal digit in an exponent
+ sign (blank for positive mantissa or integer)
u+umlut blank

string(12) procedure BASE10 (real value X);
    comment string encoding of X with format
             u+EE+DDDDDDD ;

string(12) procedure BASE16 (real value X);
    comment string encoding of X with format
             uu+BBE+AAAAAA ;

u は実際にはウムラウトつきです。

手続き、関数いろいろ。

procedure INCREMENT; X := X + 1

real procedure MAX (real value X, Y);
    if X < Y then Y else X

procedure COPY (real array U, V(*,*); integer value A, B);
    for I := 1 until A do
    for J := 1 until B do U(I,J) := V(I,J)

real procedure HORNER (real array A(*); integer value N;
    real value X);
    begin real S; S := 0;
         for I := N step -1 until 0 do S := S * X + A(I);
         S
    end

long real procedure SUM (integer K, N; long real X);
    begin long real Y; Y := 0; K := N;
         while K >= 1 do
         begin Y := Y + X; K := K -1
         end;
         Y
    end

reference (PERSON) procedure YOUNGESTUNCLE
            (reference (PERSON) R);
   begin reference (PERSON) P, M;
        P := YONGESTOFFSPRING (FATHER (FATHER (R)));
        while P ¬= null and ¬ MALE (P) or
             P = FATHER (R) do
             P := ELDERSIBLING (P);
        M := YONGESTOFFSPRING (MOTHER (MOTHER (R)));
        while M ¬= null and ¬ MALE (M)
             M := ELDERSIBLING (M);
        if P = null then M else
        if M = null then P else
        if AGE(P) < AGE(M) then P else M
   end


procedure  PLOTSUBROUTINE (integer value I); fortran "PLOTSB"

Pascal ではなくなっていたオープン配列らしきものが。 fortran "PLOTSB" とかいうのは C++ で見るあれと同じようなものでしょうか。

例外。

8.5 Exceptional Conditions
 The facilities described below are provided in ALGOL W to
allow detection and control of certain exceptional conditions
arisling the evaluation of arithmetic expressions and standard
functions.

Implicit declaratins:
record EXCEPTION (logical XCPNOTED;
    integer XCPLIMIT, XCPACTION;
    logical XCPMARK; string(64) XCPMSG);
reference(EXCEPTION)
    ENDFILE,
    OVFL, UNFL, DIVZERO, INTOVFL, INTDIVZERO,
    SQRTERR, EXPERR. LNLOGERR, SIMCOSERR;

80桁制限。

9.2 Input Format
 The compiler accepts input records of 80 characters. The first 72 characters
are processed as part of an ALGOL W program: characters 73 through 80 are
listed but are not processed otherwise. Character 72 of one record is
considerd to be immediately followed by character 1 of the next record.
Strings and comments should be arranged so that the character '@' does
not appear in character position 1.

自由入力じゃないんですね。 まあわからんでもないけど。

コンパイラーディレクティブなんてものを持っていたとは。 これもなんで Pascal ではなくなっちゃったんだろう。


9.3 Compiler directive
 The compiler accepts directives inserted anywhere in the
sequence of input records; there directives affect subsequent
records. A directive record is marked by the character '@' in
character position 1 followed by the directive starting position 2.
The admissable directives and their functions are:

@LIST List source records. (Initial option).

@NOLIST Do not list source records.

@TITLE,  Continue any subsequent listing on a new page.
The comma and string are optional; if present, the string (of up to 30)
characters strinpped of the enclosing quotes is used as a title in
the centre of the heading line of the new page and subseqent pages.
@SYNTAX Check the program for syntax errors but do not execute.

@STACK Dump the current contents of the parsing stack if a pass 2
error should occur (cf. Appendix II) with the most recent syntactic
element listed last.

@NOCHECK Omit checks on subscript ranges and references compatibility and
the initialisation of variable to "undefined".

@DEBUG, n(m) Activate the debugging facilities. (cf. 9.4)

Turbo-Pascal には~というの禁止 :)

■_ call by

Algol-Wについて調べているときに見つけた Language Comparison Table - Rosetta Code にあった記述。

Python 	Call by object reference
Ruby 	by reference 
  

…あれ?

で、Python のほうにあったリンクの先。

Python syntax and semantics - Wikipedia, the free encyclopedia

All variables in Python hold references to objects, and these references are passed to 
functions; a function cannot change the value of variable references in its calling 
function. Some people (including Guido van Rossum himself) have called this 
parameter-passing scheme "Call by object reference."

■_

2011年02月21日

■_

ああそういえば grep では '\'( '\)' なのに egrep では '(' ')' になった理由ってどこかに書かれてたっけ? フクロウ本にもなかったと思うのだけど。

・プログラム意味論
図書館から借りて読んでます。復刊.com でも投票がありますけどどうなんですかね。 復刊されれば買うだろうし、うれしいとは思いますが それでいつまで手に入る状態が続くのかと。

■_ プログラマーへ問題/a>

Programming Interview Questions

Intro 

This is a summary of the questions I got in 9 in-person interviews with 5 companies 
and about 10 phone screens 8/02-11/02. The interviews were pretty evenly split between 
very large, large, and startup-sized tech companies. 
 
The good news is that interview question repertoire is generally very limited. The 
Programming Interviews Exposed book covered or helped on probably 60-70% of questions 
I got. Well worth the $20. 

Linked Lists
リンクつきリスト

This is an extremely popular topic. I've had linked lists on every interview. 
You must be able to produce simple clean linked list implementations quickly. 

これはとてもポピュラーなトピックで、わたしはすべての面接でリンクつきリスト
を使います。シンプルでクリーンなリンクつきリストを即座に実装できなければ
なりません。

 * Implement Insert and Delete for
   以下のリンクつきリストにおける挿入と削除を実装せよ
   o singly-linked linked list
     単方向リンクつきリスト
   o sorted linked list
     ソートされたリンクつきリスト
   o circular linked list
     環状リンクつきリスト
 
 int Insert(node** head, int data) 
 int Delete(node** head, int deleteMe) 
 
 * Split a linked list given a pivot value
   与えられたピボット値でリンクつきリストを分割せよ

   void Split(node* head, int pivot, node** lt, node** gt)

 * Find if a linked list has a cycle in it. Now do it without marking nodes.
   あるリンクつきリストが循環リストであるかどうか判定せよ。
   ノードを作ることなく行うこと。

 * Find the middle of a linked list. Now do it while only going through the list once. 
   (same solution as finding cycles)
   リンクつきリストの中間点を見つけ出せ。
   これを、リストをただ一度だけ走査することで行え。
 
Strings 
 
 * Reverse words in a string (words are separated by one or more spaces). Now do it 
   in-place. By far the most popular string question!
   文字列中に存在する単語を取り除け(単語とはひとつ以上の空白で区切られたもの)。
   これをほかに領域を用意せずに行え。
   これは最もよく出される文字列問題である!

 * Reverse a string
   文字列を反転せよ

 * Strip whitespace from a string in-place
   ほかに領域を用意することなく文字列から空白を除去せよ
    void StripWhitespace(char* szStr)

 * Remove duplicate chars from a string ("AAA BBB" -> "A B")
   文字列から重複した文字を取り除け ("AAA BBB" であれば "A B" に)

   int RemoveDups(char* szStr)

 * Find the first non-repeating character in a string:("ABCA" -> B )
   文字列中の、重複のない最初の文字を見つけ出せ

   int FindFirstUnique(char* szStr) 
 
 * More Advanced Topics:
   より高度なトピック

 o You may be asked about using Unicode strings. What the interviewer is usually 
   looking for is:
   Unicode 文字列を使うように求められるかもしれない。
   そういった場合の interviewer は一般的に以下のことを求める:

 + each character will be two bytes (so, for example, char lookup table you may have 
   allocated needs to be expanded from 256 to 256 * 256 = 65536 elements)
   各文字は二バイトになる可能性がある (つまり、たとえば文字のルックアップテーブルを
   使おうとしたときに必要となる領域は 256要素から 256*256 つまり 65536 要素
   となる)
#っておい。

 + that you would need to use wide char types (wchar_t instead of char)
   ワイド文字型 (wchar_t) を使う必要があるだろう

 + that you would need to use wide string functions (like wprintf instead of printf)
   ワイド文字列関数 (printf に対応する wprintf など) を使う必要がある


 o Guarding against being passed invalid string pointers or non nul-terminated strings 
   (using walking through a string and catching memory exceptions
   不正な文字列ポインターや、nul 終端されていない文字列が渡された場合の対処
 
Binary Trees 
二分木

 * Implement the following functions for a binary tree:
   二分木に対する以下の関数を実装せよ

   o Insert 
   o PrintInOrder 
   o PrintPreOrder 
   o PrintPostOrder

 * Implement a non-recursive PrintInOrder
   再帰を使わずに PrintInOrder を実装せよ
 
Arrays 
配列

 * You are given an array with integers between 1 and 1,000,000. One integer is in the 
   array twice. How can you determine which one? Can you think of a way to do it using 
   little extra memory.

   1 から 1,000,000 までの整数を使った配列が与えられたとする。この配列中にあるひとつの
   整数が二つ存在している。どうやればその値を見つけ出せるか?
   最小のメモリを使った手法を見つけ出せるか?

 * You are given an array with integers between 1 and 1,000,000. One integer is 
   missing. How can you determine which one? Can you think of a way to do it while 
   iterating through the array only once. Is overflow a problem in the solution?
   Why not?

   1 から 1,000,000 までの整数を使った配列が与えられたとする。この配列中であるひとつの
   整数が抜けている。どうやればその値を見つけ出せるか?
   配列に対するイテレートをただ一度だけ行って、その値を見つけ出す方法を考えつくか?
   その解決策においてオーバーフローは問題となるか? それはなぜか?


 * Returns the largest sum of contiguous integers in the array
   配列中に存在する連続した整数列の largest sum を返せ

   Example: if the input is (-10, 2, 3, -2, 0, 5, -15), the largest sum is 8
   例: 入力が (-10, 2, 3, -2, 0, 5, -15) であった場合の largest sum は 8となる

   int GetLargestContiguousSum(int* anData, int len)

 * Implement Shuffle given an array containing a deck of cards and the number of cards. 
   Now make it O(n).
   トランプの deck と数字からなる配列を受け取り、それをシャッフルする手続きを
   実装せよ。また、それを O(n) で行え。

 * Return the sum two largest integers in an array
   配列中の大きい方から二つの整数の和を返せ

   int SumTwoLargest(int* anData, int size)

 * Sum n largest integers in an array of integers where every integer is between 0 and 9
   それぞれが0から9の間の値である整数からなる配列の大きい方 n 個の和を求めよ

   int SumNLargest(int* anData, int size, int n) 
 
Queues 
キュー

 * Implement a Queue class in C++ (which data structure to use internally? why? how to 
   notify of errors?)
   C++ でキュークラスを実装せよ
   (内部的に使うデータ構造はなに? それはなぜ? エラーを認識するには?)
 
Other 
 
 * Count the number of set bits in a byte/int32 (7 different solutions)
   バイトもしくは32ビット整数で、セットされているビットを数えよ
   (七種類の方法で)

 * Difference between heap and stack? Write a function to figure out if stack grows up 
   or down.
   ヒープとスタックの違いとは?
   スタックが grows up するか grows down するかを見分ける関数を記述せよ

 * SQL query to select some rows out of a table (only because I had SQL on the resume)

 * Open a file as securely as possible (assume the user is hostile -- list all the 
   nasty things that could happen and checks you would have to do to)
   可能な限り安全にファイルをオープンせよ
   (ここでユーザーが hostile であると仮定する。つまりすべての起こりうる nasty things
   をリストアップし、行うべきことをチェックせよ)

 * Implement a function to return a ratio from a double (ie 0.25 -> 1/4). The 
   function will also take a tolerance so if tolerance is .01 then FindRatio(.24, .01) 
   -> 1/4
   double から有理数 (たとえば 0.25→1/4 のように) へと変換する関数を実装せよ。
   この関数は

   int FindRatio(double val, double tolerance, int& numerator, int& denominator) 

以下略

Copyright © 2002-2004 Maksim Noy. All rights reserved. 

■_

Algol-W 結構面白い。 Pascal ではなくなってしまったものとか変更されたものがいろいろある。

■_


一つ前へ 2011年2月(中旬)
一つ後へ 2011年3月(上旬)

ホームへ


リンクはご自由にどうぞ

メールの宛先はこちらkbk AT kt DOT rim DOT or DOT jp