ときどきの雑記帖 2012

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

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

ホームへ

2012年10月31日

■_

また電書を買った(ハロウィンで半額セールだったので)。 Building Web, Cloud, and Mobile Solutions with F# - O'Reilly Media Windows PowerShell Cookbook - O'Reilly Media Manning: Real-World Functional Programming Manning: Functional Programming in Scala

■_

【お題】掛け算テーブルを作成せよ - Code Aquarium

【お題】掛け算テーブルを作成せよ - Code Aquarium

お題:次の条件をみたすプログラムを作成してください。

    二つの整数 n, m (n <= m)をパラメータであたえるものとする。
    n 以上 m 以下のすべての整数について、九九表の要領でテーブルを作成する。
    すべての列が綺麗に縦に並ぶように位置合わせを行うこと。

↑を R で。


R version 2.15.0 (2012-03-30)
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

Rは、自由なソフトウェアであり、「完全に無保証」です。 
一定の条件に従えば、自由にこれを再配布することができます。 
配布条件の詳細に関しては、'license()'あるいは'licence()'と入力してください。 

Rは多くの貢献者による共同プロジェクトです。 
詳しくは'contributors()'と入力してください。 
また、RやRのパッケージを出版物で引用する際の形式については 
'citation()'と入力してください。 

'demo()'と入力すればデモをみることができます。 
'help()'とすればオンラインヘルプが出ます。 
'help.start()'でHTMLブラウザによるヘルプがみられます。 
'q()'と入力すればRを終了します。 

 [以前にセーブされたワークスペースを復帰します] 

> outer(2:9,2:9)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]    4    6    8   10   12   14   16   18
[2,]    6    9   12   15   18   21   24   27
[3,]    8   12   16   20   24   28   32   36
[4,]   10   15   20   25   30   35   40   45
[5,]   12   18   24   30   36   42   48   54
[6,]   14   21   28   35   42   49   56   63
[7,]   16   24   32   40   48   56   64   72
[8,]   18   27   36   45   54   63   72   81
> outer(7,7)
     [,1]
[1,]   49
> outer(5:12,5:12)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]   25   30   35   40   45   50   55   60
[2,]   30   36   42   48   54   60   66   72
[3,]   35   42   49   56   63   70   77   84
[4,]   40   48   56   64   72   80   88   96
[5,]   45   54   63   72   81   90   99  108
[6,]   50   60   70   80   90  100  110  120
[7,]   55   66   77   88   99  110  121  132
[8,]   60   72   84   96  108  120  132  144
> 

うーむ惜しい。

> outer(c(1,5:12),c(1,5:12))
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
 [1,]    1    5    6    7    8    9   10   11   12
 [2,]    5   25   30   35   40   45   50   55   60
 [3,]    6   30   36   42   48   54   60   66   72
 [4,]    7   35   42   49   56   63   70   77   84
 [5,]    8   40   48   56   64   72   80   88   96
 [6,]    9   45   54   63   72   81   90   99  108
 [7,]   10   50   60   70   80   90  100  110  120
 [8,]   11   55   66   77   88   99  110  121  132
 [9,]   12   60   72   84   96  108  120  132  144
> outer(c(1,7),c(1,7))
     [,1] [,2]
[1,]    1    7
[2,]    7   49
> outer(c(1,2:9),c(1,2:9))
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
 [1,]    1    2    3    4    5    6    7    8    9
 [2,]    2    4    6    8   10   12   14   16   18
 [3,]    3    6    9   12   15   18   21   24   27
 [4,]    4    8   12   16   20   24   28   32   36
 [5,]    5   10   15   20   25   30   35   40   45
 [6,]    6   12   18   24   30   36   42   48   54
 [7,]    7   14   21   28   35   42   49   56   63
 [8,]    8   16   24   32   40   48   56   64   72
 [9,]    9   18   27   36   45   54   63   72   81

お、なんか道が開けたぽい。 が今日は寝ちゃうw

■_

■_

おっかしーなーなんでもうこんな時間なんだろう…

2012年10月30日

■_

ヴォルフスムント
(現在の最新刊)4巻まで買って一気に読んだ。 つ、続きが気になる! (連載されてる雑誌まで手を出しそうな勢い)
狼の口 ヴォルフスムント 1巻 (BEAM COMIX) 狼の口 ヴォルフスムント 2巻 (ビームコミックス) 狼の口 ヴォルフスムント 3巻 (ビームコミックス) 狼の口 ヴォルフスムント 4巻 (ビームコミックス)

フロミ
これから読む。 FRONT MISSION DOG LIFE & DOG STYLE(10)(完) (ヤングガンガンコミックス)
FRONT MISSION DOG LIFE & DOG STYLE(10)(完) (ヤングガンガンコミックス)

■_

Mika Raento’s blog | Symbian, CS research and angst Symbian - a post mortem - Google Drive

Symbian - a post mortem - Google Drive

Symbian - a post mortem

Mika Raento, mikie at iki.fi, 2012-10-13

(You could actually call this a S60 post-mortem since I mostly write about what Nokia did with symbian but UIQ never amounted to much outside SE’s dreams).

This is an extended good-bye piece for Mika Raento's blog on Symbian. Since this is a post-mortem, it focuses on what went wrong rather than on what went right (first smartphones, extremely good power management, first cameras, some nice hardware). This has also been a long time in writing (since 2010), not very topical today (late 2012) but I think still an interesting historical perspective.

 

■_ 論文を読む

マッカーシー大先生の論文読むよという 7 John McCarthy Papers in 7 weeks – Prologue | Squid's Blog

7 John McCarthy Papers in 7 weeks – Prologue | Squid's Blog

7 John McCarthy Papers in 7 weeks – Prologue
by admin on September 18th, 2012

