ときどきの雑記帖 2012

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

一つ前へ 2012年10月(下旬)
一つ後へ 2012年11月(中旬)

ホームへ

2012年11月10日

■_

12/1,2 となにかイベントが被っていたような気がするんだけどなんだっけ。 一つはこれ Maker Faire Tokyo 2012

■_ 衝突

ruby 1.9 におけるハッシュ飽和攻撃による DoS 脆弱性 (CVE-2012-5371)

ruby 1.9 におけるハッシュ飽和攻撃による DoS 脆弱性 (CVE-2012-5371)

詳細

この脆弱性は ruby 1.8.7 における CVS-2011-4815 に類似しています。 ruby 1.9 系列は MurmurHash
関数の改変版を使用していましたが、この関数においてもそれぞれのハッシュ値が衝突するような文字
列の並びを作成する手法が報告されました。 今回の対応では、String オブジェクトに対するハッシュ
関数を MurmurHash から SipHash 2-4 に変更しています。

■_

これ、すごいなーと結構関心したんだけど、あんまり肯定的な意見ないのね Microsoft turns spoken English into spoken Mandarin – in the same voice | Hacker News Amazing: Microsoft turns spoken English into spoken Mandarin – in the same voice - The Next Web

■_ Bandit Algorithms

bandit…山賊? Bandit Algorithms for Website Optimization - O'Reilly Media

Bandit Algorithms for Website Optimization - O'Reilly Media

Bandit Algorithms for Website Optimization
Developing, Deploying, and Debugging
By John Myles White
Publisher: O'Reilly Media
Released: November 2012
Pages: 80

最近増えてきたオライリーの「薄い本」 どんな本なんだろうかと説明を見てみると

Bandit Algorithms for Website Optimization - O'Reilly Media

This book shows you how to replace the A/B tests running on your website with a dynamic backend
that is driven by bandit algorithms, which have the potential to substantially improve your
efforts to optimize your website. Author John Myles White shows you how this family of
algorithms can help you boost website traffic, convert visitors to customers, and increase many
other measures of success.

This is the first developer-focused book on bandit algorithms, which have previously only been
described in research papers. You'll learn about several simple algorithms you can deploy on
your own websites to improve your business, including the epsilon-greedy algorithm, the softmax
algorithm and the UCB algorithm. All of these algorithms are implemented in easy-to-follow
Python code and can be quickly adapted to your business's specific needs.

You'll also learn about a framework for testing and debugging bandit algorithms using Monte Carlo
simulations, a technique originally developed by nuclear physicists during World War II. Monte
Carlo techniques allow you to decide whether A/B testing will work for your business needs or
whether you need to deploy a more sophisticated bandits algorithm.

previously only been described in research papers は気になるけど、ちょーっと自分の興味の方向とは違うかなあ。

■_

ET ってこれのことかな。 以前なら「仕事で」行けただろうけど…げしょ。 Embedded Technology 2012

そう言えば、mruby 関連のところで高橋会長が結構現れているのが気になったり。

■_

■_

信頼度成長曲線、というか信頼度成長モデル (software reliability growth model) についてですが 1970年代末1973年の論文が見つかりました。ここからさらに時代を遡れるかはわかりません。 が、その論文を見た限りではありそうな気がします。

そういや「人月の神話」の時代はどうだったんだろか。

2012年11月09日

■_

最近、パニーニ(のチリソース)の方が全然買えない(見かけない)のですよ。 ベーコンの方はたまに見かけるんだけど。 さすがこういうスレッドもあるw ★★★リトルマーメイド★★★ 商品をさがすでも見あたらないのだよねえ リトルマーメイド LITTLE MERMAID / 焼き立てパンの店

たけえ… これ買ってもおつりが来るくらいの額が減ってるからなあ>ぼ 正直そこまで金かける余裕がナッシング。 ASCII.jp:どこでも使えるWindows 8の本命!「レッツノート AX2」

■_ 戦国鍋TV

「戦国にほえろ!」とか「戦国ロボ」が 結構好きだった>戦国鍋TV 『戦国鍋TV~なんとなく歴史が学べる映像~』番組ホームページ

~みなもと太郎「風雲児たち」茶屋 其の参拾九~

255 名無しんぼ@お腹いっぱい [sage] 2012/11/07(水) 17:35:21.66 ID:LeyT0dyQ0 Be:
    江戸時代の庶民も、芝居や講釈で戦国時代の知識はかなりあったと思う。

    芝居では、実名をそのまま出すと差し障りがあるので、
    名前を微妙に変えたり、時代背景を鎌倉、室町に変えたりして上演されていた。

    講談の難波戦記なんかは、大阪の陣の真田幸村がヒーローだしな 

256 名無しんぼ@お腹いっぱい [sage] 2012/11/07(水) 21:53:12.26 ID:c0Jx4GTj0 Be:
    芝居は多少金がかかるが、貸本は非常に安かったらしいね。字さえ読めれば
    小説程度の知識はあったんじゃないかな。 

257 名無しんぼ@お腹いっぱい [sage] 2012/11/08(木) 19:25:27.39 ID:tU5E9Anb0 Be:
    忠臣蔵の47士の名前を全部言える、くらいは普通だったからな

    今で言う、AKB48みたいなものだ 

258 名無しんぼ@お腹いっぱい [sage] 2012/11/08(木) 19:41:41.98 ID:xxUPzmqP0 Be:
    AKO47 

259 名無しんぼ@お腹いっぱい [sage] 2012/11/08(木) 20:38:45.59 ID:dUY7ANia0 Be:
    絵本太閤記が大ヒットしたため、文化元年(1804)に発禁となってしまった。
    以降、天正期より後の戦国時代の合戦や武将をを題材にすると罰せられることになった。

    ただ天正期以前は問題がなかったため、それ以前に活躍する武田・上杉の武将が描かれまくることになる。
    そのため大した戦いでもないのに川中島の戦いが異様に有名になってしまったらしい。

    ちなみに天正期の武将も真柴久吉とか岸田光成とか名前を変えることで規制をかいくぐってたりする。 

