ときどきの雑記帖″

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

一つ前へ 2014年2月(上旬)
一つ後へ 2014年2月(下旬)

ホームへ

2014年02月20日

■_

Amazon.co.jp: 入門 コンピュータ科学 ITを支える技術と理論の基礎知識: J. Glenn Brookshear, 神林靖, 長尾高弘: 本 を見かけたのでぱらぱらと眺めたのだけどよさげ。 入門 コンピュータ科学 にあるように

入門 コンピュータ科学

内容
	UCバークレイ、ハーバード大学をはじめ全米126校で採用され続ける定番教科書!
	
	米国大学の教養課程で使用されているコンピュータ科学の定番教科書。これからコンピュータ科学を学ぼうとして
        いる学生および大学でコンピュータ科学を学ばなかった社会人プログラマのための独習書として最適です。

というもので、目次もこうだから。

入門 コンピュータ科学

目次
	第0章 序章
0.1 アルゴリズムの役割
0.2 計算の歴史
0.3 アルゴリズムの科学
0.4 抽象化
0.5 本書の構成
0.6 社会的影響
第1章 データストレージ
1.1 ビットとその格納
1.2 メインメモリ
1.3 マスストレージ
1.4 ビットパターンとして情報を表現する
1.5 2進数の体系
1.6 整数を格納する
1.7 小数を格納する
1.8 データ圧縮
1.9 通信エラー
第2章 データ操作
2.1 コンピュータアーキテクチャ
2.2 マシン語
2.3 プログラムの実行
2.4 算術論理命令
2.5 他の装置との通信
2.6 他のアーキテクチャ
第3章 オペレーティングシステム
3.1 オペレーティングシステムの歴史
3.2 オペレーティングシステムのアーキテクチャ
3.3 マシンの動作を調整する
3.4 プロセス間の競合を調整する
3.5 セキュリティ
第4章 ネットワークとインターネット
4.1 ネットワークの基礎
4.2 インターネット
4.3 ワールドワイドウェブ
4.4 インターネットプロトコル
4.5 セキュリティ
第5章 アルゴリズム
5.1 アルゴリズムの概念
5.2 アルゴリズムの表現
5.3 アルゴリズムの発見
5.4 繰返し構造
5.5 再帰構造
5.6 効率性と正当性
第6章 プログラミング言語
6.1 歴史的展望
6.2 伝統的なプログラミング概念
6.3 手続きユニット
6.4 言語の実装
6.5 オブジェクト指向プログラミング
6.6 並行動作のプログラミング
6.7 宣言型プログラミング
第7章 ソフトウェア工学
7.1 ソフトウェア工学という学問
7.2 ソフトウェアライフサイクル
7.3 ソフトウェア工学の方法論
7.4 モジュール性
7.5 ツール
7.6 品質保証
7.7 ドキュメンテーション
7.8 ヒューマンマシンインタフェース
7.9 ソフトウェアの所有権と責任
第8章 データ抽象
8.1 基本データ構造
8.2 関連する概念
8.3 データ構造の実装
8.4 ケーススタディ
8.5 データ型をカスタマイズする
8.6 クラスとオブジェクト
8.7 マシン語におけるポインタ
第9章 データベースシステム
9.1 データベースの基礎
9.2 関係モデル
9.3 オブジェクト指向データベース
9.4 データベースの完全性を保つ
9.5 伝統的ファイル構造
9.6 データマイニング
9.7 データベース技術の社会的影響
第10章 コンピュータグラフィックス
10.1 コンピュータグラフィックスの範囲
10.2 3Dグラフィックスの概要
10.3 モデリング
10.4 レンダリング
10.5 グローバルライティングの処理
10.6 アニメーション
第11章 人工知能
11.1 知能とマシン
11.2 認識
11.3 推論
11.4 その他の研究領域
11.5 人工ニューラルネットワーク
11.6 ロボット工学
11.7 社会的影響を考える
第12章 計算の理論
12.1 関数とその計算
12.2 チューリングマシン
12.3 万能プログラミング言語
12.4 計算不能関数
12.5 問題の複雑さ
12.6 公開鍵暗号
付録A ASCII
付録B 2の補数表現を扱う回路
付録C 単純なマシン語
付録D 高レベルプログラミング言語
付録E 繰返し構造と再帰構造の同等性
付録F 練習問題解答

ただ… call by valu と call by reference の説明はちょっと例が良くないような。 int 型の変数を使って説明してるっぽいのだけど、 そーするといわゆる「オブジェクト型」の変数を使ったときによくあるあの誤解を招く結果に なるんじゃないのかなあ。

■_

GNU grep のはなしつづき Savannah Git Hosting - grep.git/commitdiff しかし、某ブックマークについてるコメントか twitter で見かけたコメントとか 高速化すごいってのばかりで どうやったのか考察したりしてる人を見かけなかったのは残念だなあ。 いやまあ観測範囲狭いですけど

Savannah Git Hosting - grep.git/commitdiff

These days, nearly everyone uses a multibyte locale, and grep is often
used with the --ignore-case (-i) option, but that option imposes a very
high cost in order to handle some unusual cases in just a few multibyte
locales.  This change gets most of the performance of using LC_ALL=C
without eliminating the ability to search for multibyte strings.

With the following example, I see an 11x speed-up with a 2.3GHz i7:
Generate a 10M-line file, with each line consisting of 40 'j's:

    yes jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj | head -10000000 > k