In the spirit of Seven Languages in Seven Weeks, I have decided to embark on a quest. But instead
of focusing on expanding my mindset with different programming languages, I am focusing on trying
to get into the mindset of John McCarthy, father of LISP and AI, by reading and thinking about
seven of his papers.

Why?

Get out of your box

If you are comfortable, you are not challenging yourself to grow. You are doomed to stay in your
same mindset and your little box and your world gets smaller. As an Object Oriented programmer,
I was happy in my little box. Then one day, I discovered Clojure and Functional Programming and
my world became bigger and richer because of it. I hope to glean a similar box expansion, by
exploring the thoughts of McCarthy. Especially, since I have the nagging suspicion that we are
somehow doing programming “completely wrong.”

Slow Down

Reading papers is an antidote to today's relentless stream of Twitter and Hacker News techno
stuff. It forces you to slow down and read something …gasp, maybe even the same thing multiple
times and digest it. Thinking slow and eating more veggies is something we could all do more.

以下略

Slow Down のところのくだりが良いですね(えらそう)

■_ Rakudo Star 2012.10 released

Rakudo の定期リリース。 Rakudo Star 2012.10 released | rakudo.org

Rakudo Star 2012.10 released | rakudo.org

Rakudo Star 2012.10 released
Posted on 2012.10.29 by jnthn	

On behalf of the Rakudo and Perl 6 development teams, I’m happy to announce the October 2012
release of “Rakudo Star”, a useful and usable distribution of Perl 6.  The tarball for the
October 2012 release is available from <http://github.com/rakudo/star/downloads>.
A Windows .MSI version of Rakudo star will usually appear in the downloads area shortly after
the tarball release.

In the Perl 6 world, we make a distinction between the language (“Perl 6″) and specific
implementations of the language such as “Rakudo Perl”.  This Star release includes release
2012.10 of the Rakudo Perl 6 compiler, version 4.6.0 of the Parrot Virtual Machine, and various
modules, documentation, and other resources collected from the Perl 6 community.

Some of the new features added to this release include:

* The method case of the handles trait

* The <-> lambda, which defaults parameters to rw

* The :dba modifier in regexes

* The radix form :60[24, 59, 59]

* Improved coverage of Perl 5 regexes when the P5 modifier is used

* Correct parsing of nested quote delimiters

* Attributes in scope are now visible inside of an eval

以下略

regexes modifier の :dba ってなんだろ。

■_

■_

あれー、書こうと思ってた記事の元ネタが行方不明

2012年10月29日

■_

また会員登録しないと見たり聴いたりできないもので申し訳ないんですが The Ideal Programmer - Why They Don't Exist and How to Manage Without Them? 面白かったっす。

■_

これができた最初のプログラミング言語ってなんざんしょ。

■_ なごや

F# 3.0の開発環境を用意しよう! - (hatena (diary ’Nobuhisa))

F# 3.0の開発環境を用意しよう! - (hatena (diary ’Nobuhisa))

語学留学

Q. 「F#短期留学するとしたら、どこに行けば良いですか?」

A. 「札幌か名古屋かイギリスです。」※ただし、なごやはこわい

■_ 東と西の境界線

GA 芸術科アートデザインクラス 素猫57匹目

632 名無しさん@お腹いっぱい。 [sage] 2012/10/29(月) 01:34:01.72 ID:ulkkhqwsO Be:
    俺の見るスレで昔、福井が東日本か西日本かで一スレくらい謎の戦いしてたことがあったな
    実際は西日本になるんだよな? 

633 名無しさん@お腹いっぱい。 [sage] 2012/10/29(月) 01:48:14.74 ID:kbRMv+2V0 Be:
    それはどこで東西を分けるかによるな
    糸魚川静岡構造線で日本を東西に分けるのなら福井は確かに西日本だが
    じゃあ、静岡県の浜松あたりを西日本というのかというと、違和感がある 

634 名無しさん@お腹いっぱい。 [sage] 2012/10/29(月) 04:09:22.71 ID:UoakItrs0 Be:
    とりあえず言葉は完全に西、電気も60Hzだし鉄道も西日本。

    …高速は若狭が西日本で越前が中日本か…ていうか「中」か… 

■_

■_

やる気ゲージが

2012年10月28日

■_

・メールマガジン
押井守の「世界の半分を怒らせる」。:押井守の「世界の半分を怒らせる」。 - ニコニコチャンネル:社会・言論 これに興味があって有料でも良いと思ってるんですが、 有料会員になった上で、これに登録って場合に必要なのは 525円? それとも 525+525円(月額会員会費とこの連載分が別勘定)? 後者だとちょっと考えるなあ。

・速さは力
朝日新聞デジタル:カシオ、0.99秒で撮影OKのデジタルカメラ - デジタル カシオ計算機は電源を入れてから0・99秒後に撮影準備ができるデジタルカメラの新製品「エクシリムEX―ZR1000」を11月9日から順次発売すると23日発表した。 起動が速いのはとてもありがたいなあと思いつつ値段を見ると 想定価格は5万円前後。 ちと考える値段ではあるな。 EX-ZR1000 - デジタルカメラ - CASIO

・記号がいっぱい
Scala のパーザコンビネーターを駆使したプログラムを見ていると、 Perl あたりのスクリプトに 「記号だらけでよくわからない」と言っている人の気持ちが ちょっとだけわかったような気がした。

■_ Sorting 1 million 8-digit numbers in 1MB of RAM

先週結構盛り上がっていた話題。 きちんと追いかける余裕がなかったのでこれから読む

algorithm - Sorting 1 million 8-digit numbers in 1MB of RAM - Stack Overflow