260 名無しんぼ@お腹いっぱい [] 2012/11/09(金) 01:25:57.43 ID:g6bk5KFp0 Be:
    なるほど、「仮名手本」は忠臣蔵だけじゃないって訳か 

261 名無しんぼ@お腹いっぱい [] 2012/11/09(金) 01:44:17.84 ID:CX+Bgs2f0 Be:
    徳川家康を褒め称える趣旨の芝居も禁止だったのだろうか? 

262 名無しんぼ@お腹いっぱい [] 2012/11/09(金) 03:38:34.48 ID:g6bk5KFp0 Be:
    神君を役者が演じてたらアウトじゃね? 

263 名無しんぼ@お腹いっぱい [sage] 2012/11/09(金) 08:54:49.89 ID:EItbbzvC0 Be:
    >>258
    だれうま 

264 名無しんぼ@お腹いっぱい [] 2012/11/09(金) 09:23:01.43 ID:xN7ImZpcO Be:
    江戸の庶民の娯楽は文楽や落語方が安くて簡単に見られた(特に落語はなにも要らないから街角に一軒ぐらいの多さで開催場所があったくらい)

    歌舞伎はどちらかと言うと、贅沢な娯楽でそんなに見ることは出来なかった(代わりに絵草紙とかで代用品で満足する人もいた) 

265 名無しんぼ@お腹いっぱい [sage] 2012/11/09(金) 11:10:01.65 ID:2BYlLSSOO Be:
    >>258
    すでに戦国鍋で「討ちに来てくれるアイドル」AKR四十七がいるぞw 

266 名無しんぼ@お腹いっぱい [sage] 2012/11/09(金) 16:14:03.22 ID:H2wU+nRg0 Be:
    戦国鍋TVは松陰せんせーも確かアイドルデビューしてた記憶がw

    つか、普通のバラエティよりよっぽど面白いのになんで全国ネットはこんなの作らないんだろうか? 

267 名無しんぼ@お腹いっぱい [sage] 2012/11/09(金) 19:09:48.19 ID:xQSWz0va0 Be:
    >>260
    「仮名手本」は、「手習いの手本のいろは四十七文字」=「武士の手本の四十七士」という意味だろうけど、
    たしかに「仮名(実際の名前でない)」にも通じるね。

    仮名=亀井(茲親)は無いだろうな。 

戦国鍋TV~なんとなく歴史が学べる映像~再出陣! 壱 [DVD]

■_

この記事はとても良いと思うの 数値計算 - Microsoft Cloud Numerics の数学関数をテストする

数値計算 - Microsoft Cloud Numerics の数学関数をテストする

数学の計算を実行する必要があるとします。たとえば、角度 34 度の正弦値を求める必要があるとします。
どうするでしょうか。おそらく、電卓やコンピューターなどのスマート デバイスを使用するでしょう。
デバイスに「sin(34)」と入力すれば、多くの場合、小数点以下 16 桁の精度で答えが得られます。では、
その答えが正しいかどうか、どうすればわかるでしょう。

電子機器を使って計算結果を得ることに慣れているあまりに、だれもその答えが正しいかどうか疑わなく
なっています。ほとんどだれもが、当然のように機械が正解を教えてくれると思っています。しかし、ソ
フトウェアの品質管理技術者という、正確さを当たり前とは考えない人々もいます。彼らの仕事は必ず正解
を得られるようにすることです。今回は、新しい Microsoft Cloud Numerics 数学ライブラリの数学関数を
テストする方法について説明します。

以下略

ということで一読をオススメ。 ところで 上の記事の末尾でも紹介されている Goldberg の例の文書の日本語訳はもうアクセスできないのだっけ? (Sun のサイトのどこかだったと思うのだけど)

■_ レビュアー募集

Types and Programming Language 日本語版 レビュワー募集

Types and Programming Language 日本語版 レビュワー募集

応募要件:下記 A)、B) の少なくとも一方を満たす方

    A) プログラミング言語の基礎理論、特に型システム周辺にある程度習熟している
    B) 原書 "Types and Programming Languages" を読んだ経験があり、一定以上理解している

まだ読んでる途中だしなあ>TAPL

A) について? それは訊ねるだけ野暮というもの(ry

■_ APL

APL (and/or J) は覚えたい使ってみたいとは常々思ってるんだけども以下略。 J の バイナリパッケージをダウンロード&インストールして何回か使ったきりだ。 RubyWorld Conference 2012 二日目のまとめ - Togetter

■_ The F# Software Foundation

Foundation 設立とな。 The F# Software Foundation

The F# Software Foundation

F# is an open source, functional-first programming language which empowers users and organizations
to tackle complex computing problems with simple, maintainable and robust code. It is used in a
wide range of application areas and is available across multiple platforms.

F# runs on Linux, Mac OS X, Windows as well as HTML5 and GPUs. F# is free to use and has an
OSI-approved open-source license.

F# is supported by industry leading companies providing professional tools, and by an active open
source community.

The F# Software Foundation exists to promote, protect, and advance F#, and to support and foster
the growth of a diverse international community of F# users.

■_

■_ 来た

マクドナルド、今年の「グラコロ」は贅沢デミチーズも仲間入り! | ライフ | マイナビニュース 日本マクドナルドは14日、「グラコロ」(290円~330円)「デミチーズグラコロ」(310円~350円)を全国の 「マクドナルド」店舗にて発売する。12月中旬までの期間限定販売予定。

■_

今日も信頼度成長曲線ネタを書けなかった。 がっくし。

2012年11月08日

■_

Nexus 7
ちょこちょこと設定しています。 と言っても入れるソフトはあまりないし(というかどういうのがあるのかよく知らない)、 手間としてはそれほどのものではないはずなんですが。 ちょっといじった印象では、A4 PDFも読めなくはないですね。 思ったよりは良い感じでした。 iPad、iPad mini あたりと見比べてみたいものだけど。

■_

■_

お、Julia の話題 Julia: A Fast Dynamic Language For Technical Computing

■_ 信頼度成長曲線

書くネタはそこそこ集まってるんですがまとめるのが面倒w

■_

時間ねー

2012年11月07日

■_

読みたいとは思いつつ、積ん読以前に買ってもいない本が何冊か。 それで忘れてしまえばそれはそれで幸せなのかもしれない(謎)

■_

未明にこういうお題が投げられていまして

すぐに寄せられた回答がこちら

ぱっと見で動作を把握できなかったので ステップごとに確認しれみました :)

