ときどきの雑記帖 i戦士篇

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

一つ前へ 2008年11月(中旬)
一つ後へ 2008年12月(上旬)

ホームへ

2008年11月30日

■_

・ゆず湯
銭湯に行ったら、毎年冬至にやっているゆず湯の案内があった。 そうか今年は冬至は日曜日なのね。

・で
よーやくひらしょーさんの本を購入。 会長も推していたのに背中を押されました(笑)

■_ 変数に格納されている内容で変数を指定(シンボリックリファレンスとか可変変数とか)

UWSCにおける変数の扱い方 -OKWave
UWSCにおける変数の扱い方

UWSCでの質問です。
変数を変数で指定することは可能でしょうか?

joken = 1
ka_mes = "OK"
hi_mes = "NG"
ifb joken = 1 then
hensu = ka
else
hensu = hi
msgbox(hensu + "_mes") // ←この結果として「OK」と表示させたい

簡略化していますので、この例では、素直にif文のthenとelseにmsgbox命令を書けばいいのです
が、実際のプログラムはhensuを何度も使うためそうもいきません。

よろしくお願いします。

うーむ UWSCでもこの手の質問が出るか。 ハッシュ(連想配列)やら普通の配列を使うのは迂遠でわかりづらいということなんだろうか? んで、回答の中に evalを使ったもの(UWSCもeval持ってるのか)があるのだけど、 今回のこの目的のために evalのはいかにもカミソリ使うべきところに斧を持ち出した感がある。 PHPの方はよくわからないけど、 Perlではシンボリックリファレンスはあまり推奨されていないテクニックだったりする。 一応その理由も挙げられているわけだけど、仮にその辺クリアできたとして、 言語仕様的にシンボリックリファレンス的な機能を入れるということの メリットとデメリットはどんなものがあるだろうか。 と考えようとしたがいい加減夜遅いので寝るw

■_ しつこく三項演算子/条件演算子

すんません。書ききれませんでした○| ̄|_ 一応書こうとしたネタを箇条書きにしておくと (twitterでつぶやいたことが大半ですが)

・入門書の類を見るとも意外にも?「条件演算子」が多数派で、
  「三項演算子」を使っている本でも条件演算子という名称を併記していた。
  三項演算子のみだったのは一冊だけ。
・K&R日本語版の記述。2.11 Conditional Expressions の最初のパラグラフ問題?
・索引を見ると、三項演算子は載っているが条件演算子はない
・でも巻末のリファレンスマニュアルの A7.16 Conditional Operator は条件演算子と訳出

ま、ゆるゆるとまとめまする。

■_

shiroさんに反応してもらえると嬉しいです(笑)。今回はそこからさらに広がっていて、 それらも非常に興味深く読ませていただきました。



Shiro(2008/11/29 16:48:46 PST ループ検出)

リンクつきリストにループ部分があるかどうかを確かめる - ときどきの雑記帳

最後の "Best solution" にあげられてる「うさぎと亀」は あらゆるLisp/Scheme処
理系で使われていると思う。list?は 循環リストについても停止しないとならないため。 (CLの
listpは最初のペアしか見ないのでちょっと違うが、 lengthなどは循環リストを検出しないとだ
め)。

難しいのはcar方向にも循環する場合、つまり木の場合で、 これはvisitした全ノードを何らか
の方法で区別する (マークをつける、 ハッシュテーブルに記録する、みつけたものから移動し
てゆく、など) しかないと思うのだけれど、もっと効率の良い方法はあるのだろうか。

循環がある場合も停止する必要はあるけれど、必ずしもタイトに循環を検出しなくても良い、 
という用途はあって、その場合は適当なところまで循環を気にせずに処理を進めて 怪しくなっ
たら循環検出モードに切り替える、という手はある。 Adams&Dybvigのr6rs equal?実装と
か。

「あらゆるLisp/Scheeme処理系で使われている」ですか。 まじめに読んだLisp処理系って、大昔のZ80上で動くのとか、 アスキーからでていた全三巻のCの本(タイトル失念。MakeとかForthもどきとか作るやつ)に あったのくらいで、それもほとんど忘れています(苦笑) Guileとかgaucheもコンパイルするだけで中身はあまり読んでいなかったっ

■_



ふざけた変数名を使う奴 [bbs2chreader]

457 仕様書無しさん [] Date:2008/11/28(金) 04:13:51  ID: Be:
    普通に性別とかでsexってはずかしいだろ。
    バグ直してるときとか、女のプログラマに変数sexがどうのこうのいうのか? 

459 仕様書無しさん [sage] Date:2008/11/28(金) 04:35:39  ID: Be:
    恥ずかしがるな!
    SextonとかSexsmithみたいな町や人の名前だってあるじゃないですか
    Win32APIにだってなんとかSEXてのがあるじゃないですか 

463 仕様書無しさん [sage] Date:2008/11/29(土) 17:32:18  ID: Be:
    sexadecimalが正当だよな。hexadecimalは邪道。

Jargon fileあたりで読んだような覚えがあるな>hexadecimalがおかしいと考えられる理由とか。