Time searching it for the simple/noexistent string "foobar",
first with this patch (best-of-5 trials):

    LC_ALL=en_US.UTF-8 env time src/grep -i foobar k
        1.10 real         1.03 user         0.07 sys

Back out that commit (temporarily), recompile, and rerun the experiment:

    git log -1 -p|patch -R -p1; make
    LC_ALL=en_US.UTF-8 env time src/grep -i foobar k
        12.50 real        12.41 user         0.08 sys

The trick is to realize that for some search strings, it is easy
to convert to an equivalent one that is handled much more efficiently.
E.g., convert this command:

  grep -i foobar k

to this:

  grep '[fF][oO][oO][bB][aA][rR]' k

That allows the matcher to search in buffer mode, rather than having to
extract/case-convert/search each line separately.  Currently, we perform
this conversion only when search strings contain neither '\' nor '['.
See the comments for more detail.

* src/main.c (trivial_case_ignore): New function.
(main): When possible, transform the regexp so we can drop the -i.
* tests/turkish-eyes: New file.
* tests/Makefile.am (TESTS): Use it.
* NEWS (Improvements): Mention it.

で、パッチ本体を見てみれば(適当に切ってますんでその辺よろしく)

diff --git a/src/main.c b/src/main.c
index 44090be..bfd0982 100644 (file)
--- a/src/main.c
+++ b/src/main.c
@@ -1865,6 +1867,84 @@ parse_grep_colors (void)
       return;
 }
 