irb(main):001:0> a=[1,2,3,5,6,7]
=> [1, 2, 3, 5, 6, 7]
irb(main):002:0> a.each_cons(2)
=> #<Enumerator: [1, 2, 3, 5, 6, 7]:each_cons(2)>
irb(main):003:0> [*a.each_cons(2)]
=> [[1, 2], [2, 3], [3, 5], [5, 6], [6, 7]]
irb(main):004:0> a.each_cons(2).group_by{|(x, y)|x!=y-1}
=> {false=>[[1, 2], [2, 3], [5, 6], [6, 7]], true=>[[3, 5]]}
irb(main):005:0> a.each_cons(2).group_by{|(x, y)|x!=y-1}[true]
=> [[3, 5]]
irb(main):006:0> b=a.each_cons(2).group_by{|(x, y)|x!=y-1}[true].map{|i|i[0]}
=> [3]
irb(main):007:0> a.group_by{|i|b.find_index{|j|j<=i}}
=> {nil=>[1, 2], 0=>[3, 5, 6, 7]}

そのほか寄せられていた回答 Ideone.com | Online Ruby Interpreter & Debugging Tool

# https://gist.github.com/1481377
class Array
  def bunch(num)
    old = self.clone
    new = []
    while 1
      bunched = []
      num.times do
        bunched << old.shift
      end
      new << bunched
      break if old.empty?
    end
    new
  end
end

[1,2,3,5,6,7].keep_if {|i| i unless 0==i%2 }.bunch(2).each {|i| puts "#{i[0]}-#{i[1]}" }
# https://gist.github.com/1481377
class Array
  def bunch(num)
    old = self.clone
    new = []
    while 1
      bunched = []
      num.times do
        bunched << old.shift
      end
      new << bunched
      break if old.empty?
    end
    new
  end
end

[1,2,3,5,6,7].keep_if {|i| i unless 0==i%2 }.bunch(2).each {|i| puts "#{i[0]}-#{i[1]}" }

keep_if ってなんだっけ。と調べる。

keep_if (Array) - Rubyリファレンス

keep_ifメソッドは、メソッドは、要素の数だけ繰り返しブロックを実行し、ブロックの戻り値が
真になった要素を残し、偽になった要素を削除します。レシーバ自身を変更するメソッドです。
ブロック引数itemには各要素が入ります。

select!と同じことをするメソッドですが、要素を削除したときもしなかったときも戻り値は常に
レシーバ自身です。ブロックを渡さなかったときはEnumeratorオブジェクトを返します。

ふむふむ。 keep_if (Hash) - Rubyリファレンス

■_ 東武野田線

「野田線の新車発表」の衝撃がどれくらいか、わかりやすく説明すると - Togetter

佐藤大輔 86 [chaika]

123 名無し三等兵 [sage] 2012/11/07(水) 03:09:33.19 ID:??? Be:
    「野田線の新車発表」というものは、それこそ関東人以外にもわかりやすく説明すると
     佐藤大輔が皇国の守護者とレッドサン・ブラッククロスの続きを出したり、永野護が
     FSSを完結させるくらいの衝撃と言う事です。

    沿線住民のオレとしては新作より新車でホッとしてるぜ・・・ 

■_ 8 things you probably didn't know about C#

C# についてあなたが知らない8つのことがら 8 things you probably didn't know about C# » DamienG

8 things you probably didn't know about C# » DamienG

Here's a few unusual things about C# that few C# developers seem to know about.

1. Indexers can use params

We all know the regular indexer pattern x = something["a"] and to implement it you write:

  public string this[string key] {
    get { return internalDictionary[key]; }
  }

But did you know that you can use params to allow x = something["a", "b", "c", "d"] ?

Simply write your indexer like this:

  public IEnumerable<string> this[params string[] keys] {
    get { return keys.Select(key => internalDictionary[key]).AsEnumerable(); }
  }

The cool thing is you can have both indexers in the same class side-by-side. If somebody passes
an array or multiple args they get an IEnumerable back but call with a single arg and they get
a single value.

あとの七つは元記事で

■_

2012年11月06日

■_

今日の購入
歴史群像 2012年 12月号 [雑誌]
歴史群像 2012年 12月号 [雑誌]

■_

いなばさんはこういうのはお好みではないだろうなあ。たぶん。 http://researcher.watson.ibm.com/researcher/files/us-lefurgy/micro30.net.compress.pdf

■_ IT業界をガンダムで

数日前に盛り上がったネタですが IT戦士達の悲痛な叫びがTwitterで共鳴した日 #IT業界をガンダムで ツイートまとめ  - Togetter

自分が出すなら、↓のジオン兵Cの台詞を使うかなあ (残念なことに映画版(めぐりあい宇宙編)では使われてないのですが)

機動戦士ガンダム ファンサイト GUNDAM FUN: 第43話「脱出」全セリフ&コメント付

ジオン兵A 「外には敵がうようよいるんだ」
ジオン兵B 「ドム中隊をまわせ。いくらなんでもザンジバル一隻じゃあ」
ジオン兵C 「冗談じゃないよ、死にに行く訳じゃないんだ。護衛機をまわせ。ザクでいいザクで」
キシリア 「手間取るようか?」
ジオン士官A 「申し訳ありません」
キシリア 「急がせい、他の兵に気取られるな」 