ぐち0x1A ~次スレが立たなくて困る~ [bbs2chreader]
581 仕様書無しさん [sage] Date:2008/11/12(水) 09:30:50  ID: Be:
    読売新聞の夕刊で連載中(翌日の朝刊にも載る)の「SOSの猿」っつう小説で
    PGの出したバグがきっかけになる事件が展開中なんだが

    作者はIT業界出身らしいが、本当にPGの実態を知っているのか?と毎回('A`)な
    顔になる・・・

583 仕様書無しさん [] Date:2008/11/12(水) 15:09:32  ID: Be:
    >>581
    伊坂幸太郎さん 読売新聞連載小説「SOSの猿」 : 出版トピック : 本よみうり堂 : YOMIURI ONLINE(読売新聞)
     ttp://www.yomiuri.co.jp/book/news/20080930bk04.htm


    これか?内容見ていると、単なる妄想作家にしか見えないんだけど。 

584 仕様書無しさん [sage] Date:2008/11/12(水) 15:50:52  ID: Be:
    伊坂幸太郎か。
    奴の最新作『モダンタイムス』でもSEが「SE魂」とやらを発揮して、既存システムのコードを
    ハックする所から話が展開するという頓珍漢なストーリーだったからなぁ。
    作家になる前は富士通のSEだったらしいが。 

585 仕様書無しさん [sage] Date:2008/11/12(水) 16:57:02  ID: Be:
    どうりでわかってないわけだw 

586 仕様書無しさん [] Date:2008/11/12(水) 17:03:46  ID: Be:
    不治痛かwww

    まさか・・・痛じゃなくてあべしのSEだったとか? 

587 仕様書無しさん [sage] Date:2008/11/12(水) 17:47:22  ID: Be:
    あぁ、うちも読売なんてたまに目を通すけど
    なんていうか、その・・・・('A`) な気分になるな
    FのSEだったのか、非常に納得w

588 仕様書無しさん [sage] Date:2008/11/12(水) 18:33:09  ID: Be:
    某スレのスーパーSE様を髣髴とさせるな 

589 仕様書無しさん [sage] Date:2008/11/13(木) 00:45:03  ID: Be:
    >>584
    俺の親父は、新聞でその人の小説を目にするたびに
    あいつは、昔うちの会社を転覆させたFのエンジニアを
    思い出すって何度も言うぞw 

672 仕様書無しさん [sage] Date:2008/11/29(土) 15:37:15  ID: Be:
    Step:1
    とある会社に2ヶ月契約で偽装派遣される。
    内情はガタガタで、仕様未確定が多く、作業に着手する事が出来ない箇所が多い。
    それじゃあという事で別作業を振られる。
    そんなこんなで契約期間終了。

    Step:2
    次の現場が同社の別プロジェクト。
    現プロジェクトやってる最中に、前プロジェクトメンバから
    「君にやってもらうはずだった箇所の仕様が固まったから作っておいて」
    「君にやってもらいたい作業があるんだけど、急ぎでやっておいて」
    「○○さんが忙しいから、作業引き継いでね」
    と、毎日のように作業依頼が。
    そもそも、受ける義務ないし。

    Step:3
    現プロジェクトが火を噴き始め、前プロジェクトの作業依頼を全て無視。
    前PMが自社の上司に「お前のところの社員は派遣先の指示も聞けないのか」とクレーム。
    上司に呼び出され、説教、賞与減額を伝えられる。

    Step:4
    人生に疲れました。さようなら。 

673 仕様書無しさん [sage] Date:2008/11/29(土) 18:04:52  ID: Be:
    >>672
    さようならの前に、然るべき処に晒すべし。 

674 仕様書無しさん [age] Date:2008/11/30(日) 08:00:50  ID: Be:
    SE:「納品先のサーバでブルースクリーンが出た。大至急検証して2時間以内に不具合内容と修正日数をくれ。」
    俺:「ブルースクリーンの内容は?」
    SE:「システム管理者に連絡して再起動しろ云々だった」
    俺:「って事は見て来たん?」
    SE:「訪問して、再起動して、一応動いてるのは見て来た。再発するとマズいから早く調べて。」
    俺:「で、ブルースクリーンの内容は?」
    SE:「だから!再起動しろって出てたって言ったじゃん!」
    俺:「ブルースクリーンの一番上の行のエラーコードは?」
    SE:「16進数でズラズラ書いてあるやつ?あんなの役に立たないだろ」
    俺:「役に立つわ!ソフトかハードか原因の切り分けが出来ねえじゃねえか!」
    SE:「まだ導入して半年のサーバだからハード障害は無いでしょ」俺:「あのさぁ・・・」

    ここで再度納品先からブルースクリーンが出たとのTEL。
    電話代わって軽くヒアリング。

    パ リ テ ィ ー エ ラ ー じゃねえか!

    疲れた。

675 仕様書無しさん [sage] Date:2008/11/30(日) 11:38:10  ID: Be:
    乙w 

676 仕様書無しさん [sage] Date:2008/11/30(日) 13:13:51  ID: Be:
    >>674
    そのSEもだいぶやられてるな。

672と674に合掌。 しかし読売新聞にそんな面白いものが載っていたとは気がつかなんだ(笑)

関数型プログラミング言語Haskell Part9 
892 デフォルトの名無しさん [sage] Date:2008/11/26(水) 13:02:02  ID: Be:
    Haskell: The Craft of Functional Programming
    と
    Programming in Haskell
    のどちらがお勧めですか?ふつけるの次くらい。 

893 デフォルトの名無しさん [sage] Date:2008/11/26(水) 21:24:32  ID: Be:
    >>884
    下手糞な翻訳の恐れ大。最近多いね、いや昔からか 

894 デフォルトの名無しさん [] Date:2008/11/26(水) 22:52:49  ID: Be:
    Programming in Haskellはいいよ。ふつけるの前でもいいです。 

895 デフォルトの名無しさん [sage] Date:2008/11/27(木) 19:14:12  ID: Be:
    >>892
    自分はふつけるの後にCraftでした。というか、その間にSICPが
    あるので、あんまり参考にならないかな。ふつける読んでも
    ちょっとピンとこなかったんですね、よくまとまってるとは思うのですが。

    自分は普通の文系プログラマで、関数型プログラミングの世界とは
    無縁だったので、SICPをくぐる必要があったと感じてます。

896 デフォルトの名無しさん [] Date:2008/11/27(木) 19:30:50  ID: Be:
    Craftはいつ第3判が出るのですか? 

897 デフォルトの名無しさん [sage] Date:2008/11/27(木) 19:55:34  ID: Be:
    Craft第2版以降で目立ったHaskellの技法というと、Arrowぐらいでしょうか。

    あとはReal Worldみたいな実用面を書いたものになりますかね。 

898 デフォルトの名無しさん [sage] Date:2008/11/27(木) 20:02:06  ID: Be:
    ガンズのニューアルバムが出るころに出版されるそうです。 

899 デフォルトの名無しさん [sage] Date:2008/11/28(金) 20:17:32  ID: Be:
    それは出版されないってのとどう違うのだ 


Programming in Haskellはたしか いけがみさんが誉めていたから、無条件で買いでいいと思う。 ガンズが ガンズ・アンド・ローゼズ (Guns N' Roses)のことだとすると、 つい最近アルバムが出ることが決定してそれでひと騒動あったらしいよw > 899 ガンズ・アンド・ローゼズの新作リリースにより、コーラ無料配布決定(BARKS) - Yahoo!ニュース ガンズ・アンド・ローゼズ:激怒!「ドクター・ペッパー」を提訴へ - 毎日jp(毎日新聞)

【初心者お断り】ガチ規格準拠C専用スレ Part133

543 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:08:44  ID: Be:
    そういやC言語ってC++0xみたいなのって進んでるの? 

544 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:10:59  ID: Be:
    C99 の先は一応議論されてはいるみたいだが、
    あまり熱心ではなさそうだ。
    C99 でもう C としては十分だろうし・・・。
    これ以上追加していくと C++ になりそうだ。 

545 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:12:43  ID: Be:
    C99でさえなかったことにされてるのにその先なんて… 

548 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:16:28  ID: Be:
    restrict とか [const] とかはやり過ぎだとは思うが
    局所変数宣言位置自由とか inline とか
    main での return 省略とかは地味に良いんだがなあ・・・。 

549 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:18:17  ID: Be:
    C99なんかCじゃない
    sizeofがコンパイル時に確定しないような変態言語がCを名乗るな 

550 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:18:51  ID: Be:
    gcc拡張が標準化されればいいや 

551 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:19:27  ID: Be:
    >>549
    kwsk 

553 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:22:06  ID: Be:
    int a[n]; の時の sizeof a が実行時に決まるってだけだ 

558 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:25:12  ID: Be:
    >>553
    thx!
    むしろint a[n]; ができる方がすげー 

559 デフォルトの名無しさん [sage] Date:2008/11/21(金) 00:26:42  ID: Be:
    alloca みたいなもんだな。
    スタック上に確保されるだろうから
    大きな値を使われるとオーバーフローするかもな。 

561 デフォルトの名無しさん [sage] Date:2008/11/21(金) 11:01:31  ID: Be:
    longjmpで抜けた場合には解放される保証がないということから、処理系によってはヒープ上かも 

564 デフォルトの名無しさん [sage] Date:2008/11/21(金) 23:42:04  ID: Be:
    >>561
    > longjmpで抜けた場合には解放される保証がない
    ここを詳しく

565 デフォルトの名無しさん [sage] Date:2008/11/21(金) 23:49:03  ID: Be:
    longjmpで抜ければ、普通スタックは巻き戻される。
    つまりスタックにallocateしているなら、解放される。

    mallocしたメモリと同じようにヒープに確保して、
    暗黙のうちに関数のエピローグでfreeしているとすると
    longjmpで抜けてしまうと関数のエピローグを通らないから
    freeされない。つまり、解放される保証がない。 

566 デフォルトの名無しさん [sage] Date:2008/11/22(土) 00:18:34  ID: Be:
    保証が無いってのが微妙な表現だな。
    スタック使っても、ヒープ使っても、
    サイズによってどっち使うか決めても規格合致ってことか。 

567 デフォルトの名無しさん [sage] Date:2008/11/22(土) 00:33:57  ID: Be:
    >>564
    longjmpのところに↓のようなことが書かれてる

    EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
    might cause memory associated with a variable length array object to be squandered.
    #include <setjmp.h>
    jmp_buf buf;
    void g(int n);
    void h(int n);
    int n = 6;
    void f(void)
    {
    int x[n]; // OK, f is not terminated.
    setjmp(buf);
    g(n);
    }
    void g(int n)
    {
    int a[n]; // a may remain allocated.
    h(n);
    }
    void h(int n)
    {
    int b[n]; // b may remain allocated.
    longjmp(buf,2); // might cause memory loss.
    } 

568 デフォルトの名無しさん [sage] Date:2008/11/22(土) 00:38:09  ID: Be:
    なるほど。may に might か。
    開放される実装になってても規格違反ってわけじゃないのね。 

569 デフォルトの名無しさん [sage] Date:2008/11/22(土) 06:35:20  ID: Be:
    関係ないけど、そのsetjmpの使い方、未定義ですな 

571 デフォルトの名無しさん [sage] Date:2008/11/23(日) 09:05:10  ID: Be:
    setjmpは条件式の中からしか呼べないんだっけ? 

572 デフォルトの名無しさん [sage] Date:2008/11/23(日) 13:03:50  ID: Be:
    なんだ? そのわけわかめな制限は。 

573 デフォルトの名無しさん [sage] Date:2008/11/23(日) 13:35:20  ID: Be:
    setjmp の使い方を考えれば至極妥当だと思うが・・・。
    無限ループになるぜ。 

574 デフォルトの名無しさん [sage] Date:2008/11/23(日) 13:38:23  ID: Be:
    無限ループになるかどうかも未定義か 

575 デフォルトの名無しさん [sage] Date:2008/11/23(日) 13:40:44  ID: Be:
    An invocation of the setjmp macro shall appear only in one of the following contexts:
    - the entire controlling expression of a selection or iteration statement;
    - one operand of a relational or equality operator with the other operand an integer
    constant expression, with the resulting expression being the entire controlling
    expression of a selection or iteration statement;
    - the operand of a unary ! operator with the resulting expression being the entire
    controlling expression of a selection or iteration statement; or
    - the entire expression of an expression statement (possibly cast to void).
    If the invocation appears in any other context, the behavior is undefined.

    ・・・だそうだ 

576 デフォルトの名無しさん [sage] Date:2008/11/23(日) 13:43:11  ID: Be:
    環境限界 setjmp マクロの呼出しは,次に示すいずれかの文脈にしか現れてはならない。

    ・選択文又は繰返し文の制御式全体
    ・他方のオペランドが整数定数式である関係演算子又は等価演算子の一方のオペランド。
     この場合,関係演算子又は等価演算子による式は,選択文又は繰返し文の制御式全体でなければならない。
    ・単項 ! 演算子のオペランド。この場合,単項 ! 演算子による式は,選択文又は繰返し文の制御式全体でなければならない。
    ・式文の式全体(void にキャストされていてもよい。)。
     setjmp マクロの呼出しがこれ以外の文脈に現れた場合,その動作は,未定義とする。

    要するに、
    ・「if(A)」「switch(A)」「while(A)」「for(X;A;Y)」のどれかのAの場所に、
    「setjmp(buf)」「setjmp(buf) op Z」「Z op setjmp(buf)」「!setjmp(buf)」
     (opは> < >= <= == !=のどれか) のいずれかの形で出てくるか
    ・単に「setjmp(buf);」「(void)setjmp(buf);」の形で出てくるか

    どっちかでないと鼻から悪魔 

577 デフォルトの名無しさん [sage] Date:2008/11/23(日) 13:45:52  ID: Be:
    なら別にそのまま使ってもいいのか。 

578 デフォルトの名無しさん [sage] Date:2008/11/23(日) 14:04:21  ID: Be:
    制御文の中で直接真偽判定する以外にその値を使ってはいけないってことかな 

579 デフォルトの名無しさん [sage] Date:2008/11/23(日) 14:10:20  ID: Be:
    longjumpから帰ってきたかどうかを示す値が揮発性だってこと? 

580 デフォルトの名無しさん [sage] Date:2008/11/23(日) 22:36:28  ID: Be:
    sequence point間に単独で置いとけってことだろう。 

582 デフォルトの名無しさん [sage] Date:2008/11/24(月) 15:09:46  ID: Be:
    久しぶりに覗いてみたら、かつてのfj.lang.cなみのマジキチぶりにワロタ 

584 デフォルトの名無しさん [sage] Date:2008/11/24(月) 23:39:27  ID: Be:
    fj.lang.cってどこのサイトですか? 

585 デフォルトの名無しさん [] Date:2008/11/25(火) 00:05:57  ID: Be:
    >>584
    http://ja.wikipedia.org/wiki/Fj_(%E3%83%8B%E3%83%A5%E3%83%BC%E3%82%B9%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97) 

586 デフォルトの名無しさん [sage] Date:2008/11/25(火) 00:16:53  ID: Be:
   >>>585
    トン。
    理解力ないんでよくわかんなかったw
    スレタイよくみたら初心者お断りなので帰ります。。。λ 

587 デフォルトの名無しさん [sage] Date:2008/11/27(木) 13:57:38  ID: Be:
    >>584
    マジレスするとネットニュース。
    Webからアクセスできるゲートウェイも存在するが、
    「どこのサイト?」とか言っちゃうあたり時代はかわったんだなぁと思った。 

588 デフォルトの名無しさん [sage] Date:2008/11/27(木) 14:11:53  ID: Be:
    俺は>>584ネタかと思ったよ 


【初心者歓迎】C/C++室 Ver.61【環境依存OK】

519 デフォルトの名無しさん [sage] Date:2008/11/28(金) 19:55:12  ID: Be:
    placement newで組み込み数値型やポインタ変数を作ったときって、デストラクタ呼ぶべきなんでしょうか。 

520 デフォルトの名無しさん [sage] Date:2008/11/28(金) 20:23:31  ID: Be:
    いらない 

521 デフォルトの名無しさん [sage] Date:2008/11/28(金) 21:03:04  ID: Be:
    組み込み型のデストラクタって呼べるんだっけ 

522 519 [sage] Date:2008/11/28(金) 21:12:06  ID: Be:
    回答ありがとうございます。
    改めて考えてみると一番の疑問のありどころが>>521で
    デストラクタ呼べるのならどうせ最適化で消えるだろうし、
    呼ぶのが未定義の動作を招くのなら違うコードを作ろうと思っていました。

    VC++2008では
    template<typename T>
    void call_destructor(T &obj)
    {
    obj.~T();
    }
    というコードで問題なく動いているように見えます。 

523 デフォルトの名無しさん [sage] Date:2008/11/28(金) 22:59:16  ID: Be:
    うーむ

    5.2.4 擬似デストラクタの呼び出し
    1 ドット演算子.又は矢印演算子->の後ろに≪疑似デストラクタ名≫を付けた表現は、型名の表す非クラス型に対するデストラクタを表す。
    その結果は、関数呼び出し演算子()の演算対象にしか使ってはならず、その呼び出し結果の型は、void型とする。
    その効果は、ドット又は矢印の前にある≪後置式≫を評価することだけとする。

    これ読む限り、こんな風に書けて、効果は「i;」と同じ、っていう風に読めるけどなぁ
    VC++2008は文法エラーではねつける…(522のcall_destructor<int>は通るのに)

    int i;
    i.~int();

    規格に詳しい人頼む 

524 デフォルトの名無しさん [sage] Date:2008/11/29(土) 05:27:56  ID: Be:
    >>523
    文法要素としての擬似デストラクタ名 pseudo-destructor-name の中で、 ~ の後ろに
    現れるのは type-name なんだけど、文法要素としては識別子とは別格のキーワードである
    int, long, ... などはこの type-name に含まれないので文法エラーになる。

    ちなみに、一般に「型名」と呼ばれる箇所は、文法要素としては simple-type-specifier が
    対応し、これには type-name 単体に加えて、それに名前空間指定などを追加したものも
    含まれるほか、 int, long, ... などの組み込み型をあらわすキーワードも含まれる。

    完全に文法上の問題でキーワードを受け付けないだけなので、↓なら通ったりする。

    typedef int Int;
    Int i;
    i.~Int(); 

■_

後で読む(つもり)

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HARM-0.1.3
http://www.cse.unsw.edu.au/~rl/publications/recycling.html


Grandfather of Haskell and ML.
http://www.reddit.com/r/haskell/comments/7gadj/grandfather_of_haskell_and_ml/
http://www-perso.iro.umontreal.ca/~feeley/cours/ift6232/doc/the-next-700-programming-languages.pdf


A Brief History of Software Engineering
Niklaus Wirth (Wirth@inf.ethz.ch) (25.2.2008)
http://www.inf.ethz.ch/personal/wirth/Articles/Miscellaneous/IEEE-Annals.pdf

2008年11月29日

■_

・今月の皇帝陛下
ごーとぅー いーじぷと。

・買った
アップルを創った怪物―もうひとりの創業者、ウォズニアック自伝
Windowsダンプの極意 エラーが発生したら、まずダンプ解析!Windowsダンプの極意 エラーが発生したら、まずダンプ解析!
ひらしょーさんの本を買おうと思っていたのだけど、ウォズ本を見つけてしまいあとまわしに。 あと、オライリーのノベルティの獣の表紙なメモパッド。 PerlのやらPythonのやら十種類ほどあるみたいだけど、 あれ全部そろえるには十冊買えと? 読みたいのはたいてい出てすぐ買っているから、いまさら十冊も買うものねーよ(笑) 財布の中身にも厳しいしなっw

■_ ez_install

cpanとかgemとかのようなものがPythonにはないのかという話で。



【Perl,PHP】LLバトルロワイヤル3【Ruby,Python】
361 デフォルトの名無しさん [] Date:2008/11/26(水) 21:50:25  ID: Be:

    perl の cpan
    ruby の gem
    php の pear

    最もメジャーなpython のパッケージマネージャは ez_install でいいのか。 

例によって説明の詳しいところは省略しています。



Lazy Pythonista: Why I don't use easy_install

Why I don't use easy_install

First things first, this post is not meant as a flame, nor should it indicate to you 
that you shouldn't use it, unless of course you're priorities are perfectly aligned 
with my own. That being said, here are the reasons why I don't use easy_install, and 
how I'd fix them.

1. No easy_uninstall. Zed mentioned this in his PyCon '08 lightning talk, and it's 
   still true.


2. I can't update all of my currently installed packages.


3. I don't want to have two package managers on my machine. I run Ubuntu, so I already
   have apt-get, which i find to be a really good system(and doesn't suffer from either
   of the aforementioned problems).


ここでも Zedの名がががががっ

■_ div

なんか捕捉されとるなあ(^^;

プログラミング系のブログ [bbs2chreader]
49 デフォルトの名無しさん [] Date:2008/11/29(土) 17:10:34  ID: Be:
    http://www.kt.rim.or.jp/~kbk/zakkicho/08/zakkicho0811c.html#D20081128-3

    >この関数の意味があったのは、整数除算がとんでもなく遅い時代のことだと思います
    > (今でもほかの命令との実行時間の比で云えば結構なものですが)。
    >今の常識で、なぜあるのかとか考えない方がいいんじゃないでしょうか。

    C の%は符号が絡むと、環境によって結果が違ってくる可能性があるからdev()は有効であるって
    どっかで読んだ記憶があるけど。 

50 デフォルトの名無しさん [sage] Date:2008/11/30(日) 00:08:55  ID: Be:
    浮動小数ならともかく、余りは変わりようがないだろ。
    どれだけ脳味噌にウジが涌いているんだ? 

51 デフォルトの名無しさん [sage] Date:2008/11/30(日) 00:40:21  ID: Be:
    >>50
    符号が環境によって違うことがあるらしいよ。 

52 デフォルトの名無しさん [sage] Date:2008/11/30(日) 03:13:31  ID: Be:
    負数で割ると変わる 

んと、除数と被除数の符号が異なるときの扱いはC99で明文化されてます。 div関数については最近邦訳が出たばかりのC リファレンスマニュアル第5版にあたってみると

除算関数(div/ldiv/lldivのこと)が用意されている理由は、たいていのコンピュータで
商と余りが同時に計算できるからである。したがって、インラインに展開される可能性の
あるこれらの関数を使うほうが、/ と % を別々に使うより速い。
  

とあります。って、これ はじめてのにき(2008-11-30) と食い違いがありますね(^^; まあ、68000とかが現役バリバリだったころのgccは割り算するのに関数呼んでたからなあ。

■_ リンクつきリストにループ部分があるかどうかを確かめる



Finding a Loop in a Singly Linked List

Finding a Loop in a Singly Linked List

Motivation

A singly linked list is a common data structure familiar to all computer scientists. A 
singly linked list is made of nodes where each node has a pointer to the next node (or 
null to end the list). A singly linked list is often used as a stack (or last in first 
out queue (LIFO)) because adding a new fist element, removing the existing first 
element, and examining the first element are very fast O(1) operations.

(ry

Incorrect "Solutions"
間違った方法

Mark Each Node 各ノードに印をつけていく

Traverse the list and mark each node as having been seen. If you come to a node that 
has already been marked, then you know that the list has a loop.

// Incorrect 'solution'
function boolean hasLoop(Node startNode){
  Node currentNode = startNode;
  do {
    if (currentNode.seen) return true;
    currentNode.seen = true;
  } while (currentNode = currentNode.next());
  return false;
}

(ry)

Detect Only Full Loops

(ry

// Incorrect 'solution'
function boolean hasLoop(Node startNode){
  Node currentNode = startNode;
  while (currentNode = currentNode.next()){
    if (currentNode == startNode) return true;
  }
  return false;
}

Inefficient Solutions 効率のよくない方法

(ry

// Inefficient solution
function boolean hasLoop(Node startNode){
  HashSet nodesSeen = new HashSet();
  Node currentNode = startNode;
  do {
    if (nodesSeen.contains(currentNode)) return true;
    nodesSeen.add(currentNode);
  } while (currentNode = currentNode.next());
  return false;
}

Use a doubly linked list 二重リンクつきリストを使う

(ry

// Inefficient solution
function boolean hasLoop(Node startNode){
  Node currentNode = startNode;
  Node previousNode = null;
  do {
    if (previousNode && currentNode.prev() && previousNode != currentNode.prev()) return true;
    if (!currentNode.prev()) currentNode.setPrev(previousNode);
    previousNode = currentNode;
  } while (currentNode = currentNode.next());
  return false;
}

Check the Entire List So Far

(ry

// Inefficient solution
function boolean hasLoop(Node startNode){
  Node currentNode = startNode;
  int i=0;
  do {
    Node checkNode = startNode;
    int j=0;
    do {
      if (checkNode == currentNode) return true;
      j++;
    } while (i<j && checkNode = currentNode.next());
    i++;   
  } while (currentNode = currentNode.next());
  return false;
}

Reverse the list リストを逆転する

(ry

// Solution modifies the list
function boolean hasLoop(Node startNode){
  Node previousNode = null;
  Node currentNode = startNode;
  Node nextNode;
  if (!currentNode.next()) return false;
  while(currentNode){
    nextNode = currentNode.next();
    currentNode.setNext(previousNode);
    previousNode = currentNode;
    currentNode = nextNode;
  }
  return (previousNode == startNode);
}

Credit for this solution goes to Piyush Srivastava.

Best Solutions
Catch Larger and Larger Loops

// Good solution
function boolean hasLoop(Node startNode){
  Node currentNode = startNode;
  Node checkNode = null;
  int since = 0;
  int sinceScale = 2;
  do {
    if (checkNode == currentNode) return true;
    if (since >= sinceScale){
        checkNode = currentNode;
        since = 0;
        sinceScale = 2*sinceScale;
    }
    since++;
  } while (currentNode = currentNode.next());
  return false;
}

This solution is O(n) because sinceScale grows linearly with the number of calls to 
next(). Once sinceScale is greater than the size of the loop, another n calls to 
next() may be required to detect the loop. This solution requires up to 3 traversals 
of the list.

This solution was devised by Stephen Ostermiller and proven O(n) by Daniel Martin.

Catch Loops in Two Passes

(ry

// Best solution
function boolean hasLoop(Node startNode){
  Node slowNode = Node fastNode1 = Node fastNode2 = startNode;
  while (slowNode && fastNode1 = fastNode2.next() && fastNode2 = fastNode1.next()){
    if (slowNode == fastNode1 || slowNode == fastNode2) return true;
    slowNode = slowNode.next();
  }
  return false;
}

This solution is "Floyd's Cycle-Finding Algorithm" as published in 
"Non-deterministic Algorithms" by Robert W. Floyd in 1967. It is also called 
"The Tortoise and the Hare Algorithm".


Copyright Stephen Ostermiller 1996-2008

最後の Best solutionは以前やねうらおさんのところで見たような覚えが (ディテールは違ったかもしれないけど)。

■_ セキュリティIQチェック

以前問題だけ紹介しましたが、解説も含めて日本語訳されました。 セキュリティ クイズ: あなたのセキュリティ IQ をテストする



セキュリティ クイズ: あなたのセキュリティ IQ をテストする

バグ #1 (C または C++)

void func(char *s1, char *s2) {
  char d[32];
  strncpy(d,s1,sizeof d - 1);
  strncat(d,s2,sizeof d - 1);
  ...
}

解答 まず手始めは、とても簡単なものということで、お馴染みのバッファ オーバーランです。
多くの場合、制限付きの strncpy 関数および strncat 関数を使用しているコードは、安全で問
題がないように見えます。しかし、これらの関数は、バッファ サイズが正しい場合にのみ安全
であり、この例ではバッファ サイズが間違っています。まったく違います。

技術的には、1 番目の呼び出しは安全ですが、2 番目の呼び出しは正しくありません。strncpy 
関数および strncat 関数の最後の引数はバッファに残された領域の大きさであり、strncpy を
呼び出すことでその領域の一部または全部を使い果たしています。バッファ オーバーフロー。
Michael が、このバグの種類について 2004 年のブログで的確に解説しています。

Visual C++ 2005 以降では、警告 C4996 によって、不正な関数呼び出しを安全な呼び出しに変
えるように指摘されます。また、/analyze オプションを指定すると、strncat が文字列をゼロ
で終了しない可能性があることを示す C6053 の警告が発生します。

率直に言うと、strncpy と strncat (およびその "n" の同類) は、いくつかの理由
で strcpy と strcat (およびその同類) より劣っています。第 1 に、戻り値に問題があります。
バッファへのポインタが返されますが、バッファは有効かもしれないし、無効かもしれません。
それを知る方法はないのです。第 2 に、対象のバッファのサイズを正確に取得するのは非常に
困難です。このバグを見つけられたら、1 ポイント獲得です。

おお、strncpy/strncatの問題点をきちんと書いているのはえらい。 んで、



セキュリティ クイズ: あなたのセキュリティ IQ をテストする

ランクの確認
ポイントコメント
15+私たちと共に働けます。
11-14 かなり優秀です。これからは、その才能を活かして、 同僚が作成するすべてのコードもチェックしてください。
7-10 そう、まあまあです。多くのことを学習する必要があるのは明らかですが、 いま Web アプリケーションを作成している開発者の 50% よりはおそらく優秀でしょう。
4-6 学習しなければならないことがたくさんあります。お気に入りの本屋に行って、 この記事の著者の 2 人が書いた本をすべて買ってください。
0-3 エディタやコンパイラからは身を引きましょう。 そうすれば、だれも傷つかなくて済みます。

えーと何点取れたかな(^^;

■_

C++相談室 part64

285 デフォルトの名無しさん [sage] Date:2008/11/26(水) 12:58:27  ID: Be:
    C++の初心者向けの本でオススメの本があったら教えて下さい。 

286 デフォルトの名無しさん [sage] Date:2008/11/26(水) 13:15:24  ID: Be:
    accelerated C++
    C++ coding standard 101 

287 デフォルトの名無しさん [sage] Date:2008/11/26(水) 13:16:17  ID: Be:
    C++ Primer 

289 デフォルトの名無しさん [sage] Date:2008/11/26(水) 18:12:04  ID: Be:
    Modern C++ Designマジお勧め 

291 デフォルトの名無しさん [sage] Date:2008/11/26(水) 18:22:41  ID: Be:
    C++初心者向けって聞いてるのにModern C++ Designはないと思う。
    Accelerated C++はマジお勧め。
    学部のプログラミング演習等の副読本にも適していると思う。

292 デフォルトの名無しさん [sage] Date:2008/11/26(水) 18:29:22  ID: Be:
    ロベール 

293 デフォルトの名無しさん [sage] Date:2008/11/26(水) 18:41:45  ID: Be:
    いやいや
    C++が学ぶべき価値がある言語か判断するために最初にMC++Dを眺めとくのは重要
    アレに興味を持って、理解できるようになるまで勉強しようと思えない限りC++には触らない方がいい 

295 デフォルトの名無しさん [sage] Date:2008/11/26(水) 18:49:27  ID: Be:
    >>293 は
    Modern C++ Designの内容を完全理解し、書いてあることを使いこなしているいるのか 

296 デフォルトの名無しさん [sage] Date:2008/11/26(水) 18:59:28  ID: Be:
    自分で使いこなせなくても、既存のテンプレートライブラリを使うことはあるだろうし
    トラブルが起これば中の汚物を読まなきゃならなくなることもあるはずだ
    その時にMC++Dの知識は役に立つ 

297 デフォルトの名無しさん [sage] Date:2008/11/26(水) 19:12:18  ID: Be:
    俺もModern C++ Designは好きだけど初心者にオススメする神経が分からんな。

    普通はマナちゃんのやさしいC++とか柴田望洋とか林晴比古あたりじゃないの。 

298 デフォルトの名無しさん [sage] Date:2008/11/26(水) 19:22:32  ID: Be:
    理解できなくてもパラパラめくるだけでいいよ
    そこで吐き気を催したら引き返した方がいいというだけ 

300 デフォルトの名無しさん [sage] Date:2008/11/26(水) 20:57:10  ID: Be:
    おれは
    独習C → ポインタの極意 → 独習C++ → Effective C++
    で独習C++は選択を間違えたと思えた 

301 デフォルトの名無しさん [sage] Date:2008/11/26(水) 22:09:23  ID: Be:
    ここまで林本なし

    ま、いいことだw 

302 デフォルトの名無しさん [sage] Date:2008/11/26(水) 22:12:14  ID: Be:
    >>300
    独習C++ って俺のC++の最初の本だ
    なっ、なぜそう思うんだ 

303 デフォルトの名無しさん [sage] Date:2008/11/26(水) 22:26:06  ID: Be:
    標準C++/STLの基礎知識3部作
    柏原正三著

    ちょっとあちこちに記述に癖があるけど、それをわかってて
    読むなら結構易しい入門書 

305 デフォルトの名無しさん [sage] Date:2008/11/27(木) 02:01:46  ID: Be:
    >>302
    300じゃないけど、独習C++とかC++入門の類って基本的にどれも同じ匂いがする。
    それぞれ記述に工夫はしているだろうけど、どれもC++の大味なダイジェストにしか過ぎないというか。
    学ぶという点ではAccelerated C++に一票。 

306 デフォルトの名無しさん [sage] Date:2008/11/27(木) 09:02:51  ID: Be:
    独習C++は罠
    絶対途中で飽きる… 

308 デフォルトの名無しさん [sage] Date:2008/11/27(木) 14:49:10  ID: Be:
    &t;>302,305
    独習C++の入門という意味では普通に読了できたんだけど
    その後読んだEffective C++で知らないものばかりでてきて
    独習C++だけじゃ全然知識足りないのかよ,って当時の自分は困ってしまってたから,こういう印象かな

    そのあとは結局大学の図書館でいろんな本あさりまくってしまい効率悪かった
    独習C++の後はこれ読むといいよ,っていうオススメな本とかも思い当たらないしなあ
    でもそういう過程で知識がついたっていうのもあるけど 

309 302 [sage] Date:2008/11/27(木) 18:33:54  ID: Be:
    >>308
    入門書で必要十分な知識なんて得られないと思っている

    独習C++ -> accelerated C++ -> 詳説C++ ってな感じだったな。
    独習C++:C++さわりの勉強
    accelerated C++:C++らしいコーディング、使い方
    詳説C++:より詳しく
    これら全ての読み終わってようやく入門過程終わりって感じかな。入門過程復習を兼ねて
    禿げ教科書を詳説C++の後あたりに読むのも良いかもしれん。
    次は初級過程でEffective C++、Effective STLなど自分の興味に応じて読めって感じだな 

310 デフォルトの名無しさん [sage] Date:2008/11/27(木) 19:46:18  ID: Be:
    Effective C++は必須だろ
    興味なくても読んでくれないと困る 

312 デフォルトの名無しさん [sage] Date:2008/11/27(木) 20:35:05  ID: Be:
    Effective C++読むくらいならExceptional C++のほうがいいと思う。
    Effective C++は当たり前の事ばかり書いててあんま役に立たんかった。 

313 デフォルトの名無しさん [sage] Date:2008/11/27(木) 20:44:47  ID: Be:
    その「当たり前の事」が大事なんだろ
    平気でコンストラクタで仮想関数呼んだり
    デストラクタで例外投げたりするんだぞ初心者は 

314 デフォルトの名無しさん [sage] Date:2008/11/27(木) 21:36:08  ID: Be:
    Effective C++を初めて読んだ後
    基底クラスの非virtual関数と同名のメンバ関数を派生クラスで定義していたのを
    納品前にこっそり修正したのは
    今となってはいい思い出だ 

315 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:01:01  ID: Be:
    C++ depthシリーズ読んだ後で作ったコードレビュー時の俺チェックリストが凄い事になった
    自動化できそうなチェック項目も結構多いんで
    こういうのを自動的に点検してくれるようなコードチェッカーってのが欲しいと思ったな
    精度の高いパーザがあればそう苦労せずにできそうだとは思うけど
    gccならコンパイラオプションでeffective c++に載ってるような間違いに対してある程度警告してくれるんだよね 

316 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:12:10  ID: Be:
    -Weffc++だな
    しょうもないのしかチェックしてくれないけど 

317 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:12:42  ID: Be:
    >>285
    初心者向きなのは
    プログラミング言語 C++
    Effective C++

    上の2つを読んだらこれがおすすめ
    More Effective C++
    C++ In-Depth Series 

318 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:18:15  ID: Be:
    More Effective C++は原著(英語)の方がオススメ
    間違いなく日本語訳より読みやすいから 

319 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:19:17  ID: Be:
    高橋麻奈のやさしいC++やロベールのような最近の本は
    こういう時ろくに話に出てこないよな。 

320 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:20:53  ID: Be:
    C++を「やさしい」なんて言う本はそれだけで信用ならない 

327 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:50:49  ID: Be:
    ダメなC++本の見分け方
    ひとつでも該当したらその本は捨てろ

    ・void main()
    ・定数をマクロで定義してる
    ・コンストラクタの初期化リストを使わない
    ・using namespace std;
    ・意味もなくキャストが旧形式
    ・_で始まる名前を勝手に使う
    ・ヌルポインタがNULL
    ・X x = new X(); if(x == NULL){ ... }
    ・ポリモーフィズムの例え話にAnimalクラス
    ・void operator +=(X)
    ・X& operator +(X,X)
    ・多重継承をとりあえずこきおろすが理由は書いていない
    ・「グローバル関数は危険です、全部メンバ関数にしましょう(キリッ」
    ・「コンストラクタから例外を投げてはいけません(キリッ」

    あと何かな 

328 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:52:15  ID: Be:
    >>327
    using namespace std;を一方的にダメだというのがダメだと思う 

329 デフォルトの名無しさん [sage] Date:2008/11/27(木) 22:55:11  ID: Be:
    古臭い本
    #include <iostream.h>
    auto_ptrをコンテナの要素にする。
    nothrowでないnewの結果をヌルと比較している。 

332 デフォルトの名無しさん [sage] Date:2008/11/27(木) 23:44:25  ID: Be:
    ソースファイルの全てのincludeの後だったら別にいいんじゃね? >328 

333 デフォルトの名無しさん [sage] Date:2008/11/28(金) 00:40:25  ID: Be:
    実際のプログラムでは使うなよ、って書いてあれば十分 

335 デフォルトの名無しさん [sage] Date:2008/11/28(金) 07:16:03  ID: Be:
    というか、初めてC++に入る人間に対して名前空間がどうだあーだって説明してもわからんだろう。
    はじめから順番にやっていってクラスが終わった辺りででてくりゃまだ実感沸くだろうけど。 

336 デフォルトの名無しさん [sage] Date:2008/11/28(金) 09:39:50  ID: Be:
    >>327
    >ヌルポインタがNULL
    現行でどうせいっちゅーんだ?
    C++0xはまだドラフトだぞ。 

337 デフォルトの名無しさん [sage] Date:2008/11/28(金) 10:10:15  ID: Be:
    現行ではヌルポインタは 0 と書くのが一番いいんじゃね 

340 デフォルトの名無しさん [sage] Date:2008/11/28(金) 12:49:22  ID: Be:
    ヌルポインタはreinterpret_cast<void*>(0)だろ常考 

342 デフォルトの名無しさん [sage] Date:2008/11/28(金) 12:58:23  ID: Be:
    >>340
    http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#463
    > A null pointer constant, which has integral type, is not necessarily converted to a null pointer value. 

368 デフォルトの名無しさん [sage] Date:2008/11/28(金) 22:04:57  ID: Be:
    本ネタで思い出したが
    来月ビャーン著の入門者向けの本が出るよ
    http://www.research.att.com/~bs/programming.html 

369 デフォルトの名無しさん [sage] Date:2008/11/28(金) 23:48:01  ID: Be:
    イラネ 

370 デフォルトの名無しさん [sage] Date:2008/11/29(土) 02:47:21  ID: Be:
    ハゲはむしろC++0xの本を

何冊読めばいいんだとか嘆いていたのはみねこあさんだったっけか?

■_ 条件演算子/三項演算子

以前ほどではありませんが、他の人が条件演算子限定のところで使っているとかなり気になります。 積極的にそれが間違いであるとか指摘するつもりはないんですけど。

Cに限定して言えば、K&Rにも、規格書にも「三項演算子」を条件演算子を意味するものとして 書いている部分はありません。 いったいどこから 条件演算子→三項演算子 の活用?が起きたのか非常に興味があるのですが、 図書館(それも国会図書館あたり?)とかいって調べるまでのキリョクはとてもありません。

reddit とか stackoverflow.comあたりでも英語ネイティブ(らしいの)が まさしく conditional operator を使う場面で ternary operator と書いているのを 何回も見てしまったのでいいやもう。と投げたw

2008年11月28日

■_

・すごいぞあまぞん
http://www.amazon.co.jp/dp/B0000C9092 じつはまだ現役で使われてたり?

・gcc4
おお、よーやっと cygwinの setup.exe で gcc4が選択できるように。

■_ 小ネタ



2008-11-27 - JVisiter と AdaptorCommentsAdd Star

久しぶりにデザインパターンの名前を使う。

ところで-erと-orてネイティブの人は間違わずに区別できるのだろうか。

いやあ。Potato を Poteto と堂々と書いた大統領だか副大統領がいるくらいですから 推して知るべしとか。 って引き合いに出した人物が悪いか?(笑)

■_ 昔有効だったものが今でも有効だとは限らない

C言語のdiv関数 - リリカル☆Lisp開発日記 続・C言語のdiv関数 - リリカル☆Lisp開発日記 を見て、どんなコードを吐いているのか調べてみました。 ポイントになるところだけ切り出します。


L2:
	call	_rand
	movl	%eax, -32(%ebp)
	movl	$1431655766, %eax
	imull	-32(%ebp)

(ry

	movl	%eax, 4(%esp)
	movl	-12(%ebp), %eax
	movl	%eax, (%esp)
	call	_div
	movl	%eax, -24(%ebp)
	movl	%edx, -20(%ebp)

	call	_rand
	movl	%eax, -32(%ebp)
	movl	$1431655766, %eax
	imull	-32(%ebp)

(ry

	movl	%edx, %eax
	movl	-28(%ebp), %ecx
	cltd
	idivl	(%ecx)
	movl	%eax, -28(%ebp)
	movl	-28(%ebp), %eax
	movl	%eax, -20(%ebp)
	movl	-12(%ebp), %edx
	leal	-16(%ebp), %ecx
	movl	%ecx, -28(%ebp)
	movl	%edx, %eax
	movl	-28(%ebp), %ecx
	cltd
	idivl	(%ecx)
	movl	%edx, -24(%ebp)
	movl	-20(%ebp), %edx
	leal	-8(%ebp), %eax

惜しいw idivl で edx:eax に商と剰余が求まってるのになあ。

でまあ、この関数の意味があったのは、整数除算がとんでもなく遅い時代のことだと思います (今でもほかの命令との実行時間の比で云えば結構なものですが)。 今の常識で、なぜあるのかとか考えない方がいいんじゃないでしょうか。

■_

一番下の返事が泣ける…… http://okwave.jp/qa4510394.html - cxx Tumblr うん?

C言語で構造体のメンバを簡単に出力する方法ありますか? -OKWave

システムは金融系なのですが、DBのテーブルのカラムをコピーしてExcel2003に貼り付けたら、
長すぎて貼り付けられませんでしたので、カラム数だけでExcelの横幅256項目を超えているよう
です。

構造体もネストの嵐で、ポインタを*、ダブルポインタを**で書くと、
引数として受け取る*構造体Aのメンバに*構造体Bと構造体Cがあり、
*構造体Bのメンバには構造体D配列があり、構造体D各々のメンバに構造体Eがある。
構造体Cのメンバには構造体Fがある。
そして関数には構造体Aの配列として**構造体A配列が渡される・・・
のような(私にはもう何がなにやら・・・の)つくりになっています。
それぞれ、メンバ数は30~250以上とさまざまです。

金融系のシステムって、こんなにデータ使うのか・・・と驚愕している次第です。。
古いシステムのようで、COBOLをC言語でラッパしているようです。
私としては、オブジェクト指向言語で作ればもっと扱いやすくなるのではないか・・・と考えて
いるのですが、なにぶんこの金融危機でお金がないらしくコストのかかる開発はできないようで
す。

私は元々はVB系(の後にJava経験多少アリ)でしたので、Join関数やSplit関数、LBound関数、
UBound関数、Redim関数・・・使い慣れていたものがことごとくC言語に存在しないのでマシン語
に近い高級言語とはこういうものかと、良くも悪くもよい経験をさせてもらっています。

私の開発効率が低く、休日出勤になってしまいそうで皆様へのお返事は遅れてしまうかもしれま
せんが、必ずお返事はいたしますのでしばらくお待ちいただけますようお願いいたします。

もしやと思ったけど、 やっぱりCOBOLのデータ構造をそのままCの構造体に書き写しただけの代物っぽいな。 しかしそのまあなんというか…

2008年11月27日

■_

・Real World Haskell
2ちゃんの関数型言語スレとかではこき下ろしている人もいるので ちと不安に思ったりしているのですが、

Real World Haskell » Blog Archive » Real World Haskell is shipping!
November 25th, 2008 by Don Stewart

Just arrived, the first copy of RWH incarnate! Order your copy now to ship before the holidays!

This was waiting on my doorstep.

This was waiting on my doorstep.

And yes, it even talks about the IO monad More photos of the first copy. 

年内には来るだろう。たぶん。

・VC9
とりあえずライブラリのソースだけ見る必要が微妙に出てきたんですが、 それだけのために6万なんぼだすのもなー。 その次はインストールするだけで70GBだかディスクを消費する豪快さんらしいですが。 「Visual Studio」「.NET」が目指すもの--マイクロソフト幹部に聞く:インタビュー - CNET Japan

・ 10 years ago
なんかドリームキャストが発売されてから十年だそうです。

・あとで(ry
見てみると結構ボリュームがあるでやんの。 How to be a Programmer: A Short, Comprehensive, and Personal Summary

・れびう
セオリー本 - 予定は未定Blog版【レビュー】BOOK REVIEW - 定石を学んで上級プログラマを目指せ | エンタープライズ | マイコミジャーナル
確かに褒めすぎかもねんw

セオリー本 - 予定は未定Blog版
マイコミジャーナルがレビュー記事を出したみたいなので読んでみた。

「これで最後」って言ったけど、ちょっとヨイショしすぎでは?と思ったので一応。

■_ しつこく 三項演算子/条件演算子 について考えてみる

明日以降に。

■_ こんなもんどーっすか?

とある人が、stackoverflowでオブジェクト指向の本(入門書?)を書いているのだけど 構成をどうしたもんかと質問していました。

Suggest chapters/topics for OOP Book - Stack Overflow

I am working on a nuts-and-bolts* book on object-oriented programming. The intent is 
to produce a short but practical tutorial and reference for the major concepts, 
pitfalls, practices, and promises of OOP while staying language-agnostic and steering 
clear of theoretical esoterica.

Each chapter will be devoted to a single concept or topic (including its limitations 
as well as its uses and advantages). Some of the obvious ones (so far) are:

    * Introduction
    * Data
    * Code
    * Object
    * Message
    * Method
    * How an OO interpreter works
    * Information Hiding
    * Classes
    * Prototypes
    * Encapsulation
    * Polymorphism
    * Inheritance
    * Composition
    * Composition vs Inheritance
    * Interfaces
    * Contracts
    * Events
    * Design Patterns
    * Refactoring
    * Unit Testing
    * Test-Driven Development
    * Behavior-Driven Development
    * Domain-Driven Design
    * Aspect-Oriented Programming
    * Glossary
    * Appendices (optional catch-all for related topics, future directions, UML, tools, etc.)

(topics in italics are taken from suggestions below)

What other topics/concepts/chapters would you suggest, and why?

ADDENDUM: suggestions for intended common chapter structure (esp. quotes!) also welcome:

    * Chapter title
    * Chapter quote - like "What has it got in its pocketses?" -- Gollum, for Encapsulation.
    * Short illustrative story or brief description/introduction
    * More formal definition
    * Brief history or background
    * Obvious uses
    * Possible pitfalls and traps
    * Practical advice on topic
    * Code Examples

I am planning to use a different language for the examples in each chapter, so the 
book would not be tied to a particular language - C#, C++, Java, SmallTalk, Ruby, 
Python, Perl, etc. Additional language suggestions welcome also.

[* by nuts-and-bolts I mean a practical how-to guide that primarily explains and 
demonstrates the mechanisms, with minimal theory and math]

■_

パパへの20の質問のうちのひとつ。

Ask a Google engineer - Google Moderator
Do you see the current design of the CPython VM holding back Python the language 
- particularly in terms of adding a JIT, moving away from reference counting for 
garbage collection and the concurrency issues around the GIL?

CPython VMの現時点での設計についてどのようにお考えですか?
特にJITを追加するとか、参照カウンター型のガーベジコレクションを止めるとか
GILにまつわる concurrency issues についてはどうでしょうか?

That's a rather leading question. I personally don't think so, but this is actually a 
level of language implementation where I don't know a whole lot, and have to defer to 
the compiler and VM experts.

That's a rather leading question.
わたし個人はそういったことは考えていませんが、実装している言語のレベルによるのでは
ないでしょうか。わたしは全部を良く知っているというわけではありませんから、
コンパイラーとVMのエキスパートに尋ねる必要があるでしょう。

If you believe CPython cannot be saved, I recommend that you start investing time in 
working with some of the alternative implementations, like PyPy, Jython or IronPython, 
in order to ensure that they will be of sufficient quality to take over if CPython 
ever finds it cannot keep up.

もしあなたが CPython は save できないと信じているのであれば、
わたしはあなたにalternative な実装のいくつか、PyPy や Jython、IronPythonといったもの
を実際に試してみて、それらがCPython ever finds it cannot keep up のときに
取って代わるだけのクオリティを持つことがあるのか確かめることをお薦めします。

Guido van Rossum, San Francisco Bay Area

■_ 素朴な?ギモン

What is ruby on rails and why is it so famous? - Stack Overflow
What is ruby on rails and why is it so famous?
	

i have never hear about this language until i came to this site, why is it so famous?

could you post some example sites developed in this technology? easy with the 
downvotes please, am nub i know :(

thanks

Why is it so famous?:

    * Showed you could make a decent web framework out of a less-known language
    * The 37signals bloggers are good writers/communicators
    * Rolled ORM, MVC, pretty URLs, and easy configuration into an easy-to-use framework
    * Stressed simplicity while 'enterprise' platforms emphasized features and complexity
    * Associated with 37signals's message of simplicity as a business model
    * Ruby has fun, interesting advocates like why the lucky stiff.


■_ よのなかはひろい。とてもひろい

C言語で構造体のメンバを簡単に出力する方法ありますか? -OKWave
いつもお世話になっています。

C言語の質問です。
単体テストログを取るために、
“関数Aをコールする前後で、関数Aに引数として渡す構造体のメンバをすべて”printf(もしく
はfprintf)で出力して比較確認しなければならないのですが、

構造体のメンバが250とか、150とかあり、メンバ名もxxx_01,xxx_02などのようにエクセルなど
で簡単に加工して作れるものではないので、いちいちメンバ名を指定しなければならないのでと
ても大変です。

オブジェクト指向言語なら、for each文とかでオブジェクトのメンバを簡単に取り出せるのでし
ょうが(間違っているかもしれません・・・)、C言語で構造体のメンバを、for文などのループを
使って簡単に出力できる方法はないでしょうか?

メンバの型は、一定ではなく、char、int、double、別の構造体のポインタ型(これは出力しなく
て良い)と混在しています。メンバが全て同一の型ならポインタで構造体の先頭アドレスから
sizeof(メンバの型)の分インクリメントしていけば出力できそうな気もしますが、メモリ上に連
続して確保されるのかも私にはわからないので困っています。

Enumで列挙して・・・というのも調べてみましたが、応用は出来ないようでした。

どなたか、地道にメンバ名を書いて出力する以外の方法をご存知の方、いらっしゃいましたらお
知恵をお貸しください。
よろしくお願いいたします。

※説明不足の点がありましたら補足いたします。

メンバーが250とかどういう代物なんだw まさかそれ階層構造とってないフラットなものだったりして。

MFCの一部分でフォームアプリを使いたい -OKWave
教えてください。
MFCでコントロールを張り付けて調整していますが、量が多すぎてつらくなってきました。

一から他言語でやり直すのは無理として、CDialogのGUI部分だけでもManagedC++?フォームアプ
リケーションか、C#で作るには大まかにどういう流れが必要なのでしょうか?

いったい何個貼り付けたんだ? 怖いもの見たさで見てみたい気も。

■_

2008年11月26日


“We simply made up the language as we went along.  We did not regard
language design as a difficult problem, merely a simple prelude to the
real problem:  designing a compiler which could produce efficient programs."

Jhon Backus

Developer of Fortran & inventor of BNF

  

■_

・ダムエー
オリジンは確かに「戦いは数だよ兄貴」があったけどあまり大きなコマじゃなくてしょぼーん。 BD化したZガンダムの映像は結構スゴイらしい。 デジタル技術万歳w 教えてください富野です。はトリウム発電の話。 トリウムで発電て核融合?と悩んでいたら「トリチウム」(三重水素)と混同していた><

  地方エンジニアリングライフに四苦Hack: 明日のIT業界はどこへゆく
http://el.jibun.atmarkit.co.jp/kozawa/2008/11/it-6a6a.html

  さて、あなたはいくつ当てはまるでしょう。

    * @ITなどを含むIT系Webニュースサイトに平均2日に1度以上アクセスする
    * RSSなどで必ずチェックするITエンジニアのblogが5つ以上ある
    * 毎号チェックしているIT系雑誌がある
    * IT系の技術書籍への投資額を月5000円以上かけている
    * 自社業務以外の用事でつきあいのある同業の友人がいる
    * IT系セミナー/イベントの類に参加して、出会った人とその後友人関係が続くことがある
    * IT系コミュニティに1つ以上所属している

プログラマーを採用する際に重視すべき10の資質 - kinneko@転職先募集中の日記
プログラマーを採用する際に重視すべき10の資質 - IT業界を生き抜く秘密10箇条 - ZDNet Japan

えーーーと?

■_ cloister

まあ、調べていないからなんですが、未だになぜアレを cloister と呼ぶのかはわからず。

?: - L'eclat des jours (2008-11-26)
で、正規表現の?:だが、これは何が嬉しいのだろうか?

と、先日購入したハンドブックを読んでいて、初めて知った(一通りの書き方は目を通していた
はずだから初めて知ったはないとは思うので)あるいは意識したのだが、さっぱりわからない。

?:のご利益は後方参照用の保存をしないことだということはわかったのだが。

たとえば、/(?:abc)(def)/ =~ "abcdef" として、$1でabcの代わりにdefが取れると
いうのは例としてはひどいので、たとえば、/(?:(abc)|(def))gh/ =~ "abcdefgh" と
すると、外側の()には?:が付いているので、$1はnil、$2はdefとなる。というのは、ghが後ろに
続いているのはdefのほうだし、/(?:(abc)|(def))gh/ =~ "abcghdef" なら、$1がabc
で$2がnilだ。

たとえば、続けて unless $1 …… みたいな書き方をしたければ、こう書けば良いし、どちらか
読めたほうが欲しければ/(abc|def)gh/ として、if $1 == "abc" と書けば良いのだ
が、別に、/((abc)|(def))gh/ と書いても何も困らないし、むしろ余分な2文字を打たなくて済
むから、こっちのほうが良いようにさえ感じる。

たとえば$xのxが1~9までしか使えず、かつ()を30個くらい書かなければならないような正規表
現なら、?:で抑制するのは必要になるわけだから、なくては困るというのはわかる。

でも、そうでなければ、どのような時に?:という余分な2文字をわざわざ記述する正当な理由が
あるのだろうか?

間単にクロイスター (cloister)の利点を挙げます。 artonさんも書かれているように、通常のキャプチャーではなくクロイスター を使った場合には後方参照用の捕獲(保存)をしません。 そこでおきる副作用(というか主作用?)には少なくとも二つあげられます。 まず第一に、マッチングの速度が向上します。 とPerlのドキュメントにはあったはずなのですが自分で実測して確かめてはいませんので 眉につばつけといてください。 もうひとつは、正規表現の断片をパーツとして扱うことができ、それを組み合わせて 巨大で複雑な正規表現を構築しやすくできるというものです。 つまりどういうことかというと、

  my $prot = qr< (?: ftp | https? )   >x;
  my $uri = qr< $prot :// (いろいろ) >x:

あまりいいサンプルが思いつかなかったのですが、 要は組み合わせるときに番号が変わるのを意識しないですみます。 上記の例でいえば、$prot の方もクロイスターではなくてキャプチャーのカッコにすると (いろいろ) を参照する番号が変わってしまうわけです。 これがより多くのパーツを組み合わせた巨大な正規表現だとかなり変わります。

そもそも、() には二つの役割があったわけです。 後方参照用の捕獲と正規表現の一部分のグループ化です。 そもそも () には後方参照用の捕獲と正規表現の一部をグループ化するという二つの役割がありました。 断言できるだけの証拠はないのですが、後者の一部をグループ化するという機能は 後付けというかそういう使い方もあるなという「再発見」がされたものではないかと考えています。

そう考える理由のひとつとして、 ビューティフルコードの書影ビューティフルコード ソフトウェア作法の書影ソフトウェア作法 プログラミング作法プログラミング作法 といったものにカーニハン大先生のごく基本的な機能だけを備えた実装が掲載されているのですが、 掲載されているような実装方法をとると、今挙げた二つの機能のうちの一部のグループ化 の実現ができないかかなり難しいものになるような感触があります。 また、UNIX上での実例があるかはわからないのですが、*, +, ? のような 量指定子 (quontifier) の直前におけるのは通常のキャラクタもしくは文字クラスだけであって (hogehoge)* のような、グループ化したものに対して使えないという実装も存在していました。 そういったことから、グループ化の機能は後から追加されたようなものではないかなあと推測した次第です。 そしてPerl 5でこれらを明確に区別するためにクロイスターを導入した が導入されたというわけです。 まあ名前によるキャプチャーでもこの番号ずれの問題に対処することは可能ですが、 Perlでは 5.10 になるまで名前によるキャプチャーは採用されていなかったと。

「三項演算子」ついて。 まあなんというか、「ら抜き言葉と一緒」で、 気にする人はとことん気にするんじゃないでしょうか (と他人事のように書いてみる)。 それはそれとして、概念としてはある特定の演算子 ( ? : )を指すものではなくて、 「三つの項」をとる演算子(そのまんま)なのだから ほかに三つの項をとる演算子がないからといって、これのみがそのような 演算子であるかのような表現をするのはどうよ? というのが自分の考えです。

■_


Open source 8-bit game console
Introducing the Fuzebox

The Fuzebox is a fully open-source, DIY 8-bit game console. It is designed 
specifically for people who know a little bit of programming to expand into designing 
and creating their own video games and demos. A full-featured core runs in the 
background and does all the video and audio processing so that your code stays clean 
and easy to understand.

    * Full 256 simultaneous output colors, 240x224 pixel resolution
    * Tile & sprite support
    * Two player ports, either with Super Nintendo or classic Nintendo controllers
    * NTSC RCA composite and S-video out (PAL not supported at this time)
    * 4 channel output mono audio for music and effects
    * SD/MMC card support for future expansion
    * Built on an Atmel AVR core, 64KB flash and 4KB of RAM
    * Main microcontroller chip is preprogrammed with an STK500-compatible
      (sometimes referred to as Arduino-compatible) bootloader
    * Write game code in C, using fully open source tools on any platform

16-bit float data type. - Stack Overflow
http://stackoverflow.com/questions/318625/16-bit-float-data-type

What to teach a beginning Perl programmer? - Stack Overflow
http://stackoverflow.com/questions/319900/what-to-teach-a-beginning-perl-programmer

Help on string handling in C - Stack Overflow
http://stackoverflow.com/questions/319847/help-on-string-handling-in-c

Why is the Windows cmd.exe limited to 80 characters wide? - Stack Overflow
http://stackoverflow.com/questions/319305/why-is-the-windows-cmdexe-limited-to-80-characters-wide

Are all macros evil? - Stack Overflow
http://stackoverflow.com/questions/319452/are-all-macros-evil

How do I do a case insensitive string comparison in Python? - Stack Overflow
http://stackoverflow.com/questions/319426/how-do-i-do-a-case-insensitive-string-comparison-in-python

C++ Parameter Reference - Stack Overflow
http://stackoverflow.com/questions/319623/c-parameter-reference

Algorithm for generating a random number - Stack Overflow
http://stackoverflow.com/questions/319524/algorithm-for-generating-a-random-number

Difference between winsock and linux sockets - Stack Overflow
http://stackoverflow.com/questions/319516/difference-between-winsock-and-linux-sockets

In Python, what is the fastest algorithm for removing duplicates from a
list so that all elements are unique *while preserving order*? - Stack Overflow
http://stackoverflow.com/questions/89178/in-python-what-is-the-fastest-algorithm-for-removing-duplicates-from-a-list-so

どこかで見たようなお題?

■_ {}と [] はそれぞれなんと呼ぶ?

なんか混乱したので再確認。

Yahoo!辞書 - brace
10 中括弧[ブレース, ひげ括弧]({})の一方. ▼curly bracket, curved braceともいう;
ときに角[大]括弧の一方を指すこともある. ⇒BRACKET[名]1
Yahoo!辞書 - bracket

2 ((米))角括弧[大括弧, ブラケット]([])の一方(square bracket);((英))丸括弧(
round bracket;((米))parentheses);(一般に)括弧の一方. ▼ふつう複数形で用いる

・	angle [pointed] brackets
ギュメ, 山がた(〈〉)

・	curly brackets [braces]
中括弧({})

・	put a word in [between] brackets [=put brackets around a word]
ある語を(角)括弧で囲む[に入れる].

bracket - Definition from Longman Dictionary of Contemporary English

■_ 実装者センセイ。あなた最低です

って女性に云わせなければいかんのかw


移動式テレビゲームミュージアム構築計画
http://ameblo.jp/impl-person/entry-10169124782.html

本日は、ちっちゃいもの倶楽部の分科である、移動式テレビゲームミュージアム構築計画の件を
お話したいのである。

移動式テレビゲームミュージアム構築計画とはどのようなものかというと、WindowsVISTAが動作
するという究極ながらもあほらしいスマートフォン、ウィルコムD4に、コンシューマゲーム機の
エミュレータを仕込み、悪いこととは重々承知の上で、然るべきところからゲームのROMイメー
ジをダウンロードしてきて、いつ何時でも、ゲーム史研究ができるようにするものである。

現在のところ、仕込んだゲーム機のエミュレータは以下の通りだ。

セガ・SG-1000、SG-3000、ゲームギア、メガドライブ
ファミコン(+ディスクシステム)
スーパーファミコン
ゲームボーイ
ワンダースワン
ネオジオポケット

ファミコン以前の外国製マシン、例えば、アタリなんたらや、マテルのインテレビジョンなども
落としてみたが、エミュレータの使い方がよくわからなかったりするので、残念ながらミュージ
アムへの収蔵は断念したし、スーパーファミコンより以降の機種(64、セガサターン、プレイ
ステーション等々)については、ウィルコムのスペック不足で動かないのでこれまたミュージア
ムへの収蔵はあきらめたのである。であるから、おそらくこれ以上コレクションが増えることは
あるまい。

ダウンロードしてきたゲームのイメージファイルは、なんと2000タイトルを超えている。

最初は懐かしいものや、有名で、名前を聞いたことがあるものだけにしようと思ったのだが、ダ
ウンロードしているとだんだん意地になってきて、日本語バージョンなら手当たり次第にあれも
これもと落としていると、ハッと気がつけば2000タイトルを突破してしまったという次第である。

もし、これを全部クリアしようとすれば、一本平均一週間かかったとして、四十年ほどかかるこ
とになり、私の場合、まず今生では達成できないほどの数となってしまったのである。

そもそも、ダウンロードに費やした時間だって馬鹿にならないのだ。

しかし、頑張ってROMイメージをダウンロードしてきた甲斐あって、これをネタに、相当日記が
かけるぞとほくそえんでもいるわけだが。

ところで、私も昔は相当ゲームソフトにお金をつぎ込んだのである。ファミコン通信などの雑誌
を参考に、どれを購入するか真剣に検討し、購入を決意してからも『もしクソゲーだったらなん
としょう』とドキドキしながら大枚ウン千円なりを財布から出していたのである。ところが、今
日こうして無償で、残りの人生を全て費やしても遊びきれないほど、ダウンロードし放題(ホン
トは駄目だぞ!)となってしまっているのだ。

こりゃいったいなんとしたことだ。

『こんなよい時代になるのなら、先に言ってくれよ。ゲームなんて買わないのに』と、非常に複
雑な気持ちになってしまったというわけなのである。
  
移動式テレビゲームミュージアム構築計画補足
http://ameblo.jp/impl-person/entry-10169367600.html

実は、移動式テレビゲームミュージアムを構築するにあたり、一機種まるっと抜け落ちていたの
である。

お気づきの方もいらっしゃるかもしれないが、それは、NECのPCエンジンなのだ。

(ry

『え!?ヒューカード(PCエンジンのゲームROMカートリッジはカード型であるため、こう呼ば
れる)のゲームってこんなにたくさん出ていたのか?』

と驚愕してしまったのである。

結局、日本語版だけでも160タイトル以上あるROMイメージをまたぞろ泣きながらダウンロードす
るはめになってしまったのであった。

だが、おかげさまでさらにミュージアムが充実したことを皆様にご報告せねばならない。

PCエンジンは、シューティングゲームこそテレビゲームの代名詞である時期に発売され、それら
シューティングゲームを家庭でも楽しめるということをウリにしていた節があり、スペースハリ
アー、R-TYPE、ドラゴンスピリット、ドラゴンセーバー、究極タイガー、TATSUJINなどの名作タ
イトルが目白押しなのである。

また、メガドライブ用のROMが、なぜかしらどこにも落ちていない(だいぶ捜したのだが)、知
る人ぞ知るカルトゲーム、獣王記があるのもポイントだ。

これらが抜け落ちているミュージアムなど、いかほどの価値があろう哉。

ただし残念ながらウィルコムD4のせこいキーボードでは、とてもじゃないが遊べたものではない
わけだが。

かくして、今生どころか、来世でも遊びきれないほどタイトルが増えてしまったというわけであ
る。

めでたしめでたし。

  
嗚呼幻の定吉七番
http://ameblo.jp/impl-person/entry-10169824450.html

さて、PCエンジン用のゲームROMを物色していたところ、その定吉七番がPCエンジン用にゲーム
化されているということを知ったのである。『定吉七番 秀吉の黄金』というのがそのタイトル
らしい。そんなものが発売されているとは、まったく知らなかったのである。

ところが、なんということか、ROMイメージが落ちていないのである。

海外のサイトで、やっとダウンロードさせてくれそうなところに辿り着いたと思ったら、なにや
らユーザ登録を求められてしまった。

わけのわからぬところで、やたらめったらにユーザ登録をしてはならんというのが、インターネ
ット利用の鉄則なので、そこはしぶしぶ諦めたのだが、なんとかROMを入手せぬことには諦めき
れない。それなくしてゲームミュージアムの完成もないほどだと思っている。

かくして、毎夜毎夜、定吉七番のROMを求めて、幽鬼のようにインターネットの大海原にさまよ
い出ている私なのであった。

どこにあるんだぁー!定吉七番のROMやぁーい。

  
母さん、俺やったよ!|実装者流
http:://ameblo.jp/impl-person/entry-10170124608.html

のっけから何をまた嬉しそうに母親に報告しているのかというと、昨日の日記で悩みを打ち明け
させていただいた、幻のPCエンジン用定吉七番ROMをば、とうとうインターネットの大海原から
サルベージすることができたのである。

やはり人間、何事もやればできるのだ。

私ははっきり言って嬉しい。

あまりに嬉しいので、PCエンジンエミュレータで動作しているところのキャプチャをのっけておこう。

  

上記のページの魚拓。

http://s02.megalodon.jp/2008-1127-0230-17/ameblo.jp/impl-person/entry-10169824450.html
http://s03.megalodon.jp/2008-1127-0231-20/ameblo.jp/impl-person/entry-10169367600.html
http://s04.megalodon.jp/2008-1127-0232-17/ameblo.jp/impl-person/entry-10169124782.html
http://s01.megalodon.jp/2008-1127-0238-50/ameblo.jp/impl-person/entry-10170124608.html

■_

はあ。なんかどっと疲れたよ。

2008年11月25日

■_

・parrot
オフィシャルサイトにあったバイナリ配布のパッケージ(setup-parrot-0.8.1.exe) をインストールしたが、parrot.exe はあるけど perl6.exe やらの parrot上で動作する言語の実行ファイルがなくてがっくし。 まあ exe つーても単なる踏み台なので、あまり困ることはないのかもしれないけど。 あれ? 一つ前のバージョン (0.8.0) だと perl6.exe とかもあったような?

Doug Hellmann: Python Magazine for November 2008 is released

・PSP3000
帰り道にあるとあるゲームショップで、予約なしで買える状態だったが しばらく悩んだ末スルー。とりあえず2000でもあまり不都合ないし。

・ダムエー
今月はフラゲできる店に行く余裕がなかったけど、伝え聞くところでは ガンダムにおけるわたしの好きなせりふのひとつ、
「戦いは数だよ、兄貴!」
があるらしい。楽しみw

■_ そうだったのかっ

Matzにっき(2008-11-09)
Nice Try

RubyConfのQAセッションで、Rubiniusについて「Nice Try」と発言したら 爆笑された。あまり
にも意外なので、正直、ショックを受けた。

後で聞いたら「Nice Try」にはネガティブなニュアンスがあるんだとか。 フランス人と一緒に
「そんなの難しいよねえ」とぐちる。

At the QA session in RubyConf, when I stated "Nice Try" on Rubinius, 
everyone laughed loud. I was even shocked. I meant Rubinius to be a good attempt to 
reach ideal Ruby, but not there yet.

How sad to be a non native speaker.

それで Windows NTが最初にリリースされたときの野次(というか、本来なんというんだろう?) の中に、Nice Try があったのか(NとTでNT)。 ほかのは Not There くらいしか覚えてないや。

■_

Which programming language to learn now? - Stack Overflow http://stackoverflow.com/questions/316243/which-programming-language-to-learn-now

Which programming language to learn now? - Stack Overflow
Which programming language to learn now?

So I recently just finished a year of Java in my Computer Science class, and want to 
further pursue programming. I was not much thrilled of Java, I liked the OOP part but 
disliked its execution speed. I was thinking C++ but I keep hearing people complain (?) 
about templates and new C++0x (someone might need to elaborate that to me). A friend 
of mine recently bought me a Python 2.6 book, but I haven't started on it since I hear 
Python 3 is going to be released soon and is not going to be backwards compatible. I 
tried C# and it was nearly identical to Java but I found it to be Operating System 
specific although I hear people running it on linux and osx through Mono. Leading to 
all this is my question. I want to learn a solid programming language that is not too 
hard to pick up and is rather fast and multi-platform, so which one should it be? 
(Does not have to be any I listed)

Thanks for replying!

例によって回答もいろいろ。

■_

無題 - 黎明日記

無題 - 黎明日記
もし Maeve の開発がうまくいったら、来年の LL イベントで「 Scheme 処理系 Maeve の紹介、
および LL 界への非難と抗議」というような講演をやりたいと思う。メインイベントの一部に時
間を割いてくれるとうれしいんだけど、多分ライトニングトークになるだろうなぁ。

草案がきちんとまとまったら、えんどうさんに相談してみよう。流石に来年は腰を痛めないだろ
うから、 Shiro さんも来るものと思われる。日本の Scheme 処理系作者が一堂に会するわけだ
から、もしかすると Scheme 特設イベント、あるいは言語処理系作者間の討論会みたいなのが実
現するかもしれない。

んーLTだと5分だからちょっと物足りない気がしないでも。

■_



Win32API質問箱 Build72 
731 デフォルトの名無しさん [sage] Date:2008/11/25(火) 01:31:16  ID: Be:
    95はCで作られてたってドコかで見た気がする
    うろ覚えだけどな。

    ちなみに、言語を作る時は
    作ろうとする言語を使って言語を作る。
    Cを使ってCを作る、みたいな。 

732 デフォルトの名無しさん [sage] Date:2008/11/25(火) 01:55:05  ID: Be:
    じゃあCを作ったCは何でできてるんだ 

733 デフォルトの名無しさん [sage] Date:2008/11/25(火) 02:04:33  ID: Be:
    もちろんC
    意味分からないと思うけど
    その昔はハンドアセンブルとかハンドコンパイルってのがあってだな 

734 デフォルトの名無しさん [sage] Date:2008/11/25(火) 02:38:04  ID: Be:
    紙に穴あけてプログラムするんだよねっ 

735 デフォルトの名無しさん [sage] Date:2008/11/25(火) 02:44:51  ID: Be:
    え、配線組み替えるんだろ?


    少し前のこのスレと話題が被っててワロス
    http://pc11.2ch.net/test/read.cgi/tech/1222224721/ 

736 デフォルトの名無しさん [sage] Date:2008/11/25(火) 06:25:42  ID: Be:
    >>733
    ハンドコンパイル、はきいたことないのですが。
    >>735
    それはアナログ計算機かと。 

737 デフォルトの名無しさん [sage] Date:2008/11/25(火) 08:58:34  ID: Be:
    ちなみに、言語を作る時は

    モノによって違うとしか言い様がない。 

738 デフォルトの名無しさん [sage] Date:2008/11/25(火) 08:58:37  ID: Be:
    >>733
    それはCをCで作ってないじゃん
    それはCをアセンブラとか機械語で作ってんじゃん 

739 デフォルトの名無しさん [sage] Date:2008/11/25(火) 09:22:22  ID: Be:
    >>738
    一番最初はしょうがない 

740 デフォルトの名無しさん [sage] Date:2008/11/25(火) 09:35:28  ID: Be:
    アセンブラは誰が何でできてるのか 

741 デフォルトの名無しさん [sage] Date:2008/11/25(火) 09:46:21  ID: Be:
    日本語でおk 

742 デフォルトの名無しさん [sage] Date:2008/11/25(火) 09:49:17  ID: Be:
    コンパイルなんてただファイルを書き出してるだけだからな
    アホでも作れる 

743 デフォルトの名無しさん [sage] Date:2008/11/25(火) 12:13:44  ID: Be:
    コンパイルがファイル書き出しとかアホ丸出し 

744 デフォルトの名無しさん [sage] Date:2008/11/25(火) 12:49:33  ID: Be:
    テキストをバイナリに変換するプログラム。

    俺アホだ。ごめん。 

745 デフォルトの名無しさん [sage] Date:2008/11/25(火) 12:49:59  ID: Be:
    テキストもバイナリですが 

まあ、いっぺんコンパイラー構築ののブートストラップをどうやるか 考えてみるといいと思うよw



Rubyについて Part 33

242 デフォルトの名無しさん [sage] Date:2008/11/25(火) 11:09:42  ID: Be:
    メソッド呼び出しの括弧を省略したらProcオブジェクトが
    とれるようにしようぜ
    今みたいに関数オブジェクトを名前で指定するって
    ダサすぎね? 

243 デフォルトの名無しさん [sage] Date:2008/11/25(火) 11:58:49  ID: Be:
    それは何を中心に考えるかによるからなあ。プロパティ指向と考えれば今のもあり。

    それより、
    Rubyって関数とかブロックとかクロージャ類の扱いがなにげに冷遇されてるというか
    あんまりきちんと整理されていないというか。
    他の言語でクロージャ使って書くつもりのことがRubyだとすんなり書けないね。

    表層的には
    ・ブロックが関数と同等でない(ブロックをとれないなど)
    ・内部関数(Schemeのinternal defineみたいの)を書けない

    Rubyという言語の設計において、クロージャ類は従属的な存在なんだと思う。 

244 デフォルトの名無しさん [sage] Date:2008/11/25(火) 13:03:31  ID: Be:
    >>42
    名前っつーか、そのためのシンボルのハズなんだが
    ちとシンボルと実体が疎に過ぎる気はするなあ。

    >>43
    Rubyに純粋な意味での「関数」は無いからね。
    文の塊をつくる手段は所属するオブジェクトが必要な「メソッド」と
    オブジェクトそのものである「ブロック/Proc」の2種類。



    PythonやJavaScriptみたいな設計は
    「publicな属性が存在する」ことが前提。
    「メソッドはpublicな属性に、クロージャが入ったもの」という感じ。
    この設計では、関数もメソッドも似たような存在。

    ところがRubyはpublicな属性をいきなり排除して
    「オブジェクトの属性にはメソッドを通してしかアクセス出来ない」
    としてるから、その設計が出来ない。
    というのもRubyで「メソッド=クロージャ」…としてしまうと
    public属性にアクセスできない=クロージャにもアクセスできなくなるんだよね。

    だからRubyがpublic属性を否定する限り
    メソッドは特別な存在でなければならず、クロージャではありえない。
    …お陰で、相対的にクロージャの地位が下がっちゃってる。 

245 デフォルトの名無しさん [sage] Date:2008/11/25(火) 13:07:21  ID: Be:
    ただ、もう少しProcとメソッド双方歩みよって
    「違うけど、似たように扱える」仕組みがあっても良いとは思う。 

246 デフォルトの名無しさん [sage] Date:2008/11/25(火) 20:25:17  ID: Be:
    メソッド呼び出しの括弧の省略を許す限りなかなか難しいだろうなあ 


書くときに楽ができるときもあるというのは認めるけど、 背負い込んだデメリットも少なからずあると思う。 とはいえ、今からメソッド呼び出しにはカッコ必須。というのは無理だよなあ。

■_

統計の講義とかでR使わないのは何で? とか。 SASは知っているし使ったこともあるけど、STATAってなんだろう?


Why are SAS/STATA the default statistical tools for undergrads? Why not teach R? : programming

Why are SAS/STATA the default statistical tools for undergrads? Why not teach R? 

SAS is used by something like 95% of Fortune 500 companies. There are very few jobs 
requiring someone to know R, although some industries obviously may have greater 
demand than others.
I spent a lot of time with SAS / STATA / Eviews as an undergrad and now that I am away 
from University I am frustrated that all my training was on proprietary (read 
expensive) statistical tools. Why not teach something like R that is free, readily 
available and a sizable user base?
R is what they're currently teaching at Cal State Fullerton (the class I'm in anyway. 
I'm not sure it's standard across all sections)
R has a pretty steep learning curve (if you want to do anything beyond ANOVA, and even 
then, actually importing the data can be tricky). It also has shitty documentation, 
unfortunately.
If you are accustomed to Windows R will give you problems. It is difficult to learn 
and there are not many tutorials out there. It is free though, unlike SPSS or SAS 
which cost tremendous amounts of money.
...I think Berkeley uses mostly R for education in this area. I wasn't aware SAS was a 
'default' as opposed to a decrepit industry standard.
I've never seen anything other than R used in academic research. I've seen lots of 
postings for free workshops on R, never for anything else. Most (if not all?) of the 
scientific papers I've read in my area that involve statistics cite R and develop (and 
release) any novel methods in that language. I use it almost every day, and never 
questioned it as the tool I was best off using.

If SAS/STATA are being taught to undergrads, I can only imagine it's due to commercial 
packages being the norm in business for historical reasons.

I just did a tour around the Internets on The Google, and it seems like R is the most 
"powerful" in terms of its capabilities and extensibility, but is hard to learn.
I agree that for statistical analysis, R is many respects more powerful and extensible, 
and for this reason would may excel within an academic setting. However, in this area, 
SAS has the advantage of its statistical procedures, being QA and tested in the field 
by millions of users over the courses of decades. Industry, particularly those such as 
Pharma, is much more conservative than academia in this respect. They want to limit 
liability rather than experiment with new technologies.

Also, these languages are by no means limited to statistical analysis. SAS/STAT must 
even be licensed separately from BASE SAS. I have programmed in SAS for years, but 
have rarely used its statistical procedures. Rather I have used it for data management 
and reporting tasks.

SASってんなにシェアあるのか。さすがだな。 しかしここにあげなかったコメントも含めてSPSSとかSが出てこなかったのはなんでだ?

■_

■_ メモ

セキュリティを考慮したプログラミングに関する参考書(日本語で読めるもの)。 多分まだほかにもあると思う。

C/C++セキュアプログラミングクックブック〈VOLUME1〉基本的な実装テクニック C/C++セキュアプログラミングクックブック〈VOLUME2〉対称鍵暗号の実装 C/C++セキュアプログラミングクックブック〈VOLUME3〉公開鍵暗号の実装とネットワークセキュリティ
C/C++セキュアコーディング (SEI SERIES・A CERT BOOK) Writing Secure Code第2版〈上〉プログラマのためのセキュリティ対策テクニック (マイクロソフト公式解説書) Writing Secure Code第2版〈下〉プログラマのためのセキュリティ対策テクニック

オライリーのはVOLUME 1だけは買った(2,3は自分の興味と方向が違ってたのでスルー)。 セキュアコーディングは買っているが(この日記で感想書いたはず)、 マイクロソフトのは本屋でちょっと眺めてスルーしたんだよな。 もっぺんチェックしておくか。

2008年11月24日

■_

・ベビーカー
マクラーレンのベビーカーを目撃。 一部で? 流行っているらしい。 ノーステップでない古いタイプのバスに乗ろうとして往生していた。

・ついった
なんか穏やかでない内容っぽいのが。 The Brian Shaler Blog / / Twitter Security Issue コメントも読むとそうでもない?

■_

こんなのつかわねーよ。という言語の機能を教えてください。



Language features you should never use? - Stack Overflow×
 

Language features you should never use?

A recent post about the 'with' statement in Delphi - which in practice I never use 
because it trades clarity and ease of debugging for superficially 'cleaner' looking 
code got me thinking; what other language features, in any language, do you think 
should never be touched? - or at least avoided where at all possible?

The classic example of this would be the COBOL ALTER statement, which dynamically 
rewrites the executing code to change the destination of a GOTO. Use of ALTER was just 
about a sackable offense in every COBOL shop I ever worked in.

My supposition would be that as language design is better understood nowadays there 
may be fewer of these 'features' coming through - but is that true of the newer more 
exotic paradigms such as the functional programming languages?

In Java, calling a static method via a reference. My favourite example:
リファレンス経由でのスタティックメソッドの呼び出し

Thread t = new Thread(someRunnable);
t.start();
t.sleep(1000); // This doesn't do what it looks like...

It makes the current thread sleep, not the newly created one. Thread.sleep is a static 
method and only ever affects the calling thread - but this snippet makes it look likes 
it's telling a different thread to sleep.


You should always use Option Explicit in Visual Basic (i.e.: you should never use 
implicit variables).

Visual Basic では常に Option Explicit すべき。


I think no language feature should never be used. It's just a matter of knowing when 
and how to apply each feature. Of course there are features you almost never would 
want to use, but can still have their place in certain contexts.

Well, as every rule has to have at least one exception, here's one, PHP related:

    * Having register_globals set to on should never happen :-)


The only thing that comes to mind are GOTO statements :)
GOTOつかっちゃいかんでしょー :)

You should never do using namespace std; in a header file in global scope in C++.
using namespace std をしない。

And you should be shocked if you see using namespace std; in global scope. Never do it, 
it throws away the names scope separation gained using namespaces.


You should never write Perl code without:
これ抜きでPerlでコードを組むことはすべきでない

use warnings;
use strict;


Never use the C / C++ language feature of chaining code in a switch statement by 
appending code to a previous switch case:
switch文で fall thru しない。

OK -

switch (x) {
  case 1:
  case 2:
  case 3:
    ...
    break;
  case 4:
    ...
    break;

  }

Evil -

switch (x) {
  case 1:
  case 2:
  case 3:
    ...
  case 4:
    ...  // Add to the 1,2,3 case here
    break;

  }


In the same spirit, even though I would indulge in an occasional while (*p++ = *q++), 
which is at least a well known pattern, I would avoid constructs like if (a = b) even 
if it has the intended behavior...

プログラミングを理解するのに助けになるようなプログラミング言語って?

■_



Which programming languages have helped you to understand programming better? - Stack Overflow

Which programming languages not only make you more proficient in the particular 
language your are learning, but also have a direct impact on the way you think and 
understand programming in general; therefore, making you a better programmer in other 
languages. Basically, which languages have the biggest impact on understanding the how 
and why of different programming concepts?

What about Scheme? I have heard good things about that.


I think C still has the most impact on my day to day programming. I spent ~2.5 years 
doing mostly C work at school and for hobby projects. While I don't think bare bones C 
is the greatest product development language, it's an incredibly educational one. C 
gives you practically nothing. Anything you want you have to build yourself.


There's no substitute for really understanding what you're up to, no matter what 
language you're hacking with. If your compiler is truly smarter than you are, don't 
expect to be doing the best code you could be.


LISP, C, and Smalltalk.
I'd probably say Haskell if I were smarter.

LISP is beautiful for understanding symbolic processing. C is beautiful for 
understanding the von Neumann architecture as it was embodied in the 70s-90s. 
Smalltalk is beautiful for understanding OOP, which is the dominant model for 
discussing complex software systems.

Ruby (and Rails) showed me how clean and DRY code can really be. It forced me to take 
my C#/C++ to the next level, building highly reusable classes.

Definitely C and C++. C because it forces you to work just a notch above asm. So you 
do best if you understand the language really well. And C++ because it is a good 
combination of high level features such as OOP and templates and C.


I found Eiffel to teach me the most - I got object oriented programming down, design 
by contract, error handling, program flow, etc. Granted it was not the first 
programming language I learned, but the rigidity of the language meant that I had to 
follow all the rules, therefore the concepts became completely ingrained in me.


Definitely Haskell. I don't know it extremely well (yet), but it's definitely made me 
a better program. It's helped me think through abstract algorithms better, and 
encouraged me to keep ideas like referential transparency, etc., in mind, even when 
I'm not using a functional language.

Assembler (6502-Z80), C, C++, Lua, Scheme

ML and Smalltalk. Though I only ever touched them in an undergrad programming 
languages course.

Assembler. Learning how the machine moves and interprets data really makes clear some 
of the choices high-level language designers have to make. Plus, it gives you a much 
greater appreciation for being able to work in higher level languages.

Turbo Pascal is my favorite programming language to learn basics. Its syntax is very 
clean, has pointers and very easy to start.

Nobody's mentioned Tcl yet. That was a real eye-opener for me. I got into Tcl because 
of Expect, but I grew to appreciate it later for the insight into just how minimal the 
syntax of a language can be, and still be useful. The extensibility of it was a 
revelation at the time, too.


* Assembly and C to understand general operation of a computer, those were the 
languages I started with.

* LISP helped understanding how to use Emacs effectively and transformed it from a 
disliked to a regularly used editor for me.

* Eiffel helped me a lot to understand static typed object-oriented programming 
languages like C++ and Java

* I learned a lot about Refactoring, Patterns and testing on Java and also learned to 
understand that some techniques are necessary because of the concept (or limitations) 
of the language

* Squeak and Ruby did the same for dynamic OOP languages

* Erlang helped me to rediscover my love for functional programming because of its 
simplicity and to understand concurrency and recovery in a distributed environment 
better

* Haskell and Miranda for functional programming

* Javascript is one of the languages that I feel that it can teach me a lot because it 
is somewhere between OOP and functional programming

* Scala and C++ helped me see where the limits of complexity for a programming 
language are

■_これはアレの影響なんだろうねえw



パイソンの「2.5.2」をインストールしたのですが、使い方がわかりません。 - Yahoo!知恵袋

パイソンの「2.5.2」をインストールしたのですが、使い方がわかりません。

ハッキングに詳しい方、お願いします。

Windows VistaのAMD64ビットのパソコンに、「2.5.2」は、合っていますか?

初めてなので、まったくです。

一応、「Python Shell」という画面は、出ています。

そこからがわかりません。

お願いします。

話題のドラマは見てないんでどう使われてるかは知らないんだけどねw

■_

InfoQ: Joe Armstrong About Erlang
http://www.infoq.com/interviews/Erlang-Joe-Armstrong
http://blog.cplusplus-soup.com/
http://www.pheedo.jp/click.phdo?i=f9ddc1153d60526e0ac5b5624c4f3cbe
http://okwave.jp/qa4499446.html

2008年11月23日

■_

・某イベント
正式告知がほとんど不意打ちレベルだったのに集まりすぎだw

・Machematcica
Mathematica はいっぺんいじってみたいのだけど、 値段の壁はとてつもなく高いのであった。 Wolfram Blog : Surprise! Mathematica 7.0 Released Today! Surprise! Mathematica 7.0 Released Today! : programming これはどうなんだろう。 Sage: Open Source Mathematics Software: Sage-3.2 and Mathematica 7.0

・ベイスターズ
なんか来シーズンからユニフォームが変わるらしい?

・エンバカからハガキが来ました
要はDelphiの新バージョンでたからバージョンアップよろしく。という内容ですた。 ボーランド時代に比べるとやけにあっさりした内容でなんともw 基本的に、「このURLにアクセスしてバージョンアップの申し込みよろしく」 だけな内容だものなあ。

■_ 英語は…



Ask Proggit: Is it a good idea to write a book called "Functional Programming in Plain 
English" given the success of Real World Haskell : programming

Ask Proggit: Is it a good idea to write a book called "Functional Programming in 
Plain English" given the success of Real World Haskell
Sounds like a good idea, but English is a piss poor language for functional programming.


He's going to use the Plain English dialect, which I believe has extensions to support 
this, as opposed to the de facto standard Mountain English.

Why are you asking us to begin with? If you like doing something, do it.

That having been said, it's pretty clear that functional programming is not going away. 
More and more mainstream languages are picking up functional features and we're 
starting to see functional languages being used in companies like Credit Suisse and 
Twitter.
What language would you use?

I think the biggest hurdle for most people learning FP is that they often do in 
conjunction with learning a new language.

So if you do it my advice would be to pick a language most people know like javascript, 
C# or JAVA and show FP paradigms in terms of that language.

If you choose a language like Haskell or OCaml then you'll be going head to head with 
Real World Haskell and OCaml for Scientists, 2 great texts. In which case your are 
going to be up against some stiff competition.

あんまり英語っぽくされてもあまりありがたくねーw

■_ ルーツ



Guy Steele & Richard Gabriel: 50 in 50 | Lambda the Ultimate
Lambda the Ultimate

Guy Steele & Richard Gabriel: 50 in 50

For those who like their PL History presented in avante guard beat poetry, a video of 
Steele & Gabriel's 50 in 50 speech at JAOO is made to order. Or as the link says:

    A fun, artistic and enlightning presentation full of interesting facts - and who 
better to do it than Richard P. Gabriel and Guy L. Steele (the great Quux). Nothing 
more to say than the rallying cry; More cowbell!

Passing aside the Stephen Wright comic delivery of the two speakers, there are a lot 
of interesting thoughts, though very few are dwelled on. I think the most interesting 
things were the languages that they chose as expositions for the major ideas that they 
covered. Here's the ones that I picked out (though I ended up with only 49):

Do LoopsFortran (Pascal,APL)
Guarded CommandsAlgol-68
Array OriginC, Fortan, Pascal, APL
Extensible LanguagePPL
Domain Specific LanguageAPT
Structured ProgrammingBLISS, INTERCAL
Text vs. EnvironmentAlgol-60, Lisp, Smalltalk
Language as Educational ToolLogo
Stack MachinesBefunge (SECD Machine, Forth)
Formal Dynamic SemanticsSECD
Data ParallelismAPL
Enumerated TypesPascal
CoercionPL/I (Fortran-V)
Backtracking and Theorem ProvingConniver (Prolog)
Hierarchical RecordsCOBOL
Argument HandlingCommon Lisp, Ada, Python (VB, C#, Suneido, PL/pgSQ)
Pointers & ListsIPL-V
Coding in Natural LanguagePerligata (COBOL, Hypercard)
ParsingYacc (LR1, Recursive Descent)
Computational DramaShakespeare
Linked RecordsAED
ReasoningProlog
Mathematical SyntaxMADCAP, MIRFAC, Kleerer-May System
Type DeclaratorsC
Line NumbersBasic (Focal, APL)
Data AbstractionCLU, Alphard
Visual LanguagesPiet
Dynamic vs. Lexical ScopingScheme
Pattern Matching & ReplacementCOMIT, SNOBOL
Knowledge RepresentationKRL (Conniver, Microplanner)
BrandingAda (COMIT, SNOBOL, TRAC)
Stream ProcessingLucid
Dynamic LanguagesAMBIT/L
Generic FunctionsCommon Lisp
Program as DataLisp
Reflection3-Lisp
Macro ProcessorTRAC, ML/I, Limp, M4
Metacircular InterpretersLisp
Call By Name vs. Call By ValueC, Algol-60
Functional ProgrammingKRC
Dangling ElseAlgol-60
Control ParallelismOccam
Formal Static SemanticsAlgol-68
Domain Specific LanguagesHQ9+, MUMBLE
Algebraic Formula ManipulationFormac (Macsyma, Mathematica)
Build LanguagesMake, Ant, Rake (JCL)
Message PassingSmalltalk (C++, C#, Java, Flavors, Common Loops, CLOS, Scheme, Dylan, Simula, Self)
ScriptingPerl
ObjectsSimula (Smalltalk, C++, Java)

知らん言語もいくつかあるな。

■_

C言語なら俺に聞け(入門篇) Part 39 [bbs2chreader]
733 デフォルトの名無しさん [] Date:2008/11/22(土) 14:30:45  ID: Be:
    fopenで一太郎やワードファイルをread出来ないのですが、どうすればよいのでしょうか。

734 デフォルトの名無しさん [sage] Date:2008/11/22(土) 14:38:18  ID: Be:
    ソース貼ってみて 

735 デフォルトの名無しさん [sage] Date:2008/11/22(土) 14:40:50  ID: Be:
    void main()
    {
    fopen("test.doc", "r")+
    }

736 デフォルトの名無しさん [sage] Date:2008/11/22(土) 14:42:48  ID: Be:
    fopenで一太郎やワードファイルをread出来ると
    ソフトが売れなくなるので
    ジャストシステムやマイクロソフトがC標準化委員会に圧力をかけたのさ。
    今この世に存在する全てのC言語は
    一太郎やワードファイルをreadできないようになっていて
    そうしようとした奴の個人情報をインターネットを使って通報するようになってる。
    それが損害賠償を請求する裁判を起こすための証拠になるのさ。
    未だに信じられないようだけど、全部作り話です。 

737 デフォルトの名無しさん [sage] Date:2008/11/22(土) 14:43:41  ID: Be:
    void main()
    {
    char s[1000];
    FILE *fp;
    fp = fopen("test.doc", "r");
    fscanf(fp, "%s", s);
    puts(s);
    }

    すいません途中送信しました
    としてるのですが読めませんどうしたらいいですか

738 デフォルトの名無しさん [sage] Date:2008/11/22(土) 14:53:17  ID: Be:
    >>737
    それだとプレーンテキストて言って、単純に文字コードが並んでるようなファイルしか読めないよ。 

739 デフォルトの名無しさん [sage] Date:2008/11/22(土) 15:11:09  ID: Be:
    >>736 ワロタw 

746 デフォルトの名無しさん [] Date:2008/11/22(土) 17:01:40  ID: Be:
    >>738 別にfopenでなくてもいいのです。
    全てのtextファイル中から特定の文字を検索するツールを作りたいのですが、
    他の関数や方法があれば教えて下さい。 

747 デフォルトの名無しさん [sage] Date:2008/11/22(土) 17:10:00  ID: Be:
    まずtextファイルって何なのか知らんが
    一太郎やWordを作ってる人らがそれらのフォーマットを公開しない限り、
    それらを独自に読み込むのは基本的には無理 

748 デフォルトの名無しさん [sage] Date:2008/11/22(土) 17:11:10  ID: Be:
    >>737
    >>736の最初の方はある意味真実。
    利用者を囲い込むため、他社のソフトでは読めないようになっている。
    そのあおりで、自分の文書でさえその会社のソフトで無ければ読めない。
    RMSが怒ったってのもうなづける。 

749 デフォルトの名無しさん [sage] Date:2008/11/22(土) 17:22:00  ID: Be:
    一太郎やWordで作ったファイルとノートパッドで作ったファイルと
    全て同じだと思ってるわけじゃないよな・・・? 

752 デフォルトの名無しさん [sage] Date:2008/11/22(土) 17:42:22  ID: Be:
    >>746
    自分で作ろうとしなくても、既にGoogleデスクトップがあるじゃないか。 

757 デフォルトの名無しさん [] Date:2008/11/22(土) 18:41:18  ID: Be:
    >>752 グーグルは知っていました。
    ただ、勉強も兼ねて自作したかっただけです。
    正直出来ないってことに驚きました。
    業界絡みで出来ない事ってあるのですね。
    情報提供頂いた皆さんどうもありがとうございました。 

758 デフォルトの名無しさん [sage] Date:2008/11/22(土) 18:47:07  ID: Be:
    おまえは何を信じてるんだ? 

759 デフォルトの名無しさん [sage] Date:2008/11/22(土) 19:15:54  ID: Be:
    >>757
    釣りだよな? 釣りだと言ってくれ。 

760 デフォルトの名無しさん [sage] Date:2008/11/22(土) 19:22:04  ID: Be:
    >>757
    wordのファイルフォーマットは公開されてるから、できないことはないけど、素人には無理。 

761 デフォルトの名無しさん [sage] Date:2008/11/22(土) 19:25:21  ID: Be:
    >>757
    誰もできないとは言っていないはずだ。面倒だったり難しかったりするだけ。

    1つにはオートメーションなど既存ライブラリを利用する手がある。
    Wordも一太郎も、人の手による操作だけでなく、
    プログラムからの操作も受け付けており、それを使うことをオートメーションと言う。
    特にdocは世界的に需要があるので、それ以外に第三者によるライブラリの存在も期待できる。

    もう1つは 、もちろん自分で読み取るプログラムを書くこと。
    ただのテキストではないが、依然としてただのファイルである。
    話の上では、構造さえ分かればバイナリモードで開いて欲するデータを取り出せる。
    さっき言った第三者のライブラリと同じことをするわけだ。
    もちろん、まずはファイルの構造を調べるとこから始めなければならないが、
    すべて一から調べなくても参考になる先駆者の情報を見掛けることはあるだろう。
    ちなみに、司法省が五月蠅かったか、最近MSはdocxでないほうのdocの仕様も公開していたはずだ。
    一太郎は知らないが。 

762 デフォルトの名無しさん [sage] Date:2008/11/22(土) 19:26:30  ID: Be:
    >>757
    できないわけじゃない。
    ただ、自作する場合はちょっと手間がかかるだけだ。
    具体的には、Excelのファイル読む場合C++で2万行くらい。 

765 デフォルトの名無しさん [sage] Date:2008/11/22(土) 19:51:45  ID: Be:
    >>748
    いや>>736は>>733がプレーンテキストのファイルとバイナリファイルとの区別が付いてないと睨んで
    こまごまとしたことを説明するのが面倒だから
    企業の陰謀をでっちあげて出来ないということを納得させるつもりで書いた

    どの道初心者が簡単に出来ることじゃないし
    ちょっとやそっとで出来るか出来ないかだけ分かれば大抵の場合はそれで十分なんだから
    その手の御伽噺で煙に巻いておけばいい
    すぐにCに飽きてJavaだの.NETだのへでも転向するさ 

766 デフォルトの名無しさん [sage] Date:2008/11/22(土) 20:10:11  ID: Be:
    そもそも、ワードやワープロソフトは、文字のみのテキストファイルではなく、
    レイアウト、その他ページ設定などの情報が含まれているしね・・・ 

767 デフォルトの名無しさん [sage] Date:2008/11/22(土) 20:13:08  ID: Be:
    Microsoft Word の仕様書さえあればWordファイルの読み書きはできる。
    ただ、その仕様書がA4で200枚近くあるのが難点だ。 

768 デフォルトの名無しさん [sage] Date:2008/11/22(土) 20:19:10  ID: Be:
    読めるか読めないかだけが質問者にとって重要なのさ
    そして質問者の脳みそで理解できるほど簡単な方法を教えてくれることを期待している
    読めないという回答は全く期待していない

    そこでスケープゴートが必要になる
    悪い報告をする相手を憎むのは防ぎようがないがそれを和らげるためにも
    でなければ質問者の憎悪は100%回答者へ向かうだろう
    たとえ回答が100%正しくても 

769 デフォルトの名無しさん [sage] Date:2008/11/22(土) 20:19:36  ID: Be:
    一太郎3までのフォーマットなら、
    本文のプレインテキストが先頭に来て、
    その後ろにそれと同じ長さの属性リストがくるから、
    テキストだけを抜き出すのは容易だよ。
    難点は、いまどきそんな古いソフトが使えるかどうかだが。 

770 デフォルトの名無しさん [sage] Date:2008/11/22(土) 20:23:41  ID: Be:
    正直に書いたせいで恨まれてもいいじゃない。
    そのための匿名だ。 

771 デフォルトの名無しさん [sage] Date:2008/11/22(土) 20:27:02  ID: Be:
    でもそれで純真なガキ^H^H若者が傷ついたりしたら、寝起きが悪いじゃないか。 

772 デフォルトの名無しさん [sage] Date:2008/11/22(土) 20:53:02  ID: Be:
    >>762
    OLE通してアクセスする方が万倍ましだな。 

768のいうことに説得力を感じた。

前回はどこまで拾ったんだっけ?w



プログラマー的に花の慶次 

30 仕様書無しさん [] Date:2008/11/01(土) 02:27:59  ID: Be:
    直江兼続「利いたふうな口をきくな~~!!そもそも十三対一で遅れをとるとはなんたる醜態!!
    さらにプログラマとは、開発では納期をお守りする大切な役目。
    嫉妬によりプロジェクトを謀殺するが如きシステムアナリストにその盾が務まるかーっ!!」 

31 仕様書無しさん [] Date:2008/11/01(土) 02:30:30  ID: Be:
    慶次「これからは全て金で動く時代になっていく。金で動かぬものははみ出し者さ。
    世の中からどんどん抹殺されて行くんだ。
    (寂しいな)ああ。そんな時代だ。お主のようなプログラマがいなくなれば俺も寂しい」 

32 仕様書無しさん [sage] Date:2008/11/01(土) 07:11:22  ID: Be:
    >>30
    13人はプログラマ??システムアナリスト?? 

33 仕様書無しさん [sage] Date:2008/11/01(土) 07:13:56  ID: Be:
    三成「うう・・・なぜだ!!私の命令もなしに勝手にリファクタリングなど!!
     私をクビにする気か!!
     やめーい!!コミットをやめんか!!さもないと俺がクビに・・・」

    どぁーん!!

    PGたち(がっがっがっ)
    三成「うう・・・どういう事だ
     仲間がクビになったのにつっこんでいくとは」
     
    家康「三成殿、奴らの目を見なされ!!
     今のパワハラの連発で精神をやられたのだろう
     事態がつかめなくなっている!!」

34 仕様書無しさん [sage] Date:2008/11/01(土) 11:51:41  ID: Be:
    PG「(この時期に仕様変更など)聞こえませんなぁ?何ですって?」 

35 仕様書無しさん [sage] Date:2008/11/01(土) 21:59:55  ID: Be:
    慶次「韓国のDoS攻撃は春雨のようなやさしさですな~」

36 仕様書無しさん [] Date:2008/11/05(水) 02:34:30  ID: Be:
    (バグのあるコードを)SIの飯の種にはできぬ。だからdeleteしてやることだけがプログラマの作法。
    だが、今はこうしてやるしかできぬのだ。 

37 仕様書無しさん [sage] Date:2008/11/05(水) 09:55:58  ID: Be:
    「け…慶次さん。お…おれは、やはりニセSEだったようだ。
     クライアントをはり倒す自由は……契約解除される自由と背中合わせ…そんなことも…知らなかった…」

38 仕様書無しさん [sage] Date:2008/11/05(水) 16:25:37  ID: Be:
    そうか もうそんなにおかしくなっているのか
    あのヒヒおやじは

    うむ チームリーダーからの書状によれば
    もはや誰の言葉にも耳を貸さないそうだ
    もはや仕様変更は避けられまいとのことだ。

    なんてことや仕様変更なんて
    我らプログラマーにとっては迷惑なだけの話や

    慶次はそんな"ですま"に逝くの?

    いや俺には縁のない話よ

39 仕様書無しさん [sage] Date:2008/11/05(水) 16:47:29  ID: Be:
    治部殿 まあこのビルドはいかがかな
    う、うむ…では
    こ これは速いな

    当然ですよ
    なにしろtry throw catchといったたぐいのものを一切使っておりませんからな(にかっ)

    慶次のいたずら好きは有名である
    三成はこの男ならやりかねんと思った

    ぶはぁっ!! お…お主という男はな なんということを!

    あいかわらず 頭の堅い男よ
    そんなガチガチ頭だから つまらんことを言い出すんだ

    えっ!?

    まだわからんのか 冗談だよ

    貴様 ふざけるのもほどほどにしろ
    貴様の命はこの三成が握っておるのだぞ
    火消しに行くのか行かんのか 返答しだいでは… 

40 仕様書無しさん [sage] Date:2008/11/05(水) 16:49:00  ID: Be:
    治部 貴様のやることはいちいち手が込みすぎておる
    石田三成ともいわれるものが首一つ失うのがそれほど恐いか
    命が惜しいか

    そんなにこの"ですま"を止めたければ命がけでクライアントに
    掛け合えばいいではないか!
    わざわざ俺を使ってまわりくどいことをするな!
    自分でまいた種は 自分で刈り取れ!
    死してこの"ですま"を止めてみろ!!

    ( た…確かにその通りだがそれは慶次殿だから言えること )
    ( 並みのプロジェクトマネージャーにはそれは出来んのだ )


    う…う── う──
    うるさい!! うるさい! うるさい!!
    き 貴様に…貴様に何が判る!

    だいたい貴様は今まで何をした!?
    この無益で無謀で残忍な"ですま"を避けるために一体
    何をしたというのだ!?

    古今未曾有の"ですま"が迫るのも知らず
    知っても止めようともせず
    太平楽に だらだらと生きてきた貴様達に
    わしらを裁くどんな資格がある! 

41 仕様書無しさん [] Date:2008/11/06(木) 03:13:50  ID: Be:
    あと2日・・・あと2日待てば・・・ 

42 仕様書無しさん [sage] Date:2008/11/06(木) 07:13:21  ID: Be:
    >>40
    鼻を拭いた方がいいなw 

43 仕様書無しさん [sage] Date:2008/11/09(日) 22:08:26  ID: Be:
    犬飼「デスマは・・・ええのう・・・」
    老兵「はい」

    景勝(お館様・・・)
    謙信(プログラマとはこうありたいものだな景勝・・・)

44 仕様書無しさん [] Date:2008/11/12(水) 07:43:47  ID: Be:
    なんか褌の上からキンタマを鷲掴みするシーンを覚えてる。

45 仕様書無しさん [sage] Date:2008/11/17(月) 06:14:04  ID: Be:
    なんだーっ!!この一物は!!
    このようなことで縮み上がるようなことで
    1プロジェクトのPMになれると思っておるのかーっ!! 

46 仕様書無しさん [sage] Date:2008/11/22(土) 22:02:16  ID: Be:
    蛮頭「はは・・・このスケジュールでは納品までにワジらは一日も家に帰れぬな・・・」
    慶次「心配するな。俺が先陣切って、受注前にあらかた実装しておいてやる。」
    蛮頭「ぬう・・・恐るべき『先行着手』にござるな!?」
    慶次「先行着手こそデスマ場の花ではないかね」

Lisp Scheme Part24 
574 デフォルトの名無しさん [sage] Date:2008/11/22(土) 17:13:39  ID: Be:
    Little Schemer大体読み終わったけど、この本の会話みたいに
    宣言的に書く・考えるということにどうも慣れません。
    この先Schemerシリーズの続きあるいはLittleの復習、
    Gauche本、萩谷先生の関数プログラミング
    どれから読むのが良いですか?

576 デフォルトの名無しさん [sage] Date:2008/11/22(土) 18:08:19  ID: Be:
    On LispとかSICPでも読んでみれば?
    Little SchemerはSeasonedと2冊で1セットだけど、
    いやになったなら寄り道するのもいいと思うよ。 

577 デフォルトの名無しさん [sage] Date:2008/11/22(土) 18:15:10  ID: Be:
    個人的には萩谷先生の「関数プログラミング」が好きだったね。
    もし古本屋にあれば「ソフトウェア考現学」もマニアックで良かったよ。 

578 デフォルトの名無しさん [sage] Date:2008/11/22(土) 18:46:31  ID: Be:
    PGの「ハッカーと画家」なんかをお勧めしたいなぁ。
    Schemeのどういうプログラミングスタイルが効果的なのかを教えてくれるし、
    どういったことを出来るようになると良いかを考えるきっかけになるから。
    自分のやりたいことをハッキリさせれば読むべき本も自分で探せるようになるんじゃないかなぁ。 

581 デフォルトの名無しさん [sage] Date:2008/11/23(日) 01:10:17  ID: Be:
    クオートとかクロージャとかマクロとかカリーとか、
    そういうのは判ったから、そろそろそういうのに並ぶ新しい概念ってない? 

582 デフォルトの名無しさん [sage] Date:2008/11/23(日) 01:25:11  ID: Be:
    >>581
    モナドとか? 

583 デフォルトの名無しさん [sage] Date:2008/11/23(日) 01:25:24  ID: Be:
    リフレクション? 

584 デフォルトの名無しさん [sage] Date:2008/11/23(日) 01:26:01  ID: Be:
    気ままに 

585 デフォルトの名無しさん [sage] Date:2008/11/23(日) 01:27:55  ID: Be:
    型はそろそろなんとかしてほしいな。
    あとはD言語とかの表明とか?
    新しくはないな。

587 デフォルトの名無しさん [sage] Date:2008/11/23(日) 01:39:22  ID: Be:
    >>576-578
    >>574ですサンクスです。
    挙げていただいた本はいずれすべて読みたいです。
    Littleが嫌になったわけではないです。とても面白いです。
    むしろ早くSeasonedが読みたくて仕方ないです。
    ただ、重いです。
    情けないようですが、やっぱり理解しやすい日本語で
    やさしく書いてあるものが読みたいのです。
    Little8~9章で結構難儀しまして、スレを参照しつつ
    おかげ様でなんとか理解したかなと思いますが
    だんだん難しくなってきてるのでSeasonedについていけるか不安なのですw
    やさしい本を量を読みたいな、と。
    でも2冊でひとつという事ですので今はSeasonedまでは読んじゃいます。
    どうもでした。スレ汚しで失礼しました。 

590 デフォルトの名無しさん [sage] Date:2008/11/23(日) 02:36:21  ID: Be:
    今どきArrowだろ常考 

591 デフォルトの名無しさん [sage] Date:2008/11/23(日) 02:37:39  ID: Be:
    モナド言われてたorz
    じゃあアクターモデルとか 

592 デフォルトの名無しさん [sage] Date:2008/11/23(日) 02:40:52  ID: Be:
    アクターモデルは結構古い 

593 デフォルトの名無しさん [sage] Date:2008/11/23(日) 04:56:51  ID: Be:
    いっそ論理変数と単一化とか… 

594 デフォルトの名無しさん [sage] Date:2008/11/23(日) 05:20:33  ID: Be:
    >>590
    ちょっとアローについておれに説明してくれんか? 

595 デフォルトの名無しさん [sage] Date:2008/11/23(日) 09:12:11  ID: Be:
    >>591
    それSchemeじゃん 

596 デフォルトの名無しさん [sage] Date:2008/11/23(日) 09:39:36  ID: Be:
    戦国武将モナド元就が(ry 

610 デフォルトの名無しさん [sage] Date:2008/11/23(日) 17:03:15  ID: Be:
    LISPでお金儲け
    したいです
    可能ですか?? 

611 デフォルトの名無しさん [sage] Date:2008/11/23(日) 17:18:34  ID: Be:
    「ばあちゃん?俺俺、俺だけど。
     ACLっての申し込んじゃって請求書きてて困っちゃってるんだ。
     お金振り込んでくれない?」
    「おお、ケンジかい。ACLってなんだい?」
    「あれだよLispだよ。コンピュータの、口座番号言うよ」
    「ちょっと待っておくれ、メモ化しないと」
    以下略 

612 デフォルトの名無しさん [sage] Date:2008/11/23(日) 18:42:30  ID: Be:
    遅延評価なので振込は引き出しが行われる時に初めて行われ
    かつその1度しか行われません 

613 デフォルトの名無しさん [sage] Date:2008/11/23(日) 19:39:37  ID: Be:
    「ばあちゃん、ATMで↑みたいに言われたら
    "身内の不幸"だって言うんだよ?
    うちら家族の問題だから。あーー
    あれだ、クロージャだよ」

614 デフォルトの名無しさん [sage] Date:2008/11/23(日) 19:45:38  ID: Be:
    >「ちょっと待っておくれ、メモ化しないと」
    微妙な受け答えにワラタ 

615 デフォルトの名無しさん [sage] Date:2008/11/23(日) 20:48:24  ID: Be:
    >>605
    このスレ的にはDelta Calculusとか。

616 デフォルトの名無しさん [sage] Date:2008/11/23(日) 20:53:45  ID: Be:
    >>610
    可能です。 

617 デフォルトの名無しさん [sage] Date:2008/11/23(日) 20:56:24  ID: Be:
    めったに乗らない電車で女子高生の一群と遭遇
    A「めっちゃ怖い話し聞いた」
    その他「何?」
    A「一人暮らしのうちのおばあちゃんに電話がかかてってきて
     出てみたら『お母さん?俺やけど・・・・』って言って
     おばあちゃんが『コンスセルか?』って聞いたら『うん』って・・・
     でも、コンスセルおじさんって去年、replacdrで死んでるねん」
    その他「えぇ~!!怖いーーー!!!それで?」
    A「『・・・俺、replacdrして・・・・』って言うから、おばあちゃん泣いてしもて
     『replacdrの事は気にせんでいいから、もうガベージコレクトされて・・・・』言ったんやて」
    その他「うっわー、怖い~」「せつないーーー」「ほんまにあるんやなぁー、そんなGC」 

■_

「オープンソースが組み込み機器にもたらすインパクトとは」---ET2008でまつもとゆきひろ氏らが討論:ITpro
自由か無料か

 オープンソース・ソフトウエアはかつて「フリー・ソフトウエア」と呼ばれていた。浅見氏は
「この『フリー』という言葉は『自由』を意味するのか『無料』を意味するのか」と改めて問い
かけた。

 まつもと氏は「無料という表現には違和感がある」と語る。まつもと氏がフェローとして所属
する企業であるネットワーク応用通信所もシステム構築などでソフトウエアを開発しビジネスを
行っている。「無料であることよりも(改変や再配布が)自由であることから大きな恩恵を受け
ている」(まつもと氏)。CE Linux Forumの上田氏も「無償ソフトウエアと書かれると戸惑う。
サポートすることも無料だと思われると悲しい」と述べた。

 浅見氏は「メディアが『無償ソフトウエア』と書くことがソフトウエアの対価が低いことにつ
ながるとしたら,自戒していかなければならない」と,ソフトウエアが大きな商業的価値を生み
出していることを改めて強調した。 

いや、「オープンソース(・ソフトウェア)」と「自由なソフトウェア(フリーソフトウェア)」 は別物だし。大体、そのフリーが自由なのか無料なのかって、 素で訊いているのなら不勉強もはなはだしい。 誤解を広めた連中はともかくとして、言いだしっぺ(であろう)の連中は 無料であるなんてことは言ってないし(言ってる例があったらごめんして)、 逆にそれは誤解だと主張している親玉(rms)だっている。

■_ Turbo Pascal誕生から25年だそうです

Sip from the Firehose : Memories of Turbo Pascal version 1.0 - Anders Hejlsberg, United States

{ 2008 11 20 }
Memories of Turbo Pascal version 1.0 - Anders Hejlsberg, United States

From: Anders Hejlsberg - microsoft.com
Sent: Monday, November 03, 2008 10:33 AM
Subject: Turbo Pascal v1…

[ David I. note - Anders Hejlsberg is the original author of the Turbo Pascal compiler. 
Anders was also chief architect of Delphi.  He is now a Technical Fellow at Microsoft 
and chief designer of the C# language.  In 2001, Anders received the Dr. Dobbs 
Excellence in Programming Award at the Software Development 2001 Conference. Today, 
November 20, 2008 is the 25th anniversary of the release to manufacturing (RTM) of 
Turbo Pascal version 1.0! ] 

David による注釈
Andres Hejilsberg はTurbo Pascal コンパイラーの original author でした。
Anders はまた、Delphiのチーフアーキテクトでもありました。彼は現在、
Microsoft でテクニカルフェローを務めていて、プログラミング言語 C# の
チーフデザイナーです。
2001年に Anders は Software Development 2001 Conference で 
Dr. Dobbs Excellence in Programming Award を受賞しました。
本日、2008年11月20日は Trubo Pascal version 1.0 が RTM (release to manufacturing)
になってから25年目を迎えた日なのです!

Amazing that it has been 25 years, isn't it. Also amazing how many people I run into 
day to day who cut their programming teeth on Turbo Pascal. What a fun time it was 
creating it and how fortunate we all were to be there in the right place at the right 
time with the right product. And, at the right price, I might add. Personally, I 
thought Niels [Jensen] and Philippe [Kahn] were nuts when they put it at $49.95, but 
in retrospect it clearly was a game-changer.

もう25年もたったのだということにとても驚いています。
また、わたしがどれだけの人々をTurbo Pascalでプログラミングを学ぶようにしたのかという
ことにも驚かされました。
#うまく文章にまとまらないけど
##時機を得て、正しい?場所で、right productを出すことができたのは幸運だった。
#それと忘れていけないのは、正しい価格で売り出したこと。
#自分(へじたん)の個人的な意見を付け加えるなら、Niels Jensen とフィリップ・カーン
#(Philippe Kahn)が$49.95という値段付けをしただけではなくて
#彼らが game-changer であったということ。


A few additional facts about the pre Turbo Pascal days…
Turbo Pascal以前の日々について少々補足することがあります…

I originally wanted to implement an Algol compiler because that was the language I 
used on my high school's mini-computer (an HP 2100). My business partner, Preben 
Madsen, thought it was a better idea to write a Pascal compiler because “Pascal is 
the new thing”. To my delight I discovered that Pascal was much simpler to implement 
than Algol, so Pascal it was!

元々わたしが実装したかったのはAlgol コンパイラーだったのです。
それはわたしが通っていた高校にあったミニコンピューター (HP 2100でした)上で
使っていた言語がAlgolだったからです。
わたしのビジネスパートナーであった Preben Madsen は“Pascalは新しいものだ”
という理由でPascalコンパイラーを書くのが良いと考えました。
調べてみると、PascalはAlgolよりも実装するのに単純であることがわかったので
Pascalコンパイラーを書くことにしたのです!

You're right that BLS Pascal was 12K in size. That was the maximum size available for 
EPROMs on the NASCOM. You could yank out the pre-installed Microsoft ROM BASIC chips 
and slot in ours instead. Some people even built piggy boards with both sets of ROMs 
on them and a switch to choose between Pascal and BASIC. BLS Pascal was also licensed 
to Lucas Logic in the U.K. and sold under the name NASCOM Pascal.

BLS Pascalの大きさが12キロバイトだったというのは正しいです。
それは、NASCOM上のEPROMで使用できる最大の大きさがそれだったからです。
プリインストールされていた Microsoft ROM BASICのチップを yank out (引っこ抜く?)
して、代わりにわたしたちのものを slot in することが可能でした。
中には、それら二つのROMを両方ともセットしたピギーボード(piggy borads)を組み立てて
PascalとBASICの切り替えられるようにした人たちまでいました。
BLS PascalはイギリスのLucas Logicにもライセンスされ、
NASCOM Pascalという名前で販売されました。


BLS Pascal grew into COMPAS Pascal 1.0, a subset implementation for CP/M-80 released 
in 1982. In 1983 it was followed by COMPAS Pascal 2.0, a largely complete Pascal 
implementation for CP/M-80. COMPAS Pascal was later renamed PolyPascal and released in 
16-bit versions for CP/M-86 and MS-DOS. There was never a dedicated PC-DOS version of 
PolyPascal.

BLS Pascal はCP/M 80 用のPascalサブセットであるCOMPAS Pascal 1.0へと成長して
1982年にリリースされました。
1983年にはCP/M 80用のより大きな完全なPascal実装である
COMPAS Pascal 2.0 が続きました。
COMPAS Pascalは後に PolyPascalと名前を変え、
16ビットバージョンとして CP/M 86用とMS-DOS用のものがリリースされました。
PolyPascalのPC-DOS専用のバージョンは存在していませんでした。


COMPAS Pascal 2.0 was the base for Turbo Pascal 1.0 which added a new WordStar 
compatible editor (written by Mogens Glad and Lars Frid-Nielsen), a new menu system, 
and some changes in the run-time library. COMPAS Pascal and Turbo Pascal actually 
shared the same source code with lots of “IF TURBO … ENDIF” conditionals in it.

COMPAS Pascal 2.0 は WordStar互換のエディター
(これはMogens Glad と Lars Frid-Nielsenによって書かれました)と
新しいメニューシステム、ランタイムライブラリにいくつかの変更を加えられて
Turbo Pascal 1.0 になる元となりました。
COMPAS Pascal と Turbo Pascal は実際には同じソースコードを共有していて、
ソースコード中にある多くの “IF TURBO … ENDIF” conditionals
によって切り分けられていました。

My business partners and I knew the Danish Borland founders (Niels Alex Jensen, Ole 
Henriksen, and Mogens Glad) from trade shows and other industry functions. At one 
point one of my partners (I think it was Flemming Oestergaard) ran into Niels at a 
reception. Niels talked about their new venture (Borland) and the products (MenuMaster 
and WordIndex) they were building using Digital Research's Pascal MT+. Flemming told 
him we had a much better Pascal implementation which initially he didn't believe 
(most people didn't). However, after playing with an evaluation copy for a week or 
two the Borland folks became converts.

わたしのビジネスパートナーとわたしは、
Danish Borland founders (Niels Alex Jensen, Ole Henriksen, and Mogens Glad)
がトレードショウから来ていて other industry functions なのを知っていました。
わたしのパートナーたちの中の一人(Flemming Oestergaard だったと思います)が
レセプションでNiels のところへ駆け寄って、彼らの新しいベンチャー(Borlandです)
とその製品(MenuMaster と WordIndex) について、彼らが使っているのが
Digital ResearchのPascal MT+ だということを話しました。
Flemmingは彼に、わたしたちが彼らが使っているものよりも優れた
Pascal の実装処理系を持っていることを主張しましたが、
最初は彼に信じてもらえませんでした(大部分の人がそうだったでしょう)。
しかし、一週間から二週間くらい評価コピーを試したあとで
Borlandの連中は態度を変えたのです。

I still recall being on vacation in Spain in July of 1983 when I got an excited phone 
call from Preben that Borland had agreed to license our product… and that we'd get 
an additional bonus if we could complete a 16-bit version in three months. Which we 
did! At the time I did my coding on a DEC Rainbow 100, a dual CPU machine with both a 
Z-80 and an 8088 processor. It ran an interesting hybrid of CP/M-80 and CP/M-86 and 
allowed me to develop and test 8-bit and 16-bit versions of the product without having 
to switch machines.

わたしは1983年7月のスペインでの休暇で、興奮すべきPrebenからの
Borland がわたしたちの製品をライセンスすることに同意したという
興奮すべき電話を受けたことを今でも思い出します。
そして三ヶ月の間に16ビットバージョンをわたし達が完成させることができたなら
追加ボーナスを得られることになったのです。
もちろんそのボーナスもいただきましたけどね!
当時わたしがコーディングに使っていたのは DEC Rainbow 100というもので、
これはZ-80と8088を搭載したデュアルCPUマシンでした。
このマシンは CP/M-80 と CP/M-86 の intersting hybird を動作させ、
それによりわたしが8ビットバージョンと16ビットバージョンの両方をマシンを替えることなく
開発することを可能にしていたのです。


From: Anders Hejlsberg - microsoft.com
Sent: Sunday, November 09, 2008 7:27 PM
Subject: a few clarification details about the pre-Turbo Pascal v1 editions…

I dug out my copy of the Turbo Pascal 3.0 source code and looking at the comments in 
there it appears I had my version numbers confused a bit:

Turbo Pascal 3.0 のソースコードのわたしの持っているコピーを見つけ出しました。
ソース中のコメントでわたしの記憶に少々混乱しているところがあったことがわかりました。

COMPAS Pascal 1.0 and 2.0 were both subset implementations. Turbo Pascal 1.0 was 
indeed based on COMPAS Pascal 3.0. Looks like it was version 3.02 to be specific.

COMPAS Paslca 1.0 と 2.0 は両方ともサブセットとしての実装でした。
Turbo Pascal 1.0 はCOMPAS Pascal 3.0 をベースにしていました。
たぶん3.02 が specific になったものです。

Development of the 16-bit version started on 7/22/1983—which, I guess, was when I 
returned from vacation in Spain. We were fast back then—from zero to ship in four 
months!

16ビットバージョンの開発は 1983年7月22日に開始されていました。
そう、多分これはわたしがスペインでの休暇から戻ってきたその日です。
わたしたちは大急ぎで休暇から戻ってきて、四ヶ月間でゼロから出荷までもっていったのです!

Also, the comments show that we changed the name to PolyPascal a year later, on 
7/24/1984.

また、コメントにはわたしたちが PolyPascal という名前に変更したのは一年後の
1984年の7月24日とありました。

Below is a copy of the comments from the compiler source code. Pure nostalgia!

; *******************************************************
; *                                                     *
; *           PolyPascal-86 (MS-DOS version)            *
; *           Compiler Main Module                      *
; *                                                     *
; *           By Anders Hejlsberg                       *
; *           Copyright (C) 1984 by                     *
; *           PolyData MicroCenter A/S                  *
; *                                                     *
; *******************************************************

;               Version history:

; 1.01     220783  Development version
; 3.01     030983  Field test version
;               260983  @INI parameters now set when program code is
;                               dumped directly from memory (DUMPC)
; 3.02     061083  8087 support added.
;                               OVERLAYs added.
;                               ARRAY OF CHAR assignment fixed (SCVAC).
;                               RECORDs within RECORDs ok (RECTYP).
;                               PORT and PORTW in expressions ok.
;                               CLRHOM standard string added.
; 3.03     041283  Array subscriptions with constant indices generates
;                               more efficient code.
; 3.04     190184  Memory allocation scheme changed. Entire object code
;                               segment used to buffer object files.
;                               Include file buffering removed (no longer required).
;                               Overlay areas packed in disk files. Unpacking occurs
;                               at load time.
;                               EXTERNAL now works with PROGRAM and OBJECT commands.
; 3.05     160284  RESET and REWRITE with untyped files compile ok when
;                               the record length specification is an expression.
; 3.06     030384  EXIT and HALT standard procedures added.
;                               PROGRAM command generates correct code for segment
;                               allocation parameters passed to @INI.
; 3.07     100484  String constant assignment to ARRAY OF CHAR ok.
; 3.10     240784  Name changed to PolyPascal.
; 3.11     011085  FIND on large programs does not produce compiler
;                               overflow (TSTMO).

Share This | Email this page to a friend
Posted by David Intersimone on Thursday, November 20, 2008, at 8:02 am, and filed 
under Delphi, History, Languages, Pascal, People, Programming. Follow any responses to 
this post with its comments RSS feed. You can post a comment or trackback from your 
blog.

{ 3 } Comments

   1. John Herbster | November 20, 2008 at 11:23 am | Permalink

      Anders Hejlsberg,
      Thanks for reminding us how powerful simple ideas and tools can be.
      Best regards, John Herbster

   2. RIF | November 20, 2008 at 3:02 pm | Permalink

      Hej Anders

      Heldigt at det blev COMPAS Pascal og ikke COMPAS Algol ;-). Tak for Turbo Pascal 
      og dit arbejde på de første Delphi versioner. Hilsen RIF

      EN: Lucky that it became COMPAS Pascal and not COMPAS Algol ;-). Thanks for 
      Turbo Pascal and your work on the first Delphi versions. Greetings RIF

      To spørgsmål:
      1. The "trade show" var det Mikrodata i Bella centeret?
      2. Blev du engang tilbage i begyndelsen af 1980′erne interviewet til DR P4 radio?

   3. Ken Knopfli | November 21, 2008 at 2:35 am | Permalink

      My first contact with computing was also an HP2100 - 64k core memory! No ALGOL, 
      tho'. I entered everything via the pushbutton switches on the front panel. The 
      machine code manual consisted of indestructible thick plastic coated pages.

{ 1 } Trackback

   1.
      Nick Hodges » Blog Archive » Random Thoughts on the Passing Scene #91 | November 
      20, 2008 at 5:16 pm | Permalink

      [...] David I has been running a fun series on memories about Turbo Pascal 1.0 
      now that it has been 25 years since it’s relase.  And guess who showed up with some 
      thoughts?  [...]

Turbo Alogol…ちょっと見たかったなw

2008年11月22日

  Those who don't understand UNIX are doomed to reinvent it, poorly.

     UNIXを理解していない者は(UNIXを)再発明する運命にある。それも劣化した形で。
Henry Spencer がどっかで言ったか書いたかかしたらしいお言葉。

■_

・いろいろ購入
数学ガールのコミック 上とか、 あそびにいくヨ! のコミック4巻とか Rの本とか。 Effective Java 第二版もあったけど財布の中身と相談した結果ペンディング。 あと日経ソフトウエア。

Guidoパパがscalaに興味をお持ちになったようです。 Neopythonic: Scala? あとで訳す。 かどうかは毎度のごとく(ry

■_ まじかるぽかーん

テキストファイルの重複行を削除できますか? -OKWave

テキストファイルの重複行を削除できますか?
困り度:

    * すぐに回答を!

テキストファイルを読み込んだ際に重複行を削除する
事とかって出来ますでしょうか??

そういう削除関数みたいなのがないんですよね。。。。
C言語って.......
http://okwave.jp/qa4491261.html
http://okwave.jp/qa4489311.html

関連ですか?

>テキストファイルを読み込んだ際に重複行を削除する事とかって出来ますでしょうか??
そういう処理を作成すれば可能です。

>そういう削除関数みたいなのがないんですよね。。。。
>C言語って.......
「C言語にはない」ではなく「C言語の基本ライブラリや開発環境で提供されている関数にはない」です。
C言語は自分自身で関数を作成することができる言語です。
従って、あなたがそういった関数を作成すれば「ある」ということになります。
まず「C はあらゆるユーザのすべてのニーズを満足するようにできているわけではない」
ということを理解していただけるとありがたい. そも不可能だし.
でも, やることは簡単でしょ?

while (1行読み込む) {
    if (これまでのどの行とも異なる) {
        この行を記憶&出力
    }
}

こんだけだもの

どこのPHPをお望みですかこの質問者殿は。とかゆってみる。

■_ grep/sed の話補足



sedが遅い話のつづき - val it : α → α = fun2008/11/22 sedが遅い話のつづき

    * http://www.kt.rim.or.jp/~kbk/zakkicho/08/zakkicho0811b.html#D20081120-6
    * http://zunda.freeshell.org/d/20081120.html#p03

ありゃそうだっけ、確か両方だったような、と思ったら両方のようですね。正しかったようでよ
かった。でもさすがにLANG=Cならperlより速いのか。

GNU sed/grepはlocaleに応じてファイルのエンコーディングを決めるので、localeとファイルの
エンコーディングにずれがあったとき(処理系が意図とははずれたinvalidな文字列が見られるの
で)マッチなどの挙動がおかしくなることがあったと思いますし、例外的な文字が出てくると余
計に処理も遅くなるんじゃないでしょうか。zundaさんの実験は、そういう部分のノイズがちょ
っとあるんじゃないかな、と思いました。直感ですけど。

Python の場合もunicode(Unicode文字列)とstr(バイト列)が明確に区別されていて、ファイルの
読み込みなどはstrなのでそれほど問題ないと思います。でもstrで処理をせずunicodeに持って
いくとすると、処理内容によっては遅くなるかもしれません(がまあ、ふつうに書けばそれほど
でもないはず)。

すみません。こちらに多々言葉足らずの点がありました。 箇条書きにしていくと、

  1. sed は grep よりも新しい正規表現エンジンを使っている
  2. grep については、何度となくマルチバイト文字環境(MB_CUR_MAX > 1) で検索速度ががた落ちになる(文字通り桁違い) 「バグ」報告が寄せられている
  3. sed についてはそのようなクレームを見たことがない
  4. sedにしても、MB_CUR_MAX > 1 のときにだけmbrtowc を呼ぶということ点では grep と同じなので、シングルバイト文字環境 (LC_CTYPE="C"とか)と マルチバイト文字環境で速度が違うことが予想される。
  5. でも、grep と sed では前述したようにエンジンのつくりがまるきり違うので、 速度低下の度合いが違うのではないか。少なくとも grepのように 二桁から三桁ちがってくるということはないのではないか

ということで、sed が遅いというのはgrepの勘違いじゃないか。と書いた次第です。

直感ですけど、で済ませるのもなんなので手元の環境(FreeBSD)で試してみたら、grepもsedもぜ
んぜん遅くなりません(この日記のデータすべて合計した3MBぐらいをかけてみた)。おかしいな。
どちらもGNUの筈なんですが……。ただし、sedでLANGをeucJPにしたときだけ明確に遅くなりま
した。これは内部的にUTF-8で処理をする前提で文字コードを変換しているからではないかとい
う気がします。元ファイルの文字コードがUTF-8のときでもEUC-JPのときでも遅くなりましたが、
元々がEUC-JPの方が速かったので、その差はinvalidな文字列が来たときの対処ルーチンかなあ。

euc-jp と UTF-8で顕著な差があるということですが、 各種の文字コードからワイド文字 (まあ実質 Unicode (UCS-4)ですが) への変換は Cライブラリの mbrtowc に丸投げですので、 変換元のエンコーディングによって変わるとしても、それは sedの側の実装の問題というよりは ライブラリ側の問題ではないかと思います。

いや、ひょっとしてランダムなバイト列があったときに、 UTF-8の不正なパターンとEUC-JPの不正なパターンのどちらが出やすいかということと、 リカバリーをどうしているかにもよるのかも。 コード見て調べないといかんかあ。

■_ ソフトウェアのライフサイクル?

本当のソフトウェアのライフサイクルとは

Software doesn't just appear on the shelves by magic. That  program shrink-wrapped 
inside the box along with the  indecipherable manual and 12-paragraph disclaimer 
notice  actually came to you by way of an elaborate path, through  the most rigid 
quality control on the planet.   Here, shared for the first time with the general 
public, are  the inside details of the program development cycle.   

   1. Programmer produces code he believes is bug-free.   
   2. Product is tested. 20 bugs are found.   
   3. Programmer fixes 10 of the bugs and explains to the testing department that the 
      other 10 aren't really bugs.   
   4. Testing department finds that five of the fixes didn't  work and discovers 15 new bugs.   
   5. See 3.   
   6. See 4.   
   7. See 5.   
   8. See 6.   
   9. See 7.   
  10. See 8.   
  11. Due to marketing pressure and an extremely pre-mature product announcement based 
      on overly-optimistic programming schedule, the product is released.
  12. Users find 137 new bugs.   
  13. Original programmer, having cashed his royalty check, is nowhere to be found.
  14. Newly-assembled programming team fixes almost all of the 137 bugs, but introduce 
      456 new ones.
  15. Original programmer sends underpaid testing department a postcard from Fiji. 
      Entire testing department quits.
  16. Company is bought in a hostile takeover by competitor using profits from their 
      latest release, which had 783 bugs.
  17. New CEO is brought in by board of directors. He hires programmer to redo program 
      from scratch.
  18. Programmer produces code he believes is bug-free....

笑い話。ですよねえ。

■_ Zed

なんかまた書いた模様。_whyの名前が出てきたり。

ZSFA -- 2008-11-21

I love Why The Lucky Stiff and his crazy creative ways. His latest post about me and 
how nice The Ruby Community really is gave me chills. The great _why is actually 
mentioning me! I mean, sure he’s dissing me without really dissing me so that he can 
be an asshole while still being nice, but I got a mention on his blog!

I remember when I first saw _why play with his Thirsty Cups. That was way back before 
he got tired of the Nice Ruby Community becoming too commercial so he didn’t want to 
come to RubyConf anymore. I think they had to kidnap him to get him to perform at that 
RailsConf too. After that, he told all of his super Nice Ruby Community friends that 
he’s going to do Hackety Hack instead of hang with them. He even made his own special 
version of the Ruby interpreter to make Shoes work.

It was a sad day for me, because really the only reason I hung out in Ruby was because 
of _why. Mr. Why actually blessed me with his presence during one of my hacking 
sessions and made me feel smarter by association. I showed him Ragel (which he used to 
write Hpricot), and showed him some vim tricks, and he talked to Obie. It was great 
just having him warming the air near me.

以下略

訳そうと思ったけど、 rubyneko - Zed loves _why で取り上げられたから止めるw

■_ ム板ヲチ

推薦図書/必読書のためのスレッド 
902 デフォルトの名無しさん [sage] Date:2008/11/22(土) 21:24:14  ID: Be:
    >>375
    でも書いたんだが、どうしても欲しくなって
    S・P・ハービソン3世とG・L・スティール・ジュニアのCリファレンスマニュアル
    買っちゃった。
    良い本と思う。
    ちなみに、英語版は凄く評判が良いみたいですな。
    装丁もカッコいいしオススメ。 

907 デフォルトの名無しさん [sage] Date:2008/11/23(日) 00:47:53  ID: Be:
    >>902
    あれの最新のものの翻訳、なぜ出ないんだろうね。 

908 デフォルトの名無しさん [sage] Date:2008/11/23(日) 01:14:03  ID: Be:
    >>902
    Cのリファレンスは、それか、プラウガの本が最高。
    >>907
    やっぱり売れないんじゃないだろうか。
    この二冊とも絶版になったことがあるし。
    大雑把な理解でプログラムを書く人が多いんだと思われ 


ぷらうが先生のCの本てなんだっけ? 907が云っているのは最近出た方のことを云っているんだろうか。 これって最新版の翻訳じゃないんだっけか? Amazon.co.jp: Samuel P. Harbison: 洋書 を見ても、5thが(2002年の刊行だけど)最新だと思うけどなあ。 Amazon.com: Subjects: Books: Nonfiction, Literature & Fiction, Professional & Technical, Science & More うーむ。 ぷらうが先生の本てのはこの辺かな 標準Cライブラリ―ANSI/ISO/JIS C規格: P.J. プラウガー, P.J. Plauger, 福富 寛, 清水 恵介, 門倉 明彦: Amazon.co.jp: 本 すげーマーケット価格w。 なんかカスタマーレビュー見てたら欲しくなった(笑)

ATL/WTL Part6

347 デフォルトの名無しさん [sage] Date:2008/11/20(木) 13:16:07  ID: Be:
    VC2008 から ATL がWindows98でサポートされなくなった・・・
    なんでだよおおおおおおおおおおおおおおおおおおおおおおおおおおおおお

    「うにこーどで全部書けて素敵ね☆」
    じゃねええええええええええ!!!!!!!!!!!! 

348 デフォルトの名無しさん [sage] Date:2008/11/20(木) 13:20:25  ID: Be:
    ATL関係なく、VC2008自体がWindows 98で動くコードを出力できない。 

349 デフォルトの名無しさん [sage] Date:2008/11/20(木) 13:37:53  ID: Be:
    VC2008の出力する実行ファイルに特に特殊な点は無いし
    普通にWindows98で動きそうだが
    ランタイムライブラリなどは修正する必要があるかもしれないが 

350 デフォルトの名無しさん [sage] Date:2008/11/20(木) 14:00:20  ID: Be:
    >>349
    リンカの/SUBSYSTEMでの最低バージョンの省略時の値が5.0になっていて、
    しかも5.0未満の値を指定するとエラーになる。
    そのため、4.1であるWindows 98では実行できないというわけ。 

351 デフォルトの名無しさん [sage] Date:2008/11/20(木) 14:02:07  ID: Be:
    VC2008 のコンパイラが勝手に埋め込んでるバージョンチェック処理って
    マクロとかでつぶせないもんかね
    あのメッセージさえ回避できれば動きそうじゃね?
    M$のマーケティングかも知れないけど。 

352 デフォルトの名無しさん [sage] Date:2008/11/20(木) 14:11:50  ID: Be:
    バイナリエディタでそこを書き換えてみたが、たしか別のエラー吐いて駄目だった。
    めんどくさくなって、それ以上原因追究しなかったけどさ。 

353 デフォルトの名無しさん [sage] Date:2008/11/20(木) 14:16:04  ID: Be:
    CRTをスタティックリンクしたところで
    CRT自体が9x系サポートしてねえんじゃねえの

    そこまでして2008に9x系向けのコードを吐かせたい理由がわからんが
    MS自体が既にサポートしてねえOSなのに 

354 デフォルトの名無しさん [sage] Date:2008/11/20(木) 14:34:13  ID: Be:
    サポート終わっても意外と98ユーザいるじゃねーか
    (開発としてはマジ迷惑な話だが)
    98SEとかMeとかのユーザ向けにはVS2008はアウトか。

    Meはさすがにいねーかww 

355 ,,・´∀`・,,)っ-○◎● [sage] Date:2008/11/20(木) 22:40:38  ID: Be:
    MSDN会員ならダウングレード権があるから6.0でも使えよ
    でも.NET 2002は黒歴史な。Intelコンパイラも放置してる失敗作。パネェ

356 デフォルトの名無しさん [sage] Date:2008/11/22(土) 19:20:37  ID: Be:
    俺はずっとパネェ黒歴史を使ってきてたのか・・・or2 

357 デフォルトの名無しさん [sage] Date:2008/11/22(土) 23:04:15  ID: Be:
    本当は 2003 相当のものを出したかったんだろうが、
    あまりにも間が空きすぎるのを避けて、
    無理に 2002 に出したんだろうなあって感じの代物。
    C++ 規格準拠率低いし。 

へー。そこまでやってたのか。 てまあわたしもまだメインを2003から移してなかったりするんですがw

■_

Why CLISP is under GPL - an email thread between Richard Stallman and Bruno Haible : programming
http://www.reddit.com/r/programming/comments/7ez5b/why_clisp_is_under_gpl_an_email_thread_between/

New 64-bit Free Open Source Operating System. Not a Unix, created from scratch. : programming
http://www.reddit.com/r/programming/comments/7e8hp/new_64bit_free_open_source_operating_system_not_a/

Tech Central - Times Online - WBLG: Top 25 days in computing history
http://timesonline.typepad.com/technology/2008/11/top-25-days-in.html

Wolfram Blog : Surprise! Mathematica 7.0 Released Today!
http://blog.wolfram.com/2008/11/18/surprise-mathematica-70-released-today/

Surprise! Mathematica 7.0 Released Today! : programming
http://www.reddit.com/r/programming/comments/7ea81/surprise_mathematica_70_released_today/

Type-Checking Zero Knowledge | Lambda the Ultimate
http://lambda-the-ultimate.org/node/3099

Ask Proggit: Is it a good idea to write a book called "Functional Programming in Plain English" given the success of Real World Haskell : programming
http://www.reddit.com/r/programming/comments/7ensy/ask_proggit_is_it_a_good_idea_to_write_a_book/

Ask Proggit: Why do we use x86 processors? : programming
http://www.reddit.com/r/programming/comments/7ecrl/ask_proggit_why_do_we_use_x86_processors/

Thoughts on Corewar...: nanoWarrior Issue 3
http://impomatic.blogspot.com/2008/11/nanowarrior-issue-3.html

.:: General Purpose Hash Function Algorithms - By Arash Partow ::.
http://www.partow.net/programming/hashfunctions/index.html

Sage: Open Source Mathematics Software: Sage-3.2 and Mathematica 7.0
http://sagemath.blogspot.com/2008/11/sage-32-and-mathematica-70.html

Sip from the Firehose : Memories of Turbo Pascal version 1.0 - Anders Hejlsberg, United States
http://blogs.codegear.com/davidi/2008/11/20/39215

K. Scott Allen : Function.apply and Function.call in JavaScript
http://odetocode.com/Blogs/scott/archive/2007/07/04/11067.aspx

Free Applications for the iPhone and the iPod Touch - Chronometer, Stopwatches, Worldclocks, RPN Calculator, Money Management, Voice Recorder, Puzzles
http://www.tausendstern.com/

Neopythonic: Scala?
http://neopythonic.blogspot.com/2008/11/scala.html

InfoQ: Clojure
http://www.infoq.com/presentations/hickey-clojure;jsessionid=2826B81451C4EBFB6F676A26DC937E34

Rubinius: Past, Present and Future
http://blog.engineyard.com/2008/11/17/rubinius-past-present-and-future

Art and code - obscure or beautiful code? | JAOO Community Blog
http://blog.jaoo.dk/2008/11/21/art-and-code-obscure-or-beautiful-code/

Hot on the heels of Array#fourth, Rails now ships with Array#fourty_two, AKA "accessing the reddit" : programming
http://www.reddit.com/r/programming/comments/7erjo/hot_on_the_heels_of_arrayfourth_rails_now_ships/

GCC hacks in the Linux kernel
http://www.ibm.com/developerworks/linux/library/l-gcc-hacks/index.html
GCC hacks in the Linux kernel : programming
http://www.reddit.com/r/programming/comments/7eqzr/gcc_hacks_in_the_linux_kernel/


Why do you need explicitly have the "self" argument into a Python method? - Stack Overflow
http://stackoverflow.com/questions/68282/why-do-you-need-explicitly-have-the-self-argument-into-a-python-method

What's your Objective-C coding style? - Stack Overflow
http://stackoverflow.com/questions/308044/whats-your-objective-c-coding-style

■_

疲れた。

2008年11月21日

■_

・ひらしょー本
昨日までは2冊あった本屋で、今日の会社帰りに買って帰ろうと思っていたら売り切れてました○| ̄|_

・溝ノ口太陽族
どうも初回の出荷数はあまりなかったっぽい?

■_ セキュアコーディングとか

調べてみたら結構ぞろぞろでてきて嬉しいやら辛いやら。

Secure Coding
http://www.cert.org/secure-coding/


    * Secure Coding in C++ (Part 1: Strings)
    * Secure Coding in C++ (Part 2: Integers)
    * Secure Coding Initiative (pdf)   (web cast)
    * Secure Coding in C and C++ - Tutorial
    * Best Practices for Secure Coding
    * Secure Coding in C and C++: A Look at Common Vulnerabilities

SecureCodingGuide.pdf (application/pdf オブジェクト)
http://developer.apple.com/documentation/Security/Conceptual/SecureCodingGuide/SecureCodingGuide.pdf

rlogin(1): The Untold Story
http://www.sei.cmu.edu/publications/documents/98.reports/98tr017/98tr017abstract.html

Software Vulnerabilities in Java
http://www.sei.cmu.edu/publications/documents/05.reports/05tn044.html

Secure Coding in C and C++: Resources
http://www.cert.org/books/secure-coding/
→日本語訳あり

Writing Secure Code, Second Edition
http://www.microsoft.com/mspress/books/5957.aspx
→日本語訳あり
flexible array members and desingatars in C9X
http://www.usenix.org/publications/login/2001-07/pdfs/mccluskey.pdf


http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Introduction.html
C Tutorials

Common Mistakes and How to Avoid Them
http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Common_Mistakes_and_How_to_Avoid_Them.html

Foolproof Statement and Comment Syntax
http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Foolproof_Statement_and_Comment_Syntax.html

Hassle-free Arrays and Strings
href="http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Hassle_free_Arrays_and_Strings.html

Simplified Variable Declarations
href="http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/Simplified_Variable_Declarations.html

C Tutorials
http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Practical_Pointers.html

Practical Pointers
http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Practical_Pointers.html

Macros and Miscellaneous Pitfalls
http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/Macros_and_Miscellaneous_Pitfalls.html

Working with C++
http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Working_with_C.html

Managing C and C++ Development
href="http://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/TOC_Managing_C_and_C__Development.html

C is a powerful programming language, but not without risks. Without help, even 
experienced C programmers can find themselves in trouble, despite "careful" 
programming, lint filters and good debuggers and managers of programming projects can 
discover too late that using C carelessly can lead to delayed and defect-ridden 
software. This tutorial helps avoid problems by illuminating the dangers of C and 
describing specific programming techniques to make C programming both faster and 
safer.

This tutorial is unique in that it takes a critical look at C's deficiencies, but 
offers tried-and-proven techniques to minimize the chances that common C coding 
mistakes will lead to serious or hard-to-find software defects. No other tutorial on C 
programming combines the depth of specific technical information and the strategic 
assessment of C's capabilities and risks that you'll find in Common Sense C.
Programming in C++, Rules and Recommendations - Summary of Rules

20. Summary of Rules

Rule 0
    Every time a rule is broken, this must be clearly documented. 
Rule 1
    Include files in C++ always have the file name extension `.hh'. 
Rule 2
    Implementation files in C++ always have the file name extension `.cc'. 
Rule 3
    Inline definition files always have the file name extension `.icc'. 
Rule 4
    Every file that contains source code must be documented with an introductory 
    comment that provides information on the file name and its contents. 
Rule 5
    All files must include copyright information. 
Rule 6
    All comments are to be written in English. 
Rule 7
    Every include file must contain a mechanism that prevents multiple inclusions of 
    the file. 
Rule 8
    When the following kinds of definitions are used (in implementation files or in 
    other include files), they must be included as separate include files:

        * classes that are used as base classes,
        * classes that are used as member variables,
        * classes that appear as return types or as argument types in function/member 
          function prototypes.
        * function prototypes for functions/member functions used in inline member 
          functions that are defined in the file. 
Rule 9
    Definitions of classes that are only accessed via pointers (*) or references (&) 
    shall not be included as include files. 
Rule 10
    Never specify relative UNIX names in #include directives. 
Rule 11
    Every implementation file is to include the relevant files that contain:

        * declarations of types and functions used in the functions that are 
          implemented in the file.
        * declarations of variables and member functions used in the functions that 
          are implemented in the file. 
Rule 12
    The identifier of every globally visible class, enumeration type, type definition, 
    function, constant, and variable in a class library is to begin with a prefix that is 
    unique for the library. 
Rule 13
    The names of variables, constants, and functions are to begin with a lowercase letter. 
Rule 14
    The names of abstract data types, structures, typedefs, and enumerated types are 
    to begin with an uppercase letter. 
Rule 15
    In names which consist of more than one word, the words are written together and 
    each word that follows the first is begun with an uppercase letter. 
Rule 16
    Do not use identifiers which begin with one or two underscores (`_' or `__'). 
Rule 17
    A name that begins with an uppercase letter is to appear directly after its prefix. 
Rule 18
    A name that begins with a lowercase letter is to be separated from its prefix  
    using an underscore (`_'). 
Rule 19
    A name is to be separated from its suffix using an underscore (`_'). 
Rule 20
    The public, protected, and private sections of a class are to be declared in that 
    order (the public section is declared before the protected section which is declared 
    before the private section). 
Rule 21
    No member functions are to be defined within the class definition. 
Rule 22
    Never specify public or protected member data in a class. 
Rule 23
    A member function that does not affect the state of an object (its instance 
    variables) is to be declared const. 
Rule 24
    If the behaviour of an object is dependent on data outside the object, this data 
    is not to be modified by const member functions. 
Rule 25
    A class which uses `new' to allocate instances managed by the class, must define a 
    copy constructor. 
Rule 26
    All classes which are used as base classes and which have virtual functions, must 
    define a virtual destructor. 
Rule 27
    A class which uses `new' to allocate instances managed by the class, must define 
    an assignment operator. 
Rule 28
    An assignment operator which performs a destructive action must be protected from 
    performing this action on the object upon which it is operating. 
Rule 29
    A public member function must never return a non-const reference or pointer to 
    member data. 
Rule 30
    A public member function must never return a non-const reference or pointer to 
    data outside an object, unless the object shares the data with other objects. 
Rule 31
    Do not use unspecified function arguments (ellipsis notation). 
Rule 32
    The names of formal arguments to functions are to be specified and are to be the 
    same both in the function declaration and in the function definition. 
Rule 33
    Always specify the return type of a function explicitly. 
Rule 34
    A public function must never return a reference or a pointer to a local variable. 
Rule 35
    Do not use the preprocessor directive #define to obtain more efficient code; 
    instead, use inline functions. 
Rule 36
    Constants are to be defined using const or enum; never using #define. 
Rule 37
    Avoid the use of numeric values in code; use symbolic values instead. 
Rule 38
    Variables are to be declared with the smallest possible scope. 
Rule 39
    Each variable is to be declared in a separate declaration statement. 
Rule 40
    Every variable that is declared is to be given a value before it is used. 
Rule 41
    If possible, always use initialization instead of assignment. 
Rule 42
    Do not compare a pointer to NULL or assign NULL to a pointer; use 0 instead. 
Rule 43
    Never use explicit type conversions (casts). 
Rule 44
    Do not write code which depends on functions that use implicit type conversions. 
Rule 45
    Never convert pointers to objects of a derived class to pointers to objects of a 
    virtual base class. 
Rule 46
    Never convert a const to a non-const. 
Rule 47
    The code following a case label must always be terminated by a break statement. 
Rule 48
    A switch statement must always contain a default branch which handles unexpected cases. 
Rule 49
    Never use goto. 
Rule 50
    Do not use malloc, realloc or free. 
Rule 51
    Always provide empty brackets (`[]') for delete when deallocating arrays.


What is the strtok_s equivalent in VC7? - Stack Overflow
http://stackoverflow.com/questions/307369/what-is-the-strtoks-in-vc7

Apache C++ Standard Library User's Guide
http://stdcxx.apache.org/doc/stdlibug/noframes.html

■_ stackoverflow で訊いてみた

半分ネタ?

What tricks do you use to get yourself "in the zone"? - Stack Overflow
What tricks do you use to get yourself “in the zone”?
	

Once I am "in the zone" I am extremely productive and code just flows out of 
me, often I can get 2 or 3 days coding done in 1 day. But I find that often its hard 
to get to that place, I find myself procrastinating, getting distracted by other 
things (SO for example).

Is this experience common? How do you force yourself into that state of mind? Is it 
simply something you can't force?


Lately, I'm finding the best way to get in the zone is to close my Stack Overflow browser.


I close my email clients.

まあ正論だわな(笑) もうひとつ

What is the strtok_s equivalent in VC7? - Stack Overflow
What is the strtok_s equivalent in VC7?

The strtok_s function exists in vc8 but not in vc7. So what's a function (or code) 
that does the equivalent of strtok_s in vc7?
Take a look at this MSDN page.
http://msdn.microsoft.com/en-us/library/ftsafwz3(VS.80).aspx


I was going to say more, but @dreamlax answered the question well. As far as I can 
tell, the security enhancements a) Make strtok() reentrant (and thread-safe) by having 
it take a "context" parameter and b) Make it safe to use with NULL pointers. (The 
actual behaviors in the case of NULL parameters are listed in a table on the page I've 
linked.)

http://msdn.microsoft.com/en-us/library/2c8d19sb(VS.80).aspx

strtok_sのはなし。

■_ アルゴリズムがいっぱい

EXACT STRING MATCHING ALGORITHMS

Introduction
Introduction

String-matching is a very important subject in the wider domain of text processing. 
String-matching algorithms are basic components used in implementations of practical 
softwares existing under most operating systems. Moreover, they emphasize programming 
methods that serve as paradigms in other fields of computer science (system or 
software design). Finally, they also play an important role in theoretical computer 
science by providing challenging problems.

Although data are memorized in various ways, text remains the main form to exchange 
information. This is particularly evident in literature or linguistics where data are 
composed of huge corpus and dictionaries. This apply as well to computer science where 
a large amount of data are stored in linear files. And this is also the case, for 
instance, in molecular biology because biological molecules can often be approximated 
as sequences of nucleotides or amino acids. Furthermore, the quantity of available 
data in these fields tend to double every eighteen months. This is the reason why 
algorithms should be efficient even if the speed and capacity of storage of computers 
increase regularly.

String-matching consists in finding one, or more generally, all the occurrences of a 
string (more generally called a pattern) in a text. All the algorithms in this book 
output all occurrences of the pattern in the text. The pattern is denoted by x=x[0 .. 
m-1]; its length is equal to m. The text is denoted by y=y[0 .. n-1]; its length is 
equal to n. Both strings are build over a finite set of character called an alphabet 
denoted by Sigma with size is equal to sigma.

Applications require two kinds of solution depending on which string, the pattern or 
the text, is given first. Algorithms based on the use of automata or combinatorial 
properties of strings are commonly implemented to preprocess the pattern and solve the 
first kind of problem. The notion of indexes realized by trees or automata is used in 
the second kind of solutions. This book will only investigate algorithms of the first 
kind.

String-matching algorithms of the present book work as follows. They scan the text 
with the help of a window which size is generally equal to m. They first align the 
left ends of the window and the text, then compare the characters of the window with 
the characters of the pattern - this specific work is called an attempt - and after a 
whole match of the pattern or after a mismatch they shift the window to the right. 
They repeat the same procedure again until the right end of the window goes beyond the 
right end of the text. This mechanism is usually called the sliding window mechanism. 
We associate each attempt with the position j in the text when the window is 
positioned on y[j .. j+m-1].

The Brute Force algorithm locates all occurrences of x in y in time O(mn). The many 
improvements of the brute force method can be classified depending on the order they 
performed the comparisons between pattern characters and text characters et each 
attempt. Four categories arise: the most natural way to perform the comparisons is 
from left to right, which is the reading direction; performing the comparisons from 
right to left generally leads to the best algorithms in practice; the best theoretical 
bounds are reached when comparisons are done in a specific order; finally there exist 
some algorithms for which the order in which the comparisons are done is not relevant 
(such is the brute force algorithm).

とある文字列探索についての本(洋書)が欲しいと思ったのだけど、 値段がいちまんごせんえんもしたのでいまだに買ってないのだった><


Computer Programming Algorithms Directory

■_ スピード比較

ありがとうございます。 手元にある適当そうなデータ食わせても処理時間が短すぎてどうしようかと思っていたところです。



おまぬけ活動日誌(2008-11-20)
sedとかgrepとかの速度

DocoMomoのためのRPMパッケージのダウンロードが全然進まないので試してみた。

sed-4.1.5-1m.mo4、grep-2.5.1a-1m.mo4、ruby-1.8.6.111-4m.mo4、perl-5.8.8-14m.mo4。 検索
対象はビデオカメラを選ぶ時にサンプルとしてダウンロードしたMP4のファイル(13MB)。 下記の
ようなコマンドでuser時間を記録した。

1回ずつしか試してないけど。

$ LANG=<LANG> /usr/bin/time sed -n /hello/p 対象ファイル
$ LANG=<LANG> /usr/bin/time grep hello 対象ファイル
$ LANG=<LANG> /usr/bin/time ruby -ne 'puts $_ if /hello/ =~ $_' 対象ファイル
$ LANG=<LANG>>/usr/bin/time perl -ne '/hello/ && print' 対象ファイル

今回使ったファイルではどのやりかたでも「hello」の含まれる行はみつからなかった。
LANG	C	ja_JP.EUC-JP	ja_JP.UTF-8	en_US	en_US.UTF-8
grep	0.01	0.97	1.06	0.01	1.06
sed	0.10	1.38	1.04	0.10	1.06
ruby	0.15	0.14	0.15	0.15	0.15
perl	0.13	0.13	0.13	0.12	0.12

sedもgrepも文字コードに依存して速度が違う。 言語には依存してないみたい。 perlとrubyで
は文字コードや言語による違いは無かった。

pythonは同等なワンライナーをすぐに思い付けなかったので無し。スミマセン。

えーと、sed とgrepは環境変数LANG(やLC_ALLとかそのへん)を見て マッチング動作が変わりますが、Ruby, Perl, Pythonは違います。 Pythonは出力のときに参照してたかも?

それはさておきなぜsedやgrepがこのような速度低下を起こしているかというと、 localeがマルチバイト文字を含むもののような場合に mbrtowc という「ワイド文字一文字分」変換する関数をやたらと呼び出すからです (mbrlenとかもあったか?)。 マッチングの際にバイト文字列をワイド文字に変換しながら、 ワイド文字基準で動作するというわけです。 これだけが原因とは言い切れませんが、以前にプロファイルとったときは 呼び出し回数が尋常じゃなかったので影響があるのは間違いありません。

Pythonも含めてほかのものはそういうことはしません。 ワイド文字を使ったマッチングをしたいのなら、 ユーザーが何らかの形で自分で変換してからマッチングを実行する必要があります。 あ、Rubyは使用しているエンコーディングの指定が必要ではあっても そこからワイド文字(≒Unicode)への変換はしないですね。

って今見たら食わせたデータバイナリ(MP4)なんですね。 だとすると、上の説明にある mbrtowc で変換エラーを頻発しているはずなので 信頼性にちょっとかけるデータかも。

■_

Ruby に callcc を公式にサポートさせよう - まめめも callccは自分では使わない(使い方が良くわかってない)けど 公式サポートの方向に持っていくのは(それが可能であるのなら)賛成。 ただ

Ruby に callcc を公式にサポートさせよう - まめめも
dynamic-wind は「継続呼び出しによる脱出や再入の際に前処理や後始末をする機構」を提供す
るだけです。なので、外部ライブラリが dynamic-wind を使って脱出や再入の対策をしていない
と、やはり安全ではないです。そういう意味で、結局「ライブラリを全部 callcc safe にする
作業」は必要になります。がっかり。

しかし、Ruby にはそういう「これをすると他のライブラリが変なことになること」は山ほどあ
ります。例えば、組み込みクラスのメソッドを書き換えるとか (例: mathn) 。へたに 
*_missing を定義すると怪しいことになるとか。他には set_trace_func を使うと「
set_trace_func を使うライブラリ」は使えなくなるし、拡張ライブラリで怪しいところで例外
起こせばメモリリークとか close し忘れとかする可能性はあると思います。これらの黒魔術は
公式サポートで、callcc はダメという理由は、ないんじゃないかなあ。

なあたりをどうするか。結局はまつもとさんの胸三寸?


一つ前へ 2008年11月(中旬)
一つ後へ 2008年12月(上旬)

ホームへ


Copyright (C) 2008 KIMURA Koichi (木村浩一)
この文書の無断転載はご遠慮ください(リンクはご自由にどうぞ)。

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