I have a computer with 1M of RAM and no other local storage. I must use it to accept 1 million
8-digit decimal numbers over a TCP connection, sort them, and then send the sorted list out over
another TCP connection. The list of numbers may contain duplicates, which I must not discard.
The code will be placed in ROM, so I need not subtract the size of my code from the 1M. I already
have code to drive the ethernet port and handle TCP/IP connections, and it requires 2k for its
state data, including a 1k buffer via which the code will read and write data. Is there a solution
to this problem?

Sources Of Question And Answer:
http://tech.slashdot.org/comments.pl?sid=232757&cid=18925745
http://nick.cleaton.net/ramsort.html

reddit、Hacker News でそれぞれ。 Sort 1 million 8-digit decimal numbers in 1MB of RAM : programming Sorting 1 million 8-digit decimal numbers in 1MB of RAM | Hacker News

■_

↑のお題に対しての回答をしているblog エントリ。

Here’s Some Working Code to Sort One Million 8-Digit Numbers in 1MB of RAM

Earlier this week, this Stack Overflow question was featured on Reddit under /r/programming.
Apparently, it was once a Google interview question — or at least, a variation of one:

    You have a computer with 1M of RAM and no other local storage. You must use it to accept
    1 million 8-digit decimal numbers over a TCP connection, sort them, and then send the sorted
    list out over another TCP connection. The list of numbers may contain duplicates, which you
    may not discard. Your code will be placed in ROM, so you need not subtract the size of your
    code from the 1M. You have been given code to drive the Ethernet port and handle TCP/IP
    connections, and it requires 2k for its state data, including a 1k buffer via which your
    code will read and write data.

The challenge here, of course, is that you can't fit all the data in memory as raw integers.
There are 100 million possible 8-digit decimal numbers, so even if you pack each number into
27 bits (227 = ~134 million), that would take 3375000 bytes of storage. The hypothetical machine
available to you has only 1048576 bytes of storage. At first glance, it seems to defy reason.

The question received enough attention that a lot of people proposed solutions on Stack Overflow
and in the Reddit discussion, but so far, nothing that runs. There's some code for a solution
which doesn’t work, many proposals without code, and some hilarious out-of-the-box answers. A
lot of answers come close, but won’t work on every possible input.

In thinking about this problem, it occurred to me that I've already written a blog post with
some vital information required for the ideal solution. I won't give away which post, but after
that, I couldn't resist cobbling together a working implementation in C++.

The source code listing is just 338 lines with very few comments. I thought I'd post it here to
see if anybody can figure out which algorithm was used:

ソースコードはこちら Sort one million 8-digit numbers in 1MB RAM — Gist で、それに対してまた盛り上がると。 Here’s Some Working Code to Sort One Million 8-Digit Numbers in 1MB of RAM : programming 1MB Sorting Explained

■_

Racketの作者のプレゼン。 The Racket Way

The Racket Way

Summary
Matthew Flatt explains the Racket – a Lisp dialect – way through examples: everything is a program,
concepts are language constructs, the language is extensible, and everything composes. 

この発表のあったイベントのほかの発表も面白そう News - Strange Loop (ちょっと前に紹介した JavaScriptに賭けろもそう)。 んで、次に控えているのが

29-Oct-2012 	Y Not? - Adventures in Functional Programming 	Jim Weirich
29-Oct-2012 	Relational Programming in miniKanren 	Daniel Friedman, William Byrd
29-Oct-2012 	Expressing abstraction - Abstracting expression 	Ola Bini
29-Oct-2012 	Understanding Indexing 	Zardosht Kasheff

おお、これはまた

■_ ロジスティック曲線とか

「信頼度成長曲線」と一緒に良く登場するあれです。 ロジスティック曲線はまあどういったものかというのはわかってきたのだけど、 ゴンペルツ曲線の方がいまひとつ。 ここで「シグモイド曲線」(もしくはシグモイド関数) というのが出てきまして。 ロジスティック回帰 - 人工知能に関する断創録 シグモイド関数 - 大人になってからの再学習 統計学入門-第10章

シグモイド関数とロジスティック関数 | jjkingの日記 | スラッシュドット・ジャパン

シグモイド関数

  f(x)=(1 + tanh(x/x0))/2

を変形していくと、ロジスティック関数

  f(x)=1/(1+exp(x))

にたどり着くというのに気づく
同じものだったんだ

ふむふむ(よくわかってない)。 そして

qune: プログラミングメモ - tanh 関数とかシグモイド関数とか 手を焼いている『パターン認識と機械学習』(以下,PRML)も,やっとのことで上巻の最後までやってまいりました。 また PRML がっ

■_ 振り返り

一年前のブックマークを見返すというのは面白いけど、 「棚卸し」の使い方がちょっと気になる (最近増えてきている使い方とは思うけど)。 天井冴太的つれづれblog [天井の染み]: 2011年10月27日分のブックマーク棚卸し ブックマーク棚卸しとは、天井冴太が1年前にブックマークしたwebページを見返し、再び紹介したいページをリストアップする企画である。

棚卸とは ~ exBuzzwords用語解説 棚卸し・店卸し - 語源由来辞典

■_

2012年10月27日

■_


神保町に行ったのですが、開催されていた古本市とは関係なく明倫館でこの本を入手。 マーケットプレースでも結構な値段がついているし (Amazon.co.jp: プログラミング言語の基礎理論 (情報数学講座): 大堀 淳: 本)、 復刊リクエストもでています。 『プログラミング言語の基礎理論(大堀淳)』 復刊リクエスト投票 いやーこのタイミングで手に入るとは思わなかった。 ちなみに3000円でした。

■_ 半額セール

この手のセールでないと買ってないような気がしないでもない。>洋電書