ところで

これはガンダムじゃなくてエヴァンゲリオンじゃなかろか。

■_ 三角関数

これまたちょっと前のついったから。

なんか知らないのが結構あったり(exsecとか)、 cosh とかないよねと思いつつうぃきぺを見ると Exsecant - Wikipedia, the free encyclopedia 三角関数 - Wikipedia

三角関数 - Wikipedia
2次元ユークリッド空間 R2 における単位円 x2 + y2 = 1 上で、点 (1,0) から正の向きに回転する動点
P = (x,y) に対して、動点と原点を結ぶ線分が x 軸の正方向と成す角を t として、

\sin\ t = y
\cos\ t = x
\tan\,t = \frac{\sin\,t}{\cos\,t} = {y \over x}

上から正弦関数(sine; サイン)・余弦関数(cosine; コサイン)・正接関数(tangent; タンジェント)
と呼び、これらを総称して三角関数と呼ぶ。さらにその逆数、

\mathrm{cosec}\,t = {1 \over \sin\,t} = {1 \over y},
\sec\,t = {1 \over \cos\,t} = {1 \over x},
\cot\,t = {1 \over \tan\,t} = {x \over y}

を、上から余割関数(cosecant; コセカント)・正割関数(secant; セカント)・余接関数(cotangent;
コタンジェント)と呼び、これらを総称して割三角関数(かつさんかくかんすう)と呼ぶ。また、割三角
関数を含めて三角関数と呼ぶこともある。cosec は長いため、主に csc と書く。

セカント、コセカントは知ってたけど 割三角関数なんて呼び名は知らなかった。 そして 双曲線関数 - Wikipedia

双曲線関数 - Wikipedia

一般に、双曲線関数は指数関数 ex を用いて

{\rm sinh}\ x = {e^x - e^{-x} \over 2},\ \ {\rm cosh}\ x = {e^x + e^{-x} \over 2}

と定義される。sinh, cosh をそれぞれ双曲線正弦関数 (hyperbolic sine; ハイパボリックサイン)、双曲線余弦関数 (hyperbolic cosine; ハイパボリックコサイン) と呼ぶ。他にも三角関数との類似で双曲線正接・余接関数

{\rm tanh}\ x = {{\rm sinh}\ x \over {\rm cosh}\ x},\ \ {\rm coth}\ x = {1 \over {\rm tanh}\ x}

や、双曲線正割・余割関数

{\rm sech}\ x = {1 \over {\rm cosh}\ x},\ \ {\rm cosech}\ x = {1 \over {\rm sinh}\ x}

なども定義できる。

■_

■_ volatile

ふと気になったのですが、 このバグのように volatile つけて解決というのがわりとあったような印象なのですが 実際のところはどうなんでしょうね (面倒くさいので調べるところまではやらない奴)。 いや、これは元々あった変数を volatile にしたのじゃないのか。 Bug #7044: BigDecimal#power randomly raises coercion errors - ruby-trunk - Ruby Issue Tracking System

Bug #7044: BigDecimal#power randomly raises coercion errors - ruby-trunk - Ruby Issue Tracking System

diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index f58b640..36ca77d 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -2016,6 +2016,7 @@ static VALUE
 rmpd_power_by_big_decimal(Real const* x, Real const* exp, ssize_t const n)
 {
     VALUE log_x, multiplied, y;
+    volatile VALUE obj = exp->obj;

     if (VpIsZero(exp)) {
        return ToValue(VpCreateRbObject(n, "1"));
@@ -2024,6 +2025,7 @@ rmpd_power_by_big_decimal(Real const* x, Real const* exp, ssize_t const n)
     log_x = BigMath_log(x->obj, SSIZET2NUM(n+1));
     multiplied = BigDecimal_mult2(exp->obj, log_x, SSIZET2NUM(n+1));
     y = BigMath_exp(multiplied, SSIZET2NUM(n));
+    RB_GC_GUARD(obj);

     return y;
 }

2012年11月05日

■_

テレ玉でガンダム(最初のやつ)を放送してまして。 大体映画版でいうと哀・戦士編の終わり辺りなんですが、 観ているとどうしても映画版と比較しちゃいますね。 哀・戦士編のラスト(フラミンゴの群れ→ザンジバル発進→宇宙へ昇ったホワイトベースを背景にスタッフロール) から、 めぐりあい宇宙編の最初(「機動戦士ガンダム III めぐりあい宇宙編」と出る辺り)までがとても好きだったり。

■_ History of Algol 68

よく見ると HOPL II での資料らしい 1993: A History of ALGOL 68 - C. H. Lindsey (4.3M PDF) - [Includes a candid reflection of the language design process "Revision by mail", language feature struggles "The Bend" and included/excluded ambiguities (eg Yonah's ambiguity and incestuous unions)] : programming http://cs305.com/book/programming_languages/Conf-01/HOPLII/p27-lindsey.pdf こっちはAlgol 68でのプログラム例。 http://www.dickgrune.com/CS/Algol68/MiscellaneousPrograms

■_

reddit から。 まつもとさんの見た目の若さに言及している人が複数。

Met this nice guy at Rubyconf! : ruby

Met this nice guy at Rubyconf! (i.imgur.com)


Hah. Very cool. Although also unsurprising, since he's been to every Rubyconf since the first one!


Met Matz at Euruko earlier this year; he was genuinely nice and really happy to speak to anyone
and everyone. He was also really excited about the possibilities of mruby, his current project.

Sorry, who is this guy? I'm new here.


the big cheese.


47 years old? Guy looks like he's 25!


Asian


Matz is one of the nicest, most low-key, people you could ever meet.

Pretty much everyone there has a photo with Matz.

Here are piles of random people with Matz at this RubyConf.


Nice Highgroove shirt!


You look nice too, the beard is very classy.

OK, he invented Ruby, hats off and all that. But how the heck is he 47 years old and looks 27? Well???

He's Japanese. East Asians seem to have this magical ability to stay 20 until they suddenly
turn into wizened old folks.

■_

2012年11月04日

■_

こんにちは情弱です

いやまあどれにしようか考えはしたんですけどね。 iPad mini も黒の32Gと64Gならあったし。 mini じゃないほうか mini かどっちかにするかということまで決めて先送り。 全部買うほどのよゆーはありません :)

買った。 新アレンジのギャバンの主題歌はちと… 「中二病でも恋がしたい!」のOPは気に入ったので。 相変わらず円盤で買ってしまう辺りが以下略
宇宙刑事ギャバン THE MOVIE オリジナル・サウンドトラック TVアニメ TARI TARI ミュージックアルバム~歌ったり、奏でたり~ Sparkling Daydream【初回限定盤】(DVD付)

参加者の顔ぶれがなかなか わかめのモナド浸し - connpass

■_ Perl 6

川の流れのように(謎)

Perl 6 changes - 2012W40 | π ** 6


New features

STD.pm6

    Postfix operators like .foo-bar take precedence above method calls.

Rakudo Perl

    Better delimiter handling. For example, rx and m allow delimiters other than // or {}.
    Quote adverbs, such as :w or :x are supported.
    Implemented andthen infix operator.
    You can specify input line separator on new sockets using :input-line-separator named argument.
    Quotes have better error reporting.
    Heredocs are implemented.
    Macro arguments now carry lexical envirnoment properly.
    Postfix operators like .foo-bar take precedence above method calls.
    Git merge conflicts markers are now detected properly.

Niecza Perl

    qw is unsafe and cannot be used in safe (sandbox) mode.
    Postfix operators like .foo-bar take precedence above method calls.

© 2012 GlitchMr (Konrad Borowski).

better delimiter handling ってちょっと気になる。 というか今までは // と {} しか許されてなかった?

■_ C

この辺のやり取りちょっと気になった (そして自分なりに思うところもあるのだけどその辺は以下略) Twitter / _ko1: @shyouhei C ...

■_

■_

近々に一週間時間が取れる予定なんですけど、 平日の朝から夕方までもくもくできる良い場所ないですかねー。 といってあまりお金も掛けられないのだけど。 都立中央図書館に通い詰めようかしらん。

2012年11月03日

■_

押井守の「世界の半分を怒らせる」。:押井守の「世界の半分を怒らせる」。 - ニコニコチャンネル:社会・言論 有料会員になって購読開始してみました。 バックナンバーは別途購入する必要がありましたがまあそれもよし。 これまでの分を読んだ限りでは十分満足できるものだと思います (こういうのを「コスパがいい」とか表現するのはキライだ)。

うーむ。本当どうしましょう。

■_ System F

TaPL もうちょっと読み進むと、一章丸々 System F とかなっているみたいなんですが なんかいい資料があったら教えてください。正直良くわからん → System F - Wikipedia

■_ アルゴリズム記事あれこれ

初めて聞くようなものも結構あるんだけど(little known だけあって)、 読んで理解するのがなかなか。 誰か日本語に(ry Little-Known-Algorithms Series | Swageroo Algorithms Damn Cool Algorithms: Homomorphic Hashing - Nick's Blog

■_ CRANE

マイクロソフトこういうこともやってるのね。 CRANE: Failure Prediction, Change Analysis and Test Prioritization in Practice - Experiences from Windows - Microsoft Research

CRANE: Failure Prediction, Change Analysis and Test Prioritization in Practice - Experiences from Windows - Microsoft Research

CRANE: Failure Prediction, Change Analysis and Test Prioritization in Practice - Experiences from Windows

Jacek Czerwonka, Rajiv Das, Nachiappan Nagappan, Alex Tarvo, and Alex Teterev

30 March 2011

Building large software systems is difficult. Maintaining large systems is equally hard. Making
post-release changes requires not only thorough understanding of the architecture of a software
component about to be changed but also its dependencies and interactions with other components
in the system. Testing such changes in reasonable time and at a reasonable cost is a difficult
problem as infinitely many test cases can be executed for any modification. It is important to
obtain a risk assessment of impact of such post-release change fixes. Further, testing of such
changes is complicated by the fact that they are applicable to hundreds of millions of users,
even the smallest mistakes can translate to a very costly failure and re-work. There has been
significant amount of research in the software engineering community on failure prediction,
change analysis and test prioritization. Unfortunately, there is little evidence on the use of
these techniques in day-to-day software development in industry. In this paper, we present our
experiences with CRANE: a failure prediction, change risk analysis and test prioritization
system at Microsoft Corporation that leverages existing research for the development and
maintenance of Windows Vista. We describe the design of CRANE, validation of its useful-ness and
effectiveness in practice and our learnings to help enable other organizations to implement
similar tools and practices in their environment.

■_

The Codist

The Codist

After reading this overly long tome: What Programmers Want I thought a bit about programmer motivation.

What Programmers Want « Michael O.Church

What Programmers Want « Michael O.Church

Most people who have been assigned the unfortunate task of managing programmers have no idea how to motivate them. They believe that the small perks (such as foosball tables) and bonuses that work in more relaxed settings will compensate for more severe hindrances like distracting work environments, low autonomy, poor tools, unreasonable deadlines, and pointless projects. They're wrong. However, this is one of the most important things to get right, for two reasons. The first is that programmer output is multiplicative of a number of factors– fit with tools and project, skill and experience, talent, group cohesion, and motivation. Each of these can have a major effect (plus or minus a factor of 2 at least) on impact, and engineer motivation is one that a manager can actually influence. The second is that measuring individual performance among software engineers is very hard. I would say that it's almost impossible and in practical terms, economically infeasible. Why do I call infeasible rather than merely difficult? That's because the only people who can reliably measure individual performance in software are so good that it's almost never worth their time to have them doing that kind of work. If the best engineers have time to spend with their juniors, it's more worthwhile to have them mentoring the others (which means their interests will align with the employees rather than the company trying to perform such measurement) than measuring them, the latter being a task they will resent having assigned to them.

Seasoned programmers can tell very quickly which ones are smart, capable, and skilled– the all-day, technical interviews characteristic of the most selective companies achieve that– but individual performance on-site is almost impossible to assess. Software is too complex for management to reliably separate bad environmental factors and projects from bad employees, much less willful underperformance from no-fault lack-of-fit. So measurement-based HR policies add noise and piss people off but achieve very little, because the measurements on which they rely are impossible to make with any accuracy. This means that the only effective strategy is to motivate engineers, because attempting to measure and control performance after-the-fact won't work.

Traditional, intimidation-based management backfires in technology. To see why, consider the difference between 19th-century commodity labor and 21st-century technological work. For commodity labor, there's a level of output one can expect from a good-faith, hard-working employee of average capability: the standard. Index that to the number 100. There are some who might run at 150-200, but often they are cutting corners or working in unsafe ways, so often the best overall performers might produce 125. (If the standard were so low that people could risklessly achieve 150, the company would raise the standard.) The slackers will go all the way down to zero if they can get away with it. In this world, one slacker cancels out four good employees, and intimidation-based management– which annoys the high performers and reduces their effectiveness, but brings the slackers in line, having a performance-middling effect across the board– can often work. Intimidation can pay off, because more is gained by intimidating the slacker into mediocrity brings more benefit than is lost. Technology is different. The best software engineers are not at 125 or even 200, but at 500, 1000, and in some cases, 5000+. Also, their response to a negative environment isn't mere performance middling. They leave. Engineers don't object to the firing of genuine problem employees (we end up having to clean up their messes) but typical HR junk science (stack ranking, enforced firing percentages, transfer blocks against no-fault lack-of-fit employees) disgusts us. It's mean-spirited and it's not how we like to do things. Intimidation doesn't work, because we'll quit. Intrinsic motivation is the only option.

Bonuses rarely motivate engineers either, because the bonuses given to entice engineers to put up with undesirable circumstances are often, quite frankly, two or three orders of magnitude too low. We value interesting work more than a few thousand dollars, and there are economic reasons for us doing so. First, we understand that bad projects entail a wide variety of risks. Even when our work isn't intellectually stimulating, it's still often difficult, and unrewarding but difficult work can lead to burnout. Undesirable projects often have a 20%-per-year burnout rate between firings, health-based attrition, project failure leading to loss of status, and just plain losing all motivation to continue. A $5,000 bonus doesn't come close to compensating for a 20% chance of losing one's job in a year. Additionally, there are the career-related issues associated with taking low-quality work. Engineers who don't keep current lose ground, and this becomes even more of a problem with age. Software engineers are acutely aware of the need to establish themselves as demonstrably excellent before the age of 40, at which point mediocre engineers (and a great engineer becomes mediocre after too much mediocre experience) start to see prospects fade.

The truth is that typical HR mechanisms don't work at all in motivating software engineers. Small bonuses won't convince them to work differently, and firing middling performers (as opposed to the few who are actively toxic) to instill fear will drive out the best, who will flee the cultural fallout of the firings. There is no way around it: the only thing that will bring peak performance out of programmers is to actually make them happy to go to work. So what do software engineers need?

The approach I'm going to take is based on timeframes. Consider, for an aside, peoples' needs for rest and time off. People need breaks at  work– say, 10 minutes every two hours. They also need 2 to 4 hours of leisure time each day. They need 2 to 3 days per week off entirely. They need (but, sadly, don't often get) 4 to 6 weeks of vacation per year. And ideally, they'd have sabbaticals– a year off every 7 or so to focus on something different from the assigned work. There's a fractal, self-similar nature to peoples' need for rest and refreshment, and these needs for breaks tap into Maslovian needs: biological ones for the short-timeframe breaks and higher, holistic needs pertaining to the longer timeframes. I'm going to assert that something similar exists with regard to motivation, and examine six timeframes: minutes, hours, days, weeks, months, and years.

■_

2012年11月02日

■_

どうしようかなあ Nexus 10、新iPad、Surfaceを比較(WIRED.jp):ニュース:PC Online

■_ Ceylon

Ceylon: Ceylon M4 and Ceylon IDE M4 released! M はなんのことだろうと思ったら Milestone らしい。 ソースはこっち→ ceylon (Ceylon)

Ceylon: Ceylon M4 and Ceylon IDE M4 released!

Ceylon M4 "Analytical Engine" is now available for download, along with a simultaneous
compatible release of Ceylon IDE. The compiler now implements almost all of the language
specification, for both Java and JavaScript virtual machines as execution environments. New
Ceylon platform modules are available in Ceylon Herd, the community module repository.

You can download the Ceylon command line distribution here:

  http://ceylon-lang.org/download

Or you can install Ceylon IDE from Eclipse Marketplace or from our Eclipse update site.

Ceylon M4 and Ceylon IDE M4 require Java 7.

The Ceylon team hopes to release Ceylon 1.0 beta in January.

■_ Why Are You Not Using Functional Languages?

InfoQ の記事(というかアンケート)に対する reddit での反応から

Why Are You Not Using Functional Languages? : programming

I'm kinda new to haskell, so I can't tell readable haskell from unreadable. I'll be happy to
see suggestions.


What makes it so unreadable?


you kidding me ?

    ...User <$> str <> str <> num <> num <> str <> str <> str


Why, because of the <$> and <*>? It doesn't seem unclear to me. Parse a user by
parsing two string fields, two number fields, then three string fields, and use the results as
the arguments to the constructor.

It is actually quite elegant. Two very generic operators with a very specific meaning. Actually
far more generic than you might glean from this example. What this means is these are operators
you encounter very often in Haskell and are likely to know what they mean.


There's a good reason this is like this.

<$> is just fmap. It maps function over a functor. In parsec, specifically, parsers are
functors; they result in values and can be combined with functions. That is fmap.

<*> is from the Applicative class. These are called applicative functors, which,
unsurprisingly, are similar to functors. A functor boxing a function a -> b <*> a functor
boxing an a will result in a functor of b. It applies functions within functors.

This is particularly useful, because it means you can combine multiple applicative functors
(parsers, in this case) over one function. It allows you to join results.

Note that f <$> a <*> b is equivalent to pure f <*> a <*> b. pure simply
lifts a value into that applicative functor. It's equivalent to return in monads. (All monads
are, in fact, applicative functors as well.)

確かに < > で囲まれた記号がばしばし出てくるのはよくわからん (不勉強なだけだけど)。

■_ 七匹のモンスター

ハロウィーンねたですが 7 Monsters that Scare the Crap Out of Software Developers (Illustration)

元記事の美麗なイラストは是非。 そして七匹の解説。

7 Monsters that Scare the Crap Out of Software Developers (Illustration)

The Monsters, Detailed

The Blood Sucking Manager: This sucky boss siphons all the creative energy out of the work by
micromanaging every detail - often times with unsubstantiated opinions. Beware, because this
manager frequently under-appreciates your work... before he sucks your blood!

マイクロマネージメントを駆使して creative energy を吸い取る吸血マネージャー?


The Productivity Slasher: This terror disrupts a developer's flow by always wanting to meet.
It's likely he is also constantly adding new work to tasks already in progress.

ミーティングやらで邪魔したり余計な仕事を押し付けると。

The Hydra: As if wrangling with one monster wasn't enough, this ghoul is an entire committee
wrapped in one. There's nothing worse than having time wasted when major decisions are dragged out
by a group of people without good process.

Doctor Franken-Code: There's nothing scarier than building on top of a pile of horribly managed
spaghetti code. This monster is the product of bad work by the previous surgeon, and a boss who
requires the next one to maintain it.

えーと horribly managed なスパゲッティコードを量産すると。

The Scope CREEP: Feared by most, this manager runs amuck by constantly changing the scope of work
without extending the timeline or budget. His minions will be pulled on a death march until it is
completed.

朝令暮改の鬼?


The Half-Baked Brain Eater: This creepy critter aimlessly wanders the industry searching for a
developer to start working on short term throw-away work for something that hasn't been thought
through. The lack of thinking is frightful!


The Apparition: Now you see him... now you don't! This phantom client suffers from bad
communication, and unclear intentions. Not only do they not respond timely to questions about
the project, but they sneak up on you when you thought they had left.

■_

もうちょっと粘った

> sign(-5<0)
[1] 1
> sign(5<0)
[1] 0
> sign(-5<0)
[1] 1
> -3:4
[1] -3 -2 -1  0  1  2  3  4
> sapply(-3:4, function(x){sign(x<0)})
[1] 1 1 1 0 0 0 0 0
> sapply(-3:4, function(x){log10(abs(x))+sign(x<0)})
[1] 1.4771213 1.3010300 1.0000000      -Inf 0.0000000 0.3010300 0.4771213 0.6020600
> max(sapply(-3:4, function(x){log10(abs(x))+sign(x<0)}))
[1] 1.477121
> max(sapply(-3:4, function(x){log10(abs(x))+sign(x<0)+1}))
[1] 2.477121
> fun<-function(x){max(sapply(x, function(x){log10(abs(x))+sign(x<0)+1}))}
> fun(-5:4)
[1] 2.69897
> fun<-function(x){max(sapply(x, function(y){log10(abs(y))+sign(y<0)+1}))}
> fun(-5:4)
[1] 2.69897
> (function(x){X<-outer(x,x);w<-fun(x);dimnames(X)<-list(formatC(x,width=w),x);return(X)})(-3:4)
    -3 -2 -1 0  1  2  3   4
-3   9  6  3 0 -3 -6 -9 -12
-2   6  4  2 0 -2 -4 -6  -8
-1   3  2  1 0 -1 -2 -3  -4
 0   0  0  0 0  0  0  0   0
 1  -3 -2 -1 0  1  2  3   4
 2  -6 -4 -2 0  2  4  6   8
 3  -9 -6 -3 0  3  6  9  12
 4 -12 -8 -4 0  4  8 12  16
> (function(x){X<-outer(x,x);w<-fun(x);dimnames(X)<-list(formatC(x,width=w),formatC(x,width=w));return(X)})(-3:4)
    -3 -2 -1  0  1  2  3   4
-3   9  6  3  0 -3 -6 -9 -12
-2   6  4  2  0 -2 -4 -6  -8
-1   3  2  1  0 -1 -2 -3  -4
 0   0  0  0  0  0  0  0   0
 1  -3 -2 -1  0  1  2  3   4
 2  -6 -4 -2  0  2  4  6   8
 3  -9 -6 -3  0  3  6  9  12
 4 -12 -8 -4  0  4  8 12  16

素直に関数定義してやったほうがいいよね… 無名関数から呼び出す関数作っちゃってるし。

■_

■_ REL

正規表現を組み立てる。 後方参照がネストしたりした場合はどうなるんだろ? Imaginatio/REL

REL by Imaginatio


REL, a Regular Expression composition Library

REL is a small utility Scala library for people dealing with complex, modular regular
expressions. It defines a DSL with most of the operators you already know and love. This
allows you to isolate portions of your regex for easier testing and reuse.

Consider the following YYYY-MM-DD date regex: ^(?:19|20)\d\d([- /.])(?:0[1-9]|1[012])\1(?:0[1-9]|[12]\d|3[01])$.
It is a bit more readable and reusable expressed like this:

  import fr.splayce.REL._
  import Implicits._

  val sep     = "[- /.]" \ "sep"            // group named "sep"
  val year    = ("19" | "20") ~ """\d\d"""  // ~ is concatenation
  val month   = "0[1-9]" | "1[012]"
  val day     = "0[1-9]" | "[12]\\d" | "3[01]"
  val dateYMD = "^" ~ year  ~ sep ~ month ~ !sep ~ day  ~ "$"
  val dateMDY = "^" ~ month ~ sep ~ day   ~ !sep ~ year ~ "$"

These value are RE objects (trees/subtrees), which can be converted to scala.util.matching.Regex
instances either implicitly (by importing REL.Implicits._) or explicitly (via the .r method).

The embedded Date regexes and extractors will give you more complete examples, matching several
date formats at once with little prior knowledge.

(略)
License

Copyright © 2012 Imaginatio SAS

REL is released under the MIT License

2012年11月01日

■_

APRESS でも 40% 引きってのがあったんですが CTOs at Work CIOs at Work この辺が対象で、 自分が欲しいと思った Expert F# 3.0 - F# - Microsoft Expert C# 5.0 - F# - Microsoft A Programmer's Guide to C# 5.0 - F# - Microsoft Coding Interviews この辺は対象外でした ○| ̄|_

ん、でもこれはいいかも(Wozの名前がある) Inventors at Work

■_

Clojureで掛け算テーブル - Code Aquarium

解答編が

> outer(-5:5,-5:5)
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
 [1,]   25   20   15   10    5    0   -5  -10  -15   -20   -25
 [2,]   20   16   12    8    4    0   -4   -8  -12   -16   -20
 [3,]   15   12    9    6    3    0   -3   -6   -9   -12   -15
 [4,]   10    8    6    4    2    0   -2   -4   -6    -8   -10
 [5,]    5    4    3    2    1    0   -1   -2   -3    -4    -5
 [6,]    0    0    0    0    0    0    0    0    0     0     0
 [7,]   -5   -4   -3   -2   -1    0    1    2    3     4     5
 [8,]  -10   -8   -6   -4   -2    0    2    4    6     8    10
 [9,]  -15  -12   -9   -6   -3    0    3    6    9    12    15
[10,]  -20  -16  -12   -8   -4    0    4    8   12    16    20
[11,]  -25  -20  -15  -10   -5    0    5   10   15    20    25

これの、[] で囲まれている数値はインデックスみたいなものです。 ここに文字列を設定することができるのですが、 試しに数字を入れたらどうだろうとやってみると

> dimnames(Z) <- list(c(-5:5), c(-5:5))
> Z
    -5  -4  -3  -2 -1 0  1   2   3   4   5
-5  25  20  15  10  5 0 -5 -10 -15 -20 -25
-4  20  16  12   8  4 0 -4  -8 -12 -16 -20
-3  15  12   9   6  3 0 -3  -6  -9 -12 -15
-2  10   8   6   4  2 0 -2  -4  -6  -8 -10
-1   5   4   3   2  1 0 -1  -2  -3  -4  -5
0    0   0   0   0  0 0  0   0   0   0   0
1   -5  -4  -3  -2 -1 0  1   2   3   4   5
2  -10  -8  -6  -4 -2 0  2   4   6   8  10
3  -15 -12  -9  -6 -3 0  3   6   9  12  15
4  -20 -16 -12  -8 -4 0  4   8  12  16  20
5  -25 -20 -15 -10 -5 0  5  10  15  20  25

なんかうまくいっているっぽい。 で、一行にまとめてみる。

> (function(x) {X <- outer(x,x); dimnames(X) <- list(x,x); return(X)})(5:12)
    5  6  7  8   9  10  11  12
5  25 30 35 40  45  50  55  60
6  30 36 42 48  54  60  66  72
7  35 42 49 56  63  70  77  84
8  40 48 56 64  72  80  88  96
9  45 54 63 72  81  90  99 108
10 50 60 70 80  90 100 110 120
11 55 66 77 88  99 110 121 132
12 60 72 84 96 108 120 132 144
> (function(x) {X <- outer(x,x); dimnames(X) <- list(x,x); return(X)})(-3:4)
    -3 -2 -1 0  1  2  3   4
-3   9  6  3 0 -3 -6 -9 -12
-2   6  4  2 0 -2 -4 -6  -8
-1   3  2  1 0 -1 -2 -3  -4
0    0  0  0 0  0  0  0   0
1   -3 -2 -1 0  1  2  3   4
2   -6 -4 -2 0  2  4  6   8
3   -9 -6 -3 0  3  6  9  12
4  -12 -8 -4 0  4  8 12  16

桁合わせが微妙によろしくないのですが、面倒なのでこの辺で投げます :) 一番左の列を右詰でやるには、符号を考慮しないので良いのなら 少々力業ですがこういうやり方もあるんですが

> (function(x) {X <- outer(x,x); dimnames(X) <- list(formatC(x,width=log10(max(x))+1),x); return(X)})(5:12)
    5  6  7  8   9  10  11  12
 5 25 30 35 40  45  50  55  60
 6 30 36 42 48  54  60  66  72
 7 35 42 49 56  63  70  77  84
 8 40 48 56 64  72  80  88  96
 9 45 54 63 72  81  90  99 108
10 50 60 70 80  90 100 110 120
11 55 66 77 88  99 110 121 132
12 60 72 84 96 108 120 132 144
> (function(x) {X <- outer(x,x); dimnames(X) <- list(formatC(x,width=log10(max(x))+1),x); return(X)})(-3:4)
    -3 -2 -1 0  1  2  3   4
-3   9  6  3 0 -3 -6 -9 -12
-2   6  4  2 0 -2 -4 -6  -8
-1   3  2  1 0 -1 -2 -3  -4
0    0  0  0 0  0  0  0   0
1   -3 -2 -1 0  1  2  3   4
2   -6 -4 -2 0  2  4  6   8
3   -9 -6 -3 0  3  6  9  12
4  -12 -8 -4 0  4  8 12  16
> 

■_

■_

なーんかもう(ry


一つ前へ 2012年10月(下旬)
一つ後へ 2012年11月(中旬)

ホームへ


リンクはご自由にどうぞ

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