+#define MBRTOWC(pwc, s, n, ps) \
+  (MB_CUR_MAX == 1 ? \
+   (*(pwc) = btowc (*(unsigned char *) (s)), 1) : \
+   mbrtowc ((pwc), (s), (n), (ps)))
+
+#define WCRTOMB(s, wc, ps) \
+  (MB_CUR_MAX == 1 ? \
+   (*(s) = wctob ((wint_t) (wc)), 1) : \
+   wcrtomb ((s), (wc), (ps)))
+
+/* If the newline-separated regular expressions, KEYS (with length, LEN
+   and no trailing NUL byte), are amenable to transformation into
+   otherwise equivalent case-ignoring ones, perform the transformation,
+   put the result into malloc'd memory, *NEW_KEYS with length *NEW_LEN,
+   and return true.  Otherwise, return false.  */
+static bool
+trivial_case_ignore (size_t len, char const *keys,
+                     size_t *new_len, char **new_keys)
+{
+  /* FIXME: consider removing the following restriction:
+     Reject if KEYS contain ASCII '\\' or '['.  */
+  if (memchr (keys, '\\', len) || memchr (keys, '[', len))
+    return false;
+
+  /* Worst case is that each byte B of KEYS is ASCII alphabetic and each
+     other_case(B) character, C, occupies MB_CUR_MAX bytes, so each B
+     maps to [BC], which requires MB_CUR_MAX + 3 bytes.   */
+  *new_keys = xnmalloc (MB_CUR_MAX + 3, len + 1);
+  char *p = *new_keys;
+
+  mbstate_t mb_state;
+  memset (&mb_state, 0, sizeof mb_state);
+  while (len)
+    {
+      wchar_t wc;
+      int n = MBRTOWC (&wc, keys, len, &mb_state);
+
+      /* For an invalid, incomplete or L'\0', skip this optimization.  */
+      if (n <= 0)
+        {
+        skip_case_ignore_optimization:
+          free (*new_keys);
+          return false;
+        }
+
+      char const *orig = keys;
+      keys += n;
+      len -= n;
+
+      if (!iswalpha (wc))
+        {
+          memcpy (p, orig, n);
+          p += n;
+        }
+      else
+        {
+          *p++ = '[';
+          memcpy (p, orig, n);
+          p += n;
+
+          wchar_t wc2 = iswupper (wc) ? towlower (wc) : towupper (wc);
+          char buf[MB_CUR_MAX];
+          int n2 = WCRTOMB (buf, wc2, &mb_state);
+          if (n2 <= 0)
+            goto skip_case_ignore_optimization;
+          assert (n2 <= MB_CUR_MAX);
+          memcpy (p, buf, n2);
+          p += n2;
+
+          *p++ = ']';
+        }
+    }
+
+  *new_len = p - *new_keys;
+
+  return true;
+}
+
 int
 main (int argc, char **argv)
 {

ううむなんかしちめんどくさいことやってるなあ。 MBRTOWC してその結果を towlower/towupper して WCRTOMB して… とはいえこうなるのは仕方ないか。 んで、'[' と ']' の間に単純に変換結果と元の文字を入れてるだけなので、 マルチバイト文字で '\' やら含んでるとだめ。と。

@@ -2263,6 +2343,35 @@ main (int argc, char **argv)
   else
     usage (EXIT_TROUBLE);
 
+  /* As currently implemented, case-insensitive matching is expensive in
+     multi-byte locales because of a few outlier locales in which some
+     characters change size when converted to upper or lower case.  To
+     accommodate those, we revert to searching the input one line at a
+     time, rather than using the much more efficient buffer search.
+     However, if we have a regular expression, /foo/i, we can convert
+     it to an equivalent case-insensitive /[fF][oO][oO]/, and thus
+     avoid the expensive read-and-process-a-line-at-a-time requirement.
+     Optimize-away the "-i" option, when possible, converting each
+     candidate alpha, C, in the regexp to [Cc].  */
+  if (match_icase)
+    {
+      size_t new_keycc;
+      char *new_keys;
+      /* It is not possible with -F, not useful with -P (pcre) and there is no
+         point when there is no regexp.  It also depends on which constructs
+         appear in the regexp.  See trivial_case_ignore for those details.  */
+      if (keycc
+          && ! (matcher
+                && (STREQ (matcher, "fgrep") || STREQ (matcher, "pcre")))
+          && trivial_case_ignore (keycc, keys, &new_keycc, &new_keys))
+        {
+          match_icase = 0;
+          free (keys);
+          keys = new_keys;
+          keycc = new_keycc;
+        }
+    }
+
   compile (keys, keycc);
   free (keys);
 

trivial_case_ignore 呼ぶかどうかの判定も面倒だなあ

■_

■_

ぱたっ

■_

2014年02月19日

■_

アド・アストラ 5巻読了(Kindle版)。 ぐはーっカンネの会戦のいいところで次巻へ続く○| ̄|_ カンナエの戦い - Wikipedia アド・アストラ 5 ─スキピオとハンニバル─ (ヤングジャンプコミックス・ウルトラ)
アド・アストラ 5 ─スキピオとハンニバル─ (ヤングジャンプコミックス・ウルトラ)

仕込み(謎)の時間をもうちょっとなんとかしないとだわ

■_ GNU grep

なんか速くなったという話が 文字列検索コマンド「grep 2.17」リリース | SourceForge.JP Magazine

文字列検索コマンド「grep 2.17」リリース | SourceForge.JP Magazine

GNU Projectのgrep開発チームは2月17日、最新安定版「grep-2.17」をリリースした。パフォーマンスの向上が行われており、
「10倍の高速化」が実現されているという。

わたしは先にこっちで知ったのですが GNU grep 2.17, 10x faster | Hacker News

GNU grep 2.17, 10x faster | Hacker News

taken from http://git.savannah.gnu.org/gitweb/?p=grep.git;a=commit;h=97... it seems like the speedup was
achieved in the most common case of usage, which is with the -i switch (for case insensitive searching).

taken from the commit log:

"The trick is to realize that for some search strings, it is easy to convert to an equivalent one that is handled much more efficiently. E.G. convert this command:

  grep -i foobar k

to this:

  grep '[fF][oO][oO][bB][aA][rR]' k

That allows the matcher to search in buffer mode, rather than having to extract/case-convert/search each line
separately. Currently, we perform this conversion only when search strings contain neither '\' nor '['."

From the NEWS section in the page:

Improvements

  grep -i in a multibyte locale is now typically 10 times faster
  for patterns that do not contain \ or [.

  grep (without -i) in a multibyte locale is now up to 7 times faster
  when processing many matched lines.

-i 指定時の方は具体的にはナニをどうやってるのかよくわからんのですが Savannah Git Hosting - grep.git/shortlog で変更点を追いかけてみると

Savannah Git Hosting - grep.git/commitdiff

Savannah Git Hosting - grep.git/commitdiff

+  /* With case-insensitive matching in a multi-byte locale, do not
+     use kwsearch, because in that case, it would be too expensive,
+     requiring that we case-convert all searched input.  */
+  if (MB_CUR_MAX > 1 && match_icase)
+    return;

これがひとつと。expensive 過ぎる処理を省いたというのはわかる。

Savannah Git Hosting - grep.git/commitdiff こっちは

Savannah Git Hosting - grep.git/commitdiff

+/* Initialize a cache of mbrlen values for each of its 1-byte inputs.  */
+void
+build_mbclen_cache (void)
+{
+  int i;
+
+  for (i = CHAR_MIN; i <= CHAR_MAX; ++i)
+    {
+      char c = i;
+      unsigned char uc = i;
+      mbstate_t mbs = { 0 };
+      mbclen_cache[uc] = mbrlen (&c, 1, &mbs);
+    }
+}
Savannah Git Hosting - grep.git/commitdiff

+#if HAVE_LANGINFO_CODESET
+  static int is_utf8 = -1;
+
+  if (is_utf8 == -1)
+    is_utf8 = STREQ (nl_langinfo (CODESET), "UTF-8");
+
+  if (is_utf8 && buf - p > MB_CUR_MAX)
+    {
+      for (p = buf; buf - p > MB_CUR_MAX; p--)
+        if (mbclen_cache[to_uchar (*p)] != (size_t) -1)
+          break;
+
+      if (buf - p == MB_CUR_MAX)
+        p = buf;
+    }
+#endif
+
+  memset (&cur_state, 0, sizeof cur_state);
 
-  /* TODO: can be optimized for UTF-8.  */
-  memset(&cur_state, 0, sizeof(mbstate_t));
   while (p < buf)
     {
-      size_t mbclen = mbrlen(p, end - p, &cur_state);
+      size_t mbclen = mbclen_cache[to_uchar (*p)];
+
+      if (mbclen == (size_t) -2)
+        mbclen = mbrlen (p, end - p, &cur_state);

とまあ、重めな処理をする関数 (mbrlen) の呼び出しを あらかじめ戻り値をキャッシュしといてそれを使おうというわけですね。 ってこれで 3~7倍高速化したんだ。

grep そのもののコードじゃないんだけど、glibc から持ってきている regex でもこの種の関数をガンガン呼び出しているんだけどそっちはどうなんだろう (glibc なので grep のメンテナーが直接いじるというのは多分アレ)

たとえば lib/regcomp.c にはこういうのがある

#ifdef RE_ENABLE_I18N
	  if ((bufp->syntax & RE_ICASE) && dfa->mb_cur_max > 1)
	    {
	      unsigned char buf[MB_LEN_MAX];
	      unsigned char *p;
	      wchar_t wc;
	      mbstate_t state;

	      p = buf;
	      *p++ = dfa->nodes[node].opr.c;
	      while (++node < dfa->nodes_len
		     &&	dfa->nodes[node].type == CHARACTER
		     && dfa->nodes[node].mb_partial)
		*p++ = dfa->nodes[node].opr.c;
	      memset (&state, '\0', sizeof (state));
	      if (__mbrtowc (&wc, (const char *) buf, p - buf,
			     &state) == p - buf
		  && (__wcrtomb ((char *) buf, towlower (wc), &state)
		      != (size_t) -1))
		re_set_fastmap (fastmap, false, buf[0]);
	    }
#endif
	}

■_ 二極化

ソフトウェア工学からコンピューターサイエンスへ (デブサミ2014)

ソフトウェア工学からコンピューターサイエンスへ (デブサミ2014) from Masayoshi Hagiwara

「二極化」の意味がわからんげ。 パッと思いつくのはとてもできる層とまるでできない層とにくっきり別れるという 感じなんだけど、チャートからはそう読み取れないしなあ… 誰か実際にこれ聴いてた人いたら解説プリーズ。

■_

■_

今日はあと三つくらい話のタネがあったんだけどなー ○| ̄|_

2014年02月18日

■_

中には入りませんでしたが入り口のところまで行ってきました :) ビジネスパーソンの強い味方に?:ドリンク飲み放題、雑誌読み放題で10分100円!? 暇つぶし空間の新業態「コインスペース」 - 誠 Biz.ID まー10分100円だと3時間でも1800円だしなー。ネカフェより高めな料金だけど一度使ってみますかねー

■_

Collection of Less Commonly Used UNIX Commands 見覚えないのがちらほら rs: reshape arrays ってどんなんだろ

Collection of Less Commonly Used UNIX Commands
Notes

    A few of these (tr, lsof, etc) aren’t exceedingly rare, but enough people either have never heard of them or have forgotten about them that it made sense to include them.

    Some of these are OS X only. Apologies for that, but I wanted to highlight them while still keeping the simple structure of the list.

    Some of the “commands” or “applications” are actually shell-based. Thanks to @gonzih for his great comments.

■_ なんちゃら曲線

思い出したようにこの話題。 今日偶然見つけたこの回答。 成長曲線として使われるロジスティック曲線やゴンペルツ曲線が考案された理由 - 質問・相談ならMSN相談箱

成長曲線として使われるロジスティック曲線やゴンペルツ曲線が考案された理由 - 質問・相談ならMSN相談箱

成長曲線と言うのは生物の成長なども入っています。
システムの場合、信頼度成長モデルと言います。
これは信頼性の向上の過程を、摘出したエラー件数により、グラフ化するものです。
ロジスティック曲線やゴンペルツ曲線の由来はわかりませんが、一般に
ロジスティック曲線はテストの中間時期に適し、
ゴンペルツ曲線はテストの開始・終了時期に適していると言われています。

え、なにそれ>中間時期/開始・終了時期向き

■_

■_

Career options for Java Developers | TECHNETHUB とか No More Technical Debt - Invest in Quality 辺りでちょっと書こうかと夕方には思ってたんですが以下略

2014年02月17日

■_

月二回の楽しみ。 わたしにとっては払った金に見合うだけのものはあると思っています。 押井守の「世界の半分を怒らせる」。(押井守(と不快な仲間たち)) - ニコニコチャンネル:社会・言論

どこからともなく、ネカフェ辺りではもくもくできんのかという声が聞こえてきたんですが できないんですね残念ながら。 マンガや小さめの本を読むのは問題ありませんが、B5とかA4くらいあるような本を読むとなると ずっと手でもって読むのはきついし、といって書見台おいたり 広げておけるようなスペースはなかったりするんですね。 以前は(といってももう5年くらい前)そういうスペースがとれるブースの広さと構造を持った お店があったんですが残念なことに店じまい。 結構足繁く通ったんだけどなあ。電車で数駅行ったとこだったんですけど。

■_ Idris

Idris というプログラミング言語がございまして。 Idris - Idris (programming language) - Wikipedia, the free encyclopedia その Idris についてのとあるスライド資料を見ていたら気になるフレーズが


Pac-man complete functinal programming language ってナニ?

そういえば Starnge Loop でこういうのが Scala vs Idris: Dependent types, now and in the future - Strange Loop これはたしか InfoQ でも見られるようになっていたはず

■_ 課題

情報技術者の社会的責任 第15話 (最終話) のレポート課題がなかなか (問一のみ。問二は実際に講義うけてた人でないとw)。

情報技術者の社会的責任 最終レポートまとめ を見ていると、道徳の授業みたいだったというのがあって大笑い。 なるほどそんな感じはした。

■_

■_

夕食とった辺りからどうも調子がよろしくないのでこんなもんで。

2014年02月16日

■_

「賢者は歴史に学び愚者は経験に学ぶ」 という箴言に対して、賢者は経験からも学ぶとかいうツッコミ?を見かけたんですが これって賢者は歴史から学ぶけど経験からは学ばない(逆に愚者は…)って解釈するもんだったんでしょうか。 なんか意外。

「あとで読む」を整理中に再発見したもの There’s Only Four Billion Floats–So Test Them All! : programming There are Only Four Billion Floats–So Test Them All! | Random ASCII 内容はさておき、 「for billion floats しかない」というのはすごいなあと。

最終回 情報技術者の社会的責任 第15話 (最終話) 情報技術者の社会的責任 最終レポートまとめ

あとでよむ やる夫と学ぶホビーパソコンの歴史 第21話: 11289 Bytes free - タイニーPのブログ

■_

スライド印刷してたのを掘り出して読んだ

InfoQ の解説には Axiomatic Language Walter Wilson introduces Axiomatic, a minimal pure-specification logic language with meta-language capability based on the idea that the external behavior of a program can be defined by an infinite set of symbolic expressions that enumerate all possible inputs, or sequences of inputs, along with the corresponding outputs. The language is just a ormal system for defining these symbolic expressions とあって、大元の starngeloop で見ると Axiomatic Language - Strange Loop Programming languages are constrained by the need for efficiency. But what kind of language would we want if efficiency could be ignored? Axiomatic language is an answer to this question. It has the following goals: (1) pure specification – you tell the computer what to do without telling it how to do it, (2) minimal, but extensible – nothing is built-in that can be defined, and (3) a metalanguage – able to imitate and thus subsume other languages. Axiomatic language is based on the idea that the external behavior of a program can be defined by an infinite set of symbolic expressions that enumerate all possible inputs, or sequences of inputs, along with the corresponding outputs. The language is just a formal system for defining these symbolic expressions. なんか面白そう

Axiomatic Language Home Page というのもあったり、 Axiomatic Language | Lambda the Ultimate で取りあげられてもいた。 さらに遡ってこういうのも LtU Classic Archives

■_

■_

色々途中までやったけど投げた

2014年02月15日

■_

ちょっと前に、その人のよく行くドトールが勉強(に店を使うの)禁止になったという ツイートを見かけたんですが、 「勉強禁止」でぐぐると割と引っかかりますね 勉強禁止 - Google 検索 論文読みも勉強に入っちゃうんだろうかという心配があるんですが、 まあそれ以前に(何に使っているのはおいといて)混んでてそもそも入店できねえよってな話ががが。 場所によっては図書館もそうらしいですが 皆さんの地域の図書館は勉強禁止ですか? - Yahoo!知恵袋 そういや新しくなった中原図書館もそうだったかしら。 ご利用方法-図書館マップ(施設案内-中原図書館)│川崎市立図書館 4月2日(火)オープン!国内最高レベルの図書館、中原図書館ってどんなとこ?[はまれぽ.com] んー。前に会社帰りにもくもくするのに使おうと思ったけど (混んでいる以外の理由で)使えないノカーとがっかりした記憶があるんだけど。

そういや最寄り駅の近くに、以前時間制の勉強部屋があったんだけどなくなっちゃったなー。 パソコン使用禁止だったんで入ったことないんだけど、 看板の文句やらで判断すると漫画喫茶の個室みたいのが幾つかあるような感じだったけど。

(わたしにとって)リーズナブルなお値段のもくもく空間ないものか喃。

科学博物館

■_

UNO Computer Science - Exploitation of Quantitative Approaches to Software Reliability という論文の8ページ目にこんな図がありまして。 jpeg にした時点で読みづらくなってしまってると思うけど、 そこは心の目でひとつ。

なんでこうたくさんあるんすかねえ

■_

■_

お、なんか面白そう。 でもたとえば巾乗とか % とか足したい場合どうにかできるんだろうか ASCII.jp:フリックでどんどん計算する、一風変わったiPhone用計算機アプリ|富士見iPhoneクラブ

■_

あーアウトプットできないモード○| ̄|_

2014年02月14日

■_

雪。 また大変なことになってますが今日は午後半休でわたしはあまり影響うけず。

偽善のすすめ: 10代からの倫理学講座 (14歳の世渡り術) 買った。

Delphi 19周年とか。 ってことはわたしが北米に長期出張してた頃からそんだけ経ったと。うへえ。 最初の Delphi 向こうで買ったんだよね。 帰ってきて日本語版また買ったんだけど。

■_

■_

明日(土曜日)は出かけられる状態になるんでしょーか?

2014年02月13日

■_

行きたかったー 「デブサミ2014」本日開幕、Action!を促す「Story」の共有が今年のテーマ:CodeZine デブサミ2014、講演関連資料まとめ:CodeZine 「オープンソースエンジニア生存戦略」をデブサミ2014初日に聞いてきた - tchikuba's blog

またしても雪の予報ですが。 十年前あるいは二十年前と比べてどのくらい精度が上がってんですかね。

コルメン本。 消費税率上がる云々除いても買うなら早めに買っといた方が良さそうな気がしてきた。 まあ原書を持ってはいるんだけれども。

■_

朝方見かけたLarryのツイート

■_

ちょっと気になる。 数学勉強会 - 数学カフェ

■_

JSCert: Certified JavaScript

JSCert: Certified JavaScript

The JSCert project aims to really understand JavaScript. JSCert itself is a mechanised specification of
JavaScript, written in the Coq proof assistant, which closely follows the ECMAScript 5 English standard. JSRef
is a reference interpreter for JavaScript in OCaml, which has been proved correct with respect to JSCert and
tested with the Test 262 test suite. 

でソース。Coq はわからん(OCamlもかな)けどちょっと見てみるかな jscert/jscert

■_

■_

んでまあ亀の歩みではあるものの 信頼度成長曲線 - Wikipedia Software reliability testing - Wikipedia, the free encyclopedia この辺に関係する論文あさりまくって読み散らかしているんですが。

A New Software Reliability Growth Model: Genetic-Programming-Based Approach

A variety of Software Reliability Growth Models (SRGM) have been presented in literature. These models suffer
many problems when handling various types of project. The reason is; the nature of each project makes it
difficult to build a model which can generalize.

なんですよねえ。 ある手法(モデル)を論じるときにその優位性を書くのはいいとしても やっぱりそれも上の引用部にあるように別の状況ではまた別の手法の方が良いってのがあるわけで。 この辺参考書なんかだと良さそうなの選べとか投げっぱなしにされたりするんですね。 英語の論文だと複数のモデルからどのように選択するか というのを書いたものがあったような。 しかし情報処理技術者試験の参考書だとかだとだいたい ロジスティック曲線とゴンペルツ曲線しかほぼ出てこないのはどーゆーことなのーっ 「ロジスティック回帰分析」入門

2014年02月12日

■_

Pocket に貯めてるページが増える一方~~~♪

TIOBE index、2014年2月分のが上がってたけどあとで。

■_

Typical Programmer - Why don’t software development methodologies work? を訳した人がいて 何でソフトウェア開発の手法って上手くいかないの? この二つのコメントの内容を比較してにやにや。 はてなブックマーク - 何でソフトウェア開発の手法って上手くいかないの? Why don’t software development methodologies work? | Hacker News

ところで 何でソフトウェア開発の手法って上手くいかないの? だと、見出しが 何でソフトウェア開発の手法って上手くいかないの? 「ソフトウェア開発手法が上手く行ってる」っていつ言うことが出来るの? 私達の最大の敵 の三つだけど、元記事には四番目に

Typical Programmer - Why don’t software development methodologies work?

Does anything work?

My own experience, validated by Cockburn’s thesis and Frederick Brooks in No Silver Bullet, is that software
development projects succeed when the key people on the team share a common vision, what Brooks calls
“conceptual integrity.” This doesn’t arise from any particular methodology, and can happen in the absence
of anything resembling a process. I know the feeling working on a team where everyone clicks and things just
get done. What I don’t understand is why I had that feeling a lot more in the bad old days of BDUF and
business analysts than I do now.

I think programmers should pay much more attention to listening to and working with their peers than to rituals
and tools, and that we should be skeptical of too much process or methodologies that promise to magically make
everyone more productive. Maybe social skills come harder to programmers than to other people (I’m not
convinced that’s true), but developing those skills will certainly pay off a lot more than trying yet another
development methodology.

というのがあるんだけど、翻訳ではどこ行っちゃったんだろう? (後から追記された?) 翻訳の方が途中で、その後追加された模様

■_

Why Don't Schools Teach Debugging? - Dan Luu Why Don't Schools Teach Debugging? : programming 大盛り上がり。

■_

新型プリウス190万台リコール 「急に減速」と苦情 国土交通省によりますと、ハイブリッドシステムに不具合があり、アクセルを踏み込む際に電子部品がショートし、走行中に減速したり、走行不能になる恐れがあるということです。 この不具合による事故は起きていませんが、「高速道路で突然、減速した」などの苦情が全国から300件ほど寄せられています。トヨタは13日から無料で部品の交換やソフトの更新に応じるとしています。 「ソフトの更新」というのにちょっと引っかかるものがあるけど カムリの例の事故であれこれ言われた制御ソフトの問題ではないのかな。 車種違うし。

■_

最近のJavaのStringの実装変更で印象に残ったこと2点:森崎修司の「どうやってはかるの?」:ITmedia オルタナティブ・ブログ がきっかけなのかよくわかりませんが、 昨日今日とJava の Stringの実装云々に絡んだツイートを結構見かけまして。 翻訳記事でさえ去年の年末辺りのものなのになんで今頃(ry とか思ったり思わなかったり。

■_

2014年02月11日

■_

月曜日に見てたスライドから http://jnthn.net/papers/2014-fosdem-perl6-today.pdf 型理論 なんて自分には関係ないと思っているあなたへ All About Ruby-no-Kai // Speaker Deck 2015年のが見えたりしますがががが Linear Logic Programming 味わいのあるスライドだー

この辺を見る(たぶん)

laplace のなんとかってここ数日他で見た覚えがあるんだけどなんだっけか Laplace’s Equation in Haskell: Using a DSL for Stencils | Idontgetoutmuch’s Weblog あ、ラプラスの悪魔 - Wikipedia ではないです。

■_

Python 3.3.4 Release リリースされたということで(ソースコードのアーカイブを)ダウンロード。 なんか大きめの変更ありそう?

Python 3.3.4 Release

Major new features of the 3.3 series, compared to 3.2

Python 3.3 includes a range of improvements of the 3.x series, as well as easier porting between 2.x and 3.x.

    PEP 380, syntax for delegating to a subgenerator (yield from)
    PEP 393, flexible string representation (doing away with the distinction between "wide" and "narrow" Unicode builds)
    A C implementation of the "decimal" module, with up to 120x speedup for decimal-heavy applications
    The import system (__import__) is based on importlib by default
    The new "lzma" module with LZMA/XZ support
    PEP 397, a Python launcher for Windows
    PEP 405, virtual environment support in core
    PEP 420, namespace package support
    PEP 3151, reworking the OS and IO exception hierarchy
    PEP 3155, qualified name for classes and functions
    PEP 409, suppressing exception context
    PEP 414, explicit Unicode literals to help with porting
    PEP 418, extended platform-independent clocks in the "time" module
    PEP 412, a new key-sharing dictionary implementation that significantly saves memory for object-oriented code
    PEP 362, the function-signature object
    The new "faulthandler" module that helps diagnosing crashes
    The new "unittest.mock" module
    The new "ipaddress" module
    The "sys.implementation" attribute
    A policy framework for the email package, with a provisional (see PEP 411) policy that adds much improved unicode support for email header parsing
    A "collections.ChainMap" class for linking mappings to a single unit
    Wrappers for many more POSIX functions in the "os" and "signal" modules, as well as other useful functions such as "sendfile()"
    Hash randomization, introduced in earlier bugfix releases, is now switched on by default

380 とか 397 あたりはもう一度見ておこう

■_

これ Scala ですよね

ということで Ruby で。

irb(main):010:0> (1..100).to_a.map{|e| e*11}
=> [11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187,
198, 209, 220, 231, 242, 253, 264, 275, 286, 297, 308, 319, 330, 341, 352, 363,
374, 385, 396, 407, 418, 429, 440, 451, 462, 473, 484, 495, 506, 517, 528, 539,
550, 561, 572, 583, 594, 605, 616, 627, 638, 649, 660, 671, 682, 693, 704, 715,
726, 737, 748, 759, 770, 781, 792, 803, 814, 825, 836, 847, 858, 869, 880, 891,
902, 913, 924, 935, 946, 957, 968, 979, 990, 1001, 1012, 1023, 1034, 1045, 1056,
 1067, 1078, 1089, 1100]

まずは11の倍数を

irb(main):011:0> (1..100).to_a.map{|e| e*11}.collect{|e| e.to_s}
=> ["11", "22", "33", "44", "55", "66", "77", "88", "99", "110", "121", "132",
"143", "154", "165", "176", "187", "198", "209", "220", "231", "242", "253", "264",
"275", "286", "297", "308", "319", "330", "341", "352", "363", "374", "385",
"396", "407", "418", "429", "440", "451", "462", "473", "484", "495", "506", "517",
"528", "539", "550", "561", "572", "583", "594", "605", "616", "627", "638", "649",
"660", "671", "682", "693", "704", "715", "726", "737", "748", "759", "770", "781",
"792", "803", "814", "825", "836", "847", "858", "869", "880", "891", "902", "913",
"924", "935", "946", "957", "968", "979", "990", "1001", "1012", "1023", "1034",
"1045", "1056", "1067", "1078", "1089", "1100"]

それを文字列化

irb(main):015:0> (1..100).to_a.map{|e| e*11}.collect{|e| e.to_s.split('')}
=> [["1", "1"], ["2", "2"], ["3", "3"], ["4", "4"], ["5", "5"], ["6", "6"], ["7", "7"],
["8", "8"], ["9", "9"], ["1", "1", "0"], ["1", "2", "1"], ["1", "3", "2"], ["1", "4", "3"],
["1", "5", "4"], ["1", "6", "5"], ["1", "7", "6"], ["1", "8", "7"], ["1", "9", "8"],
["2", "0", "9"], ["2", "2", "0"], ["2", "3", "1"], ["2", "4", "2"], ["2", "5", "3"],
["2", "6", "4"], ["2", "7", "5"], ["2", "8", "6"], ["2", "9", "7"], ["3", "0", "8"],
["3", "1", "9"], ["3", "3", "0"], ["3", "4","1"], ["3", "5", "2"], ["3", "6", "3"],
["3", "7", "4"], ["3", "8", "5"], ["3","9", "6"], ["4", "0", "7"], ["4", "1", "8"],
["4", "2", "9"], ["4", "4", "0"], ["4", "5", "1"], ["4", "6", "2"], ["4", "7", "3"],
["4", "8", "4"], ["4", "9", "5"], ["5", "0", "6"], ["5", "1", "7"], ["5", "2", "8"],
["5", "3", "9"], ["5", "5", "0"], ["5", "6", "1"], ["5", "7", "2"], ["5", "8", "3"],
["5", "9", "4"], ["6", "0", "5"], ["6", "1", "6"], ["6", "2", "7"], ["6", "3", "8"],
["6", "4", "9"], ["6", "6", "0"], ["6", "7", "1"], ["6", "8", "2"], ["6", "9", "3"],
["7", "0", "4"], ["7", "1", "5"], ["7", "2", "6"], ["7", "3", "7"], ["7", "4", "8"],
["7", "5", "9"], ["7", "7", "0"], ["7", "8", "1"], ["7", "9", "2"], ["8", "0", "3"],
["8", "1", "4"], ["8", "2", "5"], ["8", "3", "6"], ["8", "4", "7"], ["8", "5", "8"],
["8", "6", "9"], ["8", "8", "0"], ["8", "9", "1"], ["9", "0", "2"], ["9", "1", "3"],
["9", "2", "4"], ["9", "3", "5"], ["9", "4", "6"], ["9", "5", "7"], ["9", "6", "8"],
["9", "7", "9"], ["9", "9", "0"], ["1", "0", "0", "1"], ["1", "0", "1", "2"],
["1", "0", "2", "3"], ["1", "0", "3", "4"], ["1", "0", "4", "5"], ["1", "0", "5", "6"],
["1", "0", "6", "7"], ["1", "0", "7", "8"], ["1", "0", "8", "9"], ["1", "1", "0", "0"]]

一桁ごとに分けて

irb(main):019:0> (1..100).to_a.map{|e| e*11}.collect{|e| e.to_s.split('').map{|e| e.ord - '0'.ord}}
=> [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [1,1, 0],
[1, 2, 1], [1, 3, 2], [1, 4, 3], [1, 5, 4], [1, 6, 5], [1, 7, 6], [1, 8,7], [1, 9, 8],
[2, 0, 9], [2, 2, 0], [2, 3, 1], [2, 4, 2], [2, 5, 3], [2, 6, 4], [2, 7, 5], [2, 8, 6],
[2, 9, 7], [3, 0, 8], [3, 1, 9], [3, 3, 0], [3, 4, 1], [3, 5, 2], [3, 6, 3], [3, 7, 4],
[3, 8, 5], [3, 9, 6], [4, 0, 7], [4, 1, 8], [4, 2, 9], [4, 4, 0], [4, 5, 1], [4, 6, 2],
[4, 7, 3], [4, 8, 4], [4, 9, 5], [5, 0, 6], [5, 1, 7], [5, 2, 8], [5, 3, 9], [5, 5, 0],
[5, 6, 1], [5, 7, 2], [5, 8, 3], [5, 9, 4], [6, 0, 5], [6, 1, 6], [6, 2, 7], [6, 3, 8],
[6, 4, 9], [6, 6, 0], [6, 7, 1], [6, 8, 2], [6, 9, 3], [7, 0, 4], [7, 1, 5], [7, 2, 6],
[7, 3, 7], [7, 4, 8], [7, 5, 9], [7, 7, 0], [7, 8, 1], [7, 9, 2], [8, 0, 3], [8, 1, 4],
[8, 2, 5], [8, 3, 6], [8, 4, 7], [8, 5, 8], [8, 6, 9], [8, 8, 0], [8, 9, 1], [9, 0, 2],
[9, 1, 3], [9, 2, 4], [9, 3, 5], [9, 4, 6], [9, 5, 7], [9, 6, 8], [9, 7, 9], [9,9, 0],
[1, 0, 0, 1], [1, 0, 1, 2], [1, 0, 2, 3], [1, 0, 3, 4], [1, 0, 4, 5], [1, 0, 5, 6],
[1, 0, 6, 7], [1, 0, 7, 8], [1, 0, 8, 9], [1, 1, 0, 0]]

数値に戻して

irb(main):021:0> (1..100).to_a.map{|e| e*11}.collect{|e| e.to_s.split('').map{|e| e.ord - '0'.ord}.inject(:+)}
=> [2, 4, 6, 8, 10, 12, 14, 16, 18, 2, 4, 6, 8, 10, 12, 14, 16, 18, 11, 4, 6, 8,
10, 12, 14, 16, 18, 11, 13, 6, 8, 10, 12, 14, 16, 18, 11, 13, 15, 8, 10, 12, 14,
16, 18, 11, 13, 15, 17, 10, 12, 14, 16, 18, 11, 13, 15, 17, 19, 12, 14, 16, 18,
11, 13, 15, 17, 19, 21, 14, 16, 18, 11, 13, 15, 17, 19, 21, 23, 16, 18, 11, 13,
15, 17, 19, 21, 23, 25, 18, 2, 4, 6, 8, 10, 12, 14, 16, 18, 2]

加算(最初 .sum とか書いてしまったのはナイショだ)

irb(main):025:0> (1..100).to_a.map{|e| e*11}.collect{|e| e.to_s.split('').map{|e| e.ord - '0'.ord}.inject(:+) % 2 == 1}
=> [false, false, false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, true, false, false, false, false,
false, false, false, false, true, true, false, false, false, false, false, false,
false, true, true, true, false, false, false, false, false, false, true, true, true,
true, false, false, false, false, false, true, true, true, true, true, false, false,
false, false, true, true, true, true, true, true, false, false, false, true, true,
true, true, true, true, true, false, false, true, true, true, true, true, true, true,
true, false, false, false, false, false, false, false, false, false, false, false]

それが奇数かどうか

true/false の配列見ても面白くないので、ちょっといじる

irb(main):015:0> [*1..100].map{|e| e*11}.select{|e| e.to_s.split('').map{|e| e.ord - '0'.ord}.inject(:+)%2==1}
=> [209, 308, 319, 407, 418, 429, 506, 517, 528, 539, 605, 616, 627, 638, 649, 704, 715,
726, 737, 748, 759, 803, 814, 825, 836, 847, 858, 869, 902, 913, 924, 935, 946, 957, 968, 979]

ま、こんなところで。 _ はちょっと欲しいかな。

■_

■_

書こうと思ってるもの、途中まで手をつけたものいくつかあるんですが仕上げている余裕がががが

■_

かくたにさんにフェロー就任祝いをwishlistからポチっといた(高くないやつ)。


一つ前へ 2014年2月(上旬)
一つ後へ 2014年2月(下旬)

ホームへ


リンクはご自由にどうぞ

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