Halloween is just around the corner, and we're offering special discounts every day through
next Wednesday. This is a terrific way to learn some new tricks. There's no pillowcase required,
you don't have to go door-to-door, and great books won't make you fat!  

How it works

Just enter trickortreat50 in the Promotional Code box when you check out.

Friday October 26 & Saturday October 27--Half off all MEAPs

Sunday October 28 & Monday October 29--Half off all pBooks

Tuesday October 30 & Wednesday October 31--Half off all eBooks

Wednesday October 31--Half off any purchase

The 50% discount will be applied automatically to the eligible books in your cart.
Only at manning.com.

というわけで、Amazon.com で kindle 版の値段が上がったという話もよくわからんのでした。 O'Reilly のも O'Reilly のサイトで買ってるしなあ。 あ、こっちもなにかのセールスのときに (一つ二つは値引きなしで買ったのもあるかも)。

■_

Pike せんせーによる Go のはなし Go at Google

その一部を。

Go is:

  • open source
  • concurrent
  • garbage-collected
  • efficient
  • scalable
  • simple
  • fun
  • boring (to some)

The reason for Go

Goals:

  • eliminate slowness
  • eliminate clumsiness
  • improve effectiveness
  • maintain (even improve) scale

Go was designed by and for people who write—and read and debug and maintain—large software systems.

Go's purpose is not research into programming language design.

Go's purpose is to make its designers' programming lives better.

Today's theme

A talk about software engineering more than language design.

To be more accurate:

  • Language design in the service of software engineering.

In short:

  • How does a language help software engineering?

条件コンパイルの話とか面白かったっす。

■_

まだこの種の話はつづくのだろうか (面白いんでいいけど) On Being A Senior Engineer Vivek Haldar : Why you would want to program at fifty (or any other age)

■_

■_

懇親会について

2012年10月26日

■_

狼の口 ヴォルフスムント(4) 「激しい戦いでバラバラと死んでいく上に、死に方も悲惨」 - アキバBlog この記事で知ってちょっと気になってたこの作品。 最新刊しか置いていないところばかりでなかなか見つからなかった (とはいえ大型書店に行くとかはしなかった)のだけど、ようやく一巻を買った。 2~4もあったけどとりあえず様子見で一巻だけw 狼の口 ヴォルフスムント 1巻 (BEAM COMIX)
狼の口 ヴォルフスムント 1巻 (BEAM COMIX)

感想は…どう書いたものか。 面白いと言ってしまうのは内容からしてどうかと思うし、 とはいえ続きは読みたい(つまらないということはない) 狼の口 〜ヴォルフスムント〜 - Wikipedia 「狼の口 ヴォルフスムント」― 久慈光久-☆2

続きも週明けにでも買おう(会社近くの本屋に全巻揃いであったので)
狼の口 ヴォルフスムント 2巻 (ビームコミックス) 狼の口 ヴォルフスムント 3巻 (ビームコミックス) 狼の口 ヴォルフスムント 4巻 (ビームコミックス)

で、これもちょっと気になってる作品。 二巻を書店で見かけてどうしようかと思ったんだけど一巻がなかったのでスルーしてしまった。
ホークウッド (MFコミックス フラッパーシリーズ) ホークウッド 2 (MFコミックス フラッパーシリーズ)

■_ ユニットテスト

後で読む(TMTの待機タブに放り込んだ) Are Unit Tests Overused?

Are Unit Tests Overused?

Unit Testing has come to dominate the many types of test that are used in developing applications.
This has inevitably been at the expense of other types, such as integration test. Does a
successful unit test regime ensure quality, or should we see unit testing as just one of a range
of tests that can together give us confidence in an application?.

■_

2012年10月25日

■_

書くネタなっしんぐ (本当はあるけど)

■_ The Ideal Programmer

The Ideal Programmer - Why They Don't Exist and How to Manage Without Them? スライドをちょっと見たけど面白そう

The Ideal Programmer - Why They Don't Exist and How to Manage Without Them?

Summary
Mike Williams outlines some of the main characteristics that make developers and teams perform
better than the average.

Bio
Mike Williams moved to Sweden in 1970 and joined Ericsson as a hardware designer. He and Bjarne
Däcker founded the Ericsson Computer Science Laboratory 1980 where Erlang was invented. Mike's
role was to develop the first Erlang virtual machine (Joe developed the compiler and machine
architecture). In 1990 Mike glided into management by a complete accident, and found he rather
liked it.

■_

もうひとつInfoQ Seventeen Secrets of the Great Legacy Makeover Masters

Seventeen Secrets of the Great Legacy Makeover Masters

Summary

Brian Foote shares 17 tips that help dealing with muddy legacy code: Testing, Divide & Conquer,
Neoteny, Gentrification, Demolition, Quarantine, Refactoring, Craft, etc. 

■_ The sorry state

VC++ の C++11のサポート具合が(ry というはなしで The Sorry State of (MSVC) C++ Portability : programming

本文はさておき、コメント欄のやり取り。

The Sorry State of C++ Portability

The most ridiculous aspect of this has to be precisely that Microsoft, at least on the surface,
seems to be a lot more pro-C++11 than any of the other major companies. Sure, Apple drives
clang development but they would prefer it if you'd develop on Objective-C. Microsoft are the
ones who've hired some of the biggest names in the C++ world, who've put out video after video
about the great new features in C++11, and who've hosted multiple events about the future of C++.
The fact that they can’t get their own compiler to work properly is just plain embarrassing.

I left windows development behind several years ago, and I’m never going to back.
    Jeff
    Posted October 24, 2012 at 12:54 pm

    So true. Apple doesn't try to promote C++, yet succeeds; Microsoft tries hard to promote C++
    and fails. Zeitgeist.

最後の Zeitgeist がぐぐってもよくわからんかった。

■_

2012年10月24日

■_

jq のソースをちょっと読んでみた。 jq なんか書くかはわからない。

来ましたね。 朝起きてiPad miniほかのニュースを知り、午後には kindle のニュースが。 iPad mini、Nexus 7、Kindle Fire HD――7インチクラスタブレットのスペック比較 - 電子書籍情報が満載! eBook USER ニュース - 「Amazon.comで購入した書籍も引き継げる」米アマゾンKindle担当者Q&A:ITpro とりあえず paperwhite はぽちった。 Fire/Fire HD はちと様子見。

会社で避難訓練があったのですがそのときふと思ったこと。 使うときに上下逆さまにするやつって最近見ないような気がするんですがそうでもない?

半蔵門線(田園都市線)渋谷駅。 道玄坂方面からから宮益坂方面に抜けるとき(逆の場合も)に、 フロアを間違えると出たい出口に行けなかったりして (改札通った向こう側になったり)はまることが。

■_

■_ Software-Reliability Modeling

検索したりなんだりで 「Software-Reliability Modeling: The Case for Deterministic Behavior Scott Dick, Member, IEEE, Cindy L. Bethel, and Abraham Kandel, Fellow, IEEE」 という論文を発見。その Abstract から

Software-reliability models (SRMs) are used for the assessment and improvement of reliability in software systems. These models are normally based on stochastic processes, with the nonhomogeneous Poisson process being one of the most prominent model forms. An underlying assumption of these models is that software failures occur randomly in time. This assumption has never been quantitatively tested. Our contribution in this paper is to conduct an experimental investigation that contrasts random processes with nonlinear deterministic processes as a model for software failures. We study two sets of real-world softwarereliability data using the techniques of chaotic time-series analysis. We have found that both appear to arise from a deterministic process, rather than a stochastic process, and that both show some evidence of chaotic dynamics. In addition, we have conducted a series of k-steps-ahead forecasting experiments in the datasets, pitting a number of well-known stochastic SRMs against radial basis function networks (RBFNs), which are deterministic in nature. The out-of-sample prediction results from the RBFNs showed an improvement of roughly 25% over the best of the stochastic models, for both of our datasets. Finally, we propose a causal model to explain these results, which hypothesizes that faults in a program are distributed over a fractal subset of the program's input space.

本文はまだ(ほとんど)読んでないw

■_ PRML

↑のような調べものをしているとですね、結構な確率で機械学習とかなんとかが目に入ってくるんですよ。 はい。どこで何が関係しているかわからんなあ。面白いなあと思っている次第。

パターン認識と機械学習 上
パターン認識と機械学習 上 パターン認識と機械学習 下 (ベイズ理論による統計的予測)
パターン認識と機械学習 下 (ベイズ理論による統計的予測) パターン認識と機械学習の学習―ベイズ理論に挫折しないための数学
パターン認識と機械学習の学習―ベイズ理論に挫折しないための数学

2012年10月23日

■_

やーるーきーぜーろー(給料日前のところに定期の期限がががが)

■_ 今日の重箱の隅

【キーマン列伝】IBMをITの巨人に成長させた男 ~トーマス・ワトソン・ジュニア氏 | エンタープライズ | マイナビニュース

1911年の創立時、IBMはThe Computing-Tabulating-Recording-Companyという社名だった。IBMとなった
のは1924年、社長に就任したトーマス・ワトソン氏(2011/07/01号参照)の決断だった。しかしながら
同社は、その社名に変更されてからも基本的には事務機器の企業であり、コンピュータとはしばらく縁
遠かった。そんな“事務機大手のIBM”を“IT大手のIBM”へと変革させた人物こそ、今回紹介するキー
マン、トーマス・ワトソン・ジュニア氏(以下敬称略)。彼は、IBMの名付け親であり初代社長である
トーマス・ワトソン(以降「シニア」と表記する)の息子である。え、IBMって世襲企業だったの?、
と思うかもしれないが、どうもこの初代と二代目が社長を歴任しただけらしい。

「歴任」って一人の人が複数の役職を(同時にではなく)務めたということのような。 歴任 とは - コトバンク

■_ The D Programming Language Conference

開催しようとしているらしい。 The D Programming Language Conference 2013 by Walter Bright — Kickstarter

The D Programming Language Conference 2013 by Walter Bright — Kickstarter

The plan is to hold DConf 2013 during spring (April or May) at a location in Silicon Valley,
such as Palo Alto, CA. The conference will last two or (preferably) three days and will
feature a strong program from luminaries in the D community and a couple of invited speakers.
The list initially includes of course Walter Bright and Andrei Alexandrescu.

■_

2012年10月22日

■_

めも。 TAPL でちと悩んだところに関係するので http://www.cs.ox.ac.uk/people/ralf.hinze/talks/Open.pdf Closed recursion: tie the recursive knot in the introduction form. Open recursion: tie the recursive knot in the elimination form.

The State of JavaScript のスライドを見てたのですが、 最後の一枚にあったのが

Always bet on JS

・First they said JS couldn't be useful for building "rich internet apps"
・Then they said it couldn't be fast
・Then they said it couldn't be fixed
・Then it couldn't do multicore/GPU
・Wrong every time!
・My advice: always bet on JS

■_ JSONをごにょごにょ

Jq - a lightweight and flexible command-line JSON processor | Hacker News jq - lightweight and flexible command-line JSON processor (like sed for JSON data) : programming

jq

jq is like sed for JSON data - you can use it to slice and filter and map and transform structured
data with the same ease that sed, awk, grep and friends let you play with text.

jq is written in portable C, and it has zero runtime dependencies. You can download a single
binary, scp it to a far away machine, and expect it to work.

jq can mangle the data format that you have into the one that you want with very little effort, and
the program to do so is often shorter and simpler than you'd expect.

こういうのも micha/jsawk

■_ Motivations of choosing C

後で読む

Motivations of choosing C : Git case study « CppDepend

Linux, Php, and Git are a popular projects developed with C, in the other side OpenOffice,
firefox, Clang, Photoshop are developed with C++, so it's proven that each one is a good
candidate to develop complex applications. Try to prove that a language is better than the other
is not the good debat. However we can discuss motivations behind choosing one of them.

There are two major arguments quoted each time when we discuss choosing C:

- Best performance.
- Compiler support.

But there's a controversy concerning these arguments, and it's not the goal of this article to
discuss them, there are many web resources talking about them, however the idea is to focus more
on the impact of the language chose on the application design.

以下略

■_

2012年10月21日

■_

昨日の夜中(というか今日の未明)にちとアクシデントがあったあおりでいろいろと予定が狂う。

見覚えのある名前が。 [アイランドリーグ] 徳島・島田直也監督「10勝の山口はオフの過ごし方が大切」 | スポーツ | 現代スポーツ | 現代ビジネス [講談社]

■_

Be nice to programmers : programming

■_ Writing Idiomatic Python

Hackers Gonna Hack

Writing Idiomatic Python

2012-10-04 02:00

As someone who evangelizes Python at work, I read a lot of code written by professional
programmers new to Python. I've written a good amount of Python code in my time, but I've
certainly read far more. The single quickest way to increase maintainability and decrease
'simple' bugs is to strive to write idiomatic Python. Whereas some dynamic languages embrace
the idea there being no 'right' way to solve a problem, the Python community generally
appreciates the liberal use of 'Pythonic' solutions to problems. 'Pythonic' refers to the
principles laid out in 'The Zen of Python' (try typing 'import this' in an interpreter...). One
of those principles is

仕事で Python を evangelize している人のように、わたしは Python に入門したての
professinal プログラマーによって書かれたコードをたくさん読みました。
わたしは自分の時間にたくさんの Python コードを書きましたが、読むのはそれに遠く及びませんでした。
maintainability を高め、「単純な」バグを減らす single quickest way とは
idiomatic に Python コードを書くように心がけることです。
Whereas some dynamic languages embrace the idea there being no 'right' way to solve a problem,
一部の動的言語がある問題を解決する「正しい」方法などないという考えを embrace しているのと
同じように、Python コミュニティは問題を解決するための 'Pythonic' な solution の liberal use を
高く評価しています。
'Pythonic' は 'The Zen of Python' にある principles を表しています
(try typing 'import this' in an interpreter...).
そういった principle のひとつにこれがあります

  'There should be one-- and preferably only one --obvious way to do it'
                                                  -from 'The Zen of Python' by Tim Peters

In that vein, I've begun compiling a list of Python idioms that programmers coming from other
languages may find helpful. I know there are a ton of things not on here; it's merely a skeleton
list that I'll add to over time. If you have a specific idiom you think should be added, let me
know in the comments and I'll add it with attribution to the name you use in your comment.

This list will temporarily live here as a blog post, but I have an interesting idea for its final
home. More on that next week.

Update: 'Writing Idiomatic Python' e-Book Coming

See here for details!

Update 10/05/12: Add context managers, PEP8, itertools, string join(), dict.get() default values

Idioms

Formatting

Python has a language-defined standard set of formatting rules known as PEP8. If you're browsing
commit messages on Python projects, you'll likely find them littered with references to PEP8
cleanup. The reason is simple: if we all agree on a common set of naming and formatting conventions,
Python code as a whole becomes instantly more accessible to both novice and experienced developers.
PEP8 is perhaps the most explicit example of idioms within the Python community. Read the PEP,
install a PEP8 style-checking plugin for your editor (they all have one), and start writing your
code in a way that other Python developers will appreciate. Listed below are a few examples.

Python には PEP8 として知られている標準 (language-defined standard) の formatting rules があります。
Python プロジェクトのコミットメッセージを眺めれば、PEP8 を参照するようにというものがよくあるのに
気がつくでしょう。その理由は簡単です。わたしたち全員がある一つの共通した命名や書式についての
規約に同意していれば、Python code 全体が初心者と熟練開発者両方にとってより accessible なものに
なるからです。PEP8 は Python コミュニティにおけるそういったイディオムのもっともはっきりとした
例でしょう。PEP を読み、あなたの使っているエディター向けの PEP8 スタイルチェックプラグインを
インストールして、他のPython developer が受け入れるであろうやり方でコードを書き始めましょう。

Identifier Type         Format                          Example
Class                   Camel case                      class StringManipulator:
Variable                Words joined by underscore 	words_joined_by_underscore = True
Function                Words joined by underscore 	def are_words_joined_by_underscore(words):
'Internal' class        Prefixed by single underscore 	def _update_statistics(self):
members/functions

Unless wildly unreasonable, abbreviations should not be used (acronyms are fine if in common use, like 'HTTP')


Working With Data

Avoid using a temporary variable when swapping two variables
二つの変数で内容の入れ替えをするのに一時変数を使うのを避けよう

There is no reason to swap using a temporary variable in Python. We can use tuples to make our
intention more clear.

Python では一時変数を使った交換を行う理由はありません。
意図をより明確にするためにタプルが使えます。

Harmful

  temp = foo
  foo = bar
  bar = temp

Idiomatic

  (foo, bar) = (bar, foo)

Use tuples to unpack data
データの unpack に タプルを使おう

In Python, it is possible to 'unpack' data for multiple assignment. Those familiar with LISP may
know this as 'desctructuring bind'.

Python では多重代入のためのデータの 'unpack' が可能です。
LISP の 'desctructuring bind' として知られているものです。

Harmful

  list_from_comma_seperated_value_file = ['dog', 'Fido', 10] 
  animal = list_from_comma_seperated_value_file[0]
  name = list_from_comma_seperated_value_file[1]
  age = list_from_comma_seperated_value_file[2]

Idiomatic

  list_from_comma_seperated_value_file = ['dog', 'Fido', 10] 
  (animal, name, age) = list_from_comma_seperated_value_file


Use ''.join when creating a single string for list elements
リスト要素をまとめた文字列を作るのには ''.join を使いましょう

It's faster, uses less memory, and you'll see it everywhere anyway. Note that the two quotes
represent the delimiter between list elements in the string we're creating.''just means we
mean to concatenate the elements with no characters between them.

そのようにすることで、処理が高速になり、メモリの使用量を抑えます。
二つのクォートが文字列化されたリスト要素の間にある区切りを表すことに注意してください。
'' はリスト要素を区切りのキャラクターなしに連結することを意味します。

Harmful

  result_list = ['True', 'False', 'File not found']
  result_string = ''
  for result in result_list:
      result_string += result

Idiomatic

  result_list = ['True', 'False', 'File not found']
  result_string = ''.join(result_list)


Use the 'default' parameter of dict.get() to provide default values
デフォルト値を提供するのに dict.get() の 'default' パラメータを使いましょう

Often overlooked in the get() definition is the default parameter. Without using default (or
the collections.defaultdict class), your code will be littered with confusing if statements.
Remember, strive for clarity.

get() の定義において、デフォルトパラメーターはしばしば考慮されずにいます。
デフォルト値 (もしくは collections.defaultdict class)を使わないと、
コードは confusing if statements があふれることになるでしょう。
明快さを追い求めることを忘れないでください。

Harmful

log_severity = None
if 'severity' in configuration:
    log_severity = configuration['severity']
else:
    log_severity = log.Info

Idiomatic

  log_severity = configuration.get('severity', log.Info)


Use Context Managers to ensure resources are properly managed
リソースが適切に管理されていることを保証するために context manager を使いましょう

Similar to the RAII principle in languages like C++ and D, context managers (objects meant to be
used with the with statement) can make resource management both safer and more explicit. The
canonical example is file IO.

C++ や D のような言語で使われている RAII principle と同じく、
(with 文とともに使われたオブジェクトを管理する)
context manager はリソース管理をより安全で explict なものにできます。
その canonical example はファイル IO です。

Harmful

  file_handle = open(path_to_file, 'r')
  for line in file_handle.readlines():
      if some_function_that_throws_exceptions(line):
          # do something
  file_handle.close()

Idiomatic

  with open(path_to_file, 'r') as file_handle:
      for line in file_handle:
          if some_function_that_throws_exceptions(line):
              # do something
  # No need to explicitly call 'close'. Handled by the File context manager

In the Harmful code above, what happens if some_function_that_throws_exceptions does, in fact,
throw an exception? Since we haven't caught it in the code listed, it will propagate up the stack.
We've hit an exit point in our code that might have been overlooked, and we now have no way to
close the opened file. In addition to those in the standard libraries (for working with things
like file IO, synchronization, managing mutable state) developers are free to create their own.

上記の Harmful コードでは、some_function_that_throws_exceptions does が例外を送出した場合には
何が起きるでしょうか? 上記のコードでは例外を捕捉していませんから、その例外は
スタックを遡って伝播していきます。
その結果、見落としがあり得るコードでは exit point に到達してしまうかもしれません。
しかしそうなるとオープンしたファイルをクローズする手段がありません。
In addition to those in the standard libraries (for working with things like file IO,
synchronization, managing mutable state) developers are free to create their own.

Learn the contents of the itertools module
itertools モジュールの内容を学ぼう

If you frequent sites like StackOverflow, you may notice that the answer to questions of the
form "Why doesn't Python have the following obviously useful library function?" almost
always references the itertools module. The functional programming stalwarts that itertools
provides should be seen as fundamental building blocks. What's more, the documentation for
itertools has a 'Recipes' section that provides idiomatic implementations of common functional
programming constructs, all created using the itertools module. For some reason, a vanishingly
small number of Python developers seem to be aware of the 'Recipes' section and, indeed, the
itertools module in general (hidden gems in the Python documentation is actually a recurring
theme). Part of writing idiomatic code is knowing when you're reinventing the wheel.

StackOverflow のようなサイトをみると、いつもといって良いほど itertools モジュールを参照している
"Why doesn't Python have the following obviously useful library function?"
のような回答を度々目にすることでしょう。
itertools が提供する functional programming stalwarts は fundamental building blocks としてあるべきなのです。


Control Structures
制御構造

If Statement
if 文

Avoid placing conditional branch on the same line as the colon

Using indentation to indicate scope (like you already do everywhere else in Python) makes it
easy to determine what will be executed as part of a conditional statement.

Harmful

  if name: print (name)
  print address

Idiomatic

  if name:
      print (name)
  print address

Avoid having multiple statements on a single line
一行に複数の文を詰め込むのは止めよう

Though the language definition allows one to use a semi-colon to delineate statements, doing
so without reason makes one's code harder to read. Typically violated with the previous rule.

Harmful

  if this_is_bad_code: rewrite_code(); make_it_more_readable();

Idiomatic

  if this_is_bad_code: 
      rewrite_code()
      make_it_more_readable()

Avoid repeating variable name in compound if Statement
複合 if 文 で同じ変数名を繰り返すのは止めよう

When one wants to check against a number of values, repeatedly listing the variable whose value
is being checked is unnecessarily verbose. Using a temporary collection makes the intention clear.

Harmful

  if name == 'Tom' or name == 'Dick' or name == 'Harry':
      is_generic_name = True

Idiomatic

  if name in ('Tom', 'Dick', 'Harry'):
      is_generic_name = True

Use list comprehensions to create lists that are subsets of existing data
既存データのサブセットであるリストを作るのには list comprehensions を使おう

List comprehensions, when used judiciously, increase clarity in code that builds a list from
existing data. Especially when data is both checked for some condition and transformed in some
way, list comprehensions make it clear what's happening. There are also (usually) performance
benefits to using list comprehensions (or alternately, set comprehensions) due to optimizations
in the cPython interpreter.

Harmful

  some_other_list = range(1, 100)
  my_weird_list_of_numbers = list()
  for element in some_other_list:
      if is_prime(element):
          my_weird_list_of_numbers.append(element+5)

Idiomatic

  some_other_list = range(1, 100)
  my_weird_list_of_numbers = [element + 5 for element in some_other_list if is_prime(element)]

Loops

Use the in keyword to iterate over an Iterable
Iterable を iterate over するのに in キーワードを使おう

Programmers coming languages lacking a for_each style construct are used to iterating over a
container by accessing elements via index. Python's in keyword handles this gracefully.

for_each 形式の構造がない言語から来たプログラマーはコンテナーを iterating over するのに
添え字を通じての要素アクセスを使ってしまいます。Python の in キーワードは
そういったものを gracefully に取り扱います。

Harmful

  my_list = ['Larry', 'Moe', 'Curly']
  index = 0
  while index < len(my_list):
      print (my_list[index])
      index+=1

Idiomatic

  my_list = ['Larry', 'Moe', 'Curly']
  for element in my_list:
      print element

Use the enumerate function in loops instead of creating an 'index' variable
ループでは「添え字」変数を作るのではなく enumerate 関数を使いましょう

Programmers coming from other languages are used to explicitly declaring a variable to track
the index of a container in a loop. For example, in C++:

他の言語からのプログラマーはループ中でコンテナーの index を追いかけるのに
explicitly に変数を宣言してしまいます。たとえば C++ であればこうなります:

  for (int i=0; i < container.size(); ++i)
  {
      // Do stuff
  }

In Python, the enumerate built-in function handles this role.
Python では組み込み関数の enumerate がこの役目を果たします。

Harmful

  index = 0
  for element in my_container:
      print (index, element)
      index+=1

Idiomatic

  for index, element in enumerate(my_container):
      print (index, element)

Posted by Jeff Knupp 2012-10-04 02:00 python, software,

Copyright © 2012 - Jeff Knupp- Powered by Blug

■_ ○○違い

【正規空母】戦後の空母を語るスレ14番艦【軽空母】

206 名無し三等兵 [sage] 2012/10/15(月) 10:02:06.09 ID:??? Be:
    イギリスってどっから金でてくんだと思って調べたら、税収が約5900億ポンド=70兆円あった
    日本と違って政府歳入にカウントされる国民健康保険料引いても50兆以上ある
    日本の税収は40兆円だぞ
    GDPは倍以上あるのに


    これで80兆円ぐらいの予算を組んでいる
    歳出に占める国債費は極わずかだ(日本は1/3)
    これでも財政再建のための緊縮予算
    緊縮だから今年度の国防予算は日本と同じくらい


    まぁ、あれだ
    こういうの見た人が「日本は借金しすぎ、税金上げろ」となるんだろうな
    でもそれやると景気落ち込んで税収減っちゃうのが日本orz 

207 名無し三等兵 [sage] 2012/10/15(月) 10:28:13.26 ID:??? Be:
    日本の予算は無駄が多いってことでしょうな
    民主のいう埋蔵金は実はあったと思うよ

    その証拠に、消費税造っても上げても金足りない
    好景気の時でも国の借金は増え続ける
    この国の財政制作はおかしいよ

208 名無し三等兵 [sage] 2012/10/15(月) 10:44:41.05 ID:??? Be:
    税制に抜け穴が多すぎるんだよ。
    法人税払ってる企業は1/3ぐらいらしいぞ。 

209 名無し三等兵 [sage] 2012/10/15(月) 12:11:32.35 ID:??? Be:
    なら、穴だらけの税制をなぜ改正しないのか
    消費税のように取り易きところ、弱いところから取る
    これでは日本の国力が落ちていくのも当たり前
    自民党が選挙で負けたの当然

    これでは空母保有など、夢また夢だ 

210 名無し三等兵 [sage] 2012/10/15(月) 14:28:10.42 ID:??? Be:
    >>207
    もっというと政治制度がおかしいんだがな。
    立法機関は、議員立法は少なくて行政府の官僚が作った法案の
    承認機関でしかない。
    国会議員は、国のカネを地元の選挙区に引っ張ってくる見返りに
    票を得る、実質的にはただの「税金ブローカー」でしかない。
    司法機関も役人が牛耳ってるし、実質的には立法、司法、行政の
    三権を役人が握る、ほとんど役人独裁国家だからw

    スレ違いなんで、この辺にしておくw 

211 名無し三等兵 [sage] 2012/10/15(月) 15:03:31.44 ID:??? Be:
    北海油田と金融商品で税収がフラフラするイギリスみたいになってもなぁ。 

212 名無し三等兵 [sage] 2012/10/15(月) 17:31:13.68 ID:??? Be:
    開くスレ間違えたかと思ったぞw 

213 名無し三等兵 [sage] 2012/10/15(月) 18:32:36.12 ID:??? Be:
    エロゲネタから歴史ネタ、政治経済ネタまで幅広く取り扱う、そんな軍板住民の守備範囲の広さが大好きだよ 

守備範囲の広さと言えば、一部の Ruby コミッターの方々も(ry

■_


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

ホームへ


リンクはご自由にどうぞ

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