ときどきの雑記帖 倒行逆施編

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

一つ前へ 2015年12月(上旬)
一つ後へ 2015年12月(下旬)

ホームへ

2015年12月20日

■_

最近凋落著しいらしい方のMなハンバーガー屋行ってきたんですが。 二人で一つのコーヒー(たぶん)買って二人がけの席で ずーーっと(つってもわたしは30分くらいしかいなかったんですが) カードゲーム(具体的なタイトルは不明)をプレイしている 中学生か高校生くらいのあんちゃん二人。 プレイする場所ないんだろうねえ。 わたしも往時テーブルトークRPG(トラベラーとかトラベラーとかトラベラーあとD&Dとか) 遊ぶのに苦労したしねえ。 アバロンヒルやSPI、GDWのボードゲームはもっと苦労したけどw

あたらしい情報数学 | 上田 徹 | 本 | Amazon.co.jp

ドキュメント72時間「秋葉原 秘密の工房で」 - NHK そういえば金曜日の放送はあれやらあれと時間が被ってたので 録画もしてなかった。再放送は録らないと

■_

2015年12月19日

■_

ちょっと前に話題になってたやつ。 世田谷区ってだけで場所が絞れなかったんだけど(なんとなく深沢の辺りかと思ってた) 有力な情報が。 国士舘大学の辺りかな? 幅10cm、通行至難の自転車レーン? その正体は | 乗りものニュース 東京都世田谷区にある梅丘2丁目交差点付近の道路でも水色で分けられているのですが、ここは少々不思議な状況になっています。幅が10cm程度しかないのです。

■_

■_

隣の要素同士を引き算したい - by shigemk2

val is = List(1, 2, 3, 4)
is.sliding(2).toList.map { case List(a, b) => b - a }

というのを見かけ、Ruby でもできたよな。と思ったもののメソッドどれだっけ?w という状態に

irb(main):002:0> [1,2,3,4].methods.sort
=> [:!, :!=, :!~, :&, :*, :+, :-, :<<, :<=>, :==, :===, :=~, :[], :[]=, :__id__,
 :__send__, :all?, :any?, :assoc, :at, :bsearch, :chunk, :class, :clear, :clone, :collect,
:collect!, :collect_concat, :combination, :compact, :compact!, :concat, :count, :cycle,
:define_singleton_method, :delete, :delete_at, :delete_if, :detect, :display, :drop,
:drop_while, :dup, :each, :each_cons, :each_entry, :each_index, :each_slice, :each_with_index,
:each_with_object, :empty?, :entries, :enum_for, :eql?, :equal?, :extend, :fetch, :fill,
:find, :find_all, :find_index, :first, :flat_map, :flatten, :flatten!, :freeze, :frozen?,
:grep, :group_by, :hash, :include?, :index, :inject, :insert, :inspect, :instance_eval,
:instance_exec, :instance_of?, :instance_variable_defined?, :instance_variable_get,
:instance_variable_set, :instance_variables, :is_a?, :itself, :join, :keep_if, :kind_of?,
:last, :lazy, :length, :map, :map!, :max, :max_by, :member?, :method, :methods, :min, :min_by,
:minmax, :minmax_by, :nil?, :none?, :object_id, :one?, :pack, :partition, :permutation, :pop,
:private_methods, :product, :protected_methods, :public_method, :public_methods, :public_send,
:push, :rassoc, :reduce, :reject, :reject!, :remove_instance_variable, :repeated_combination,
:repeated_permutation, :replace, :respond_to?, :reverse, :reverse!, :reverse_each, :rindex,
:rotate, :rotate!, :sample, :select, :select!, :send, :shift, :shuffle, :shuffle!, :single
ton_class, :singleton_method, :singleton_methods, :size, :slice, :slice!, :slice_after,
:slice_before, :slice_when, :sort, :sort!, :sort_by, :sort_by!, :taint, :tainted?, :take,
:take_while, :tap, :to_a, :to_ary, :to_enum, :to_h, :to_s, :transpose, :trust, :uniq, :uniq!,
:unshift, :untaint, :untrust, :untrusted?, :values_at, :zip, :|]

で、これだった。 each_cons (Enumerable) - Rubyリファレンス

irb(main):009:0> [1,2,3,4].each_cons(2){|a,b| puts b-a}
1
1
1
=> nil

こうしたほうがわかりやすいか?

irb(main):010:0> [1,2,3,4].each_cons(2){|a,b| puts "#{b}-#{a} #{b-a}"}
2-1 1
3-2 1
4-3 1
=> nil

探しているときに気がついたのだけど こういうメソッドもあったのか。 instance method Enumerable#slice_before (Ruby 2.1.0)

2015年12月18日

■_

行動経済学面白い>白熱教室

■_

■_

2015年に最も話題となったプログラミング言語は?2014年との比較も。 - プログラミングとスタートアップの話 で、↓こーゆー表があったのだけど 記事の最後の方に

順位 	言語 	2015年 	2014年 	増減率
1 	javascript 	147,884 	182,343 	-18.9%
2 	css 	93,148 	119,731 	-22.2%
3 	html 	92,483 	146,520 	-36.9%
4 	ruby 	62,455 	101,580 	-38.5%
5 	java 	43,077 	54,854 	-21.5%
6 	python 	40,221 	34,306 	17.2%
7 	php 	36,163 	54,462 	-33.6%
8 	go 	24,237 	32,576 	-25.6%
9 	c++ 	22,502 	34,221 	-34.2%
10 	react.js 	22,194 	5500 	303.5%
11 	swift 	19,980 	23,615 	-15.4%
12 	node.js 	14,637 	20039 	-27.0%
13 	perl 	11,150 	18,184 	-38.7%
14 	unity 	10,635 	11,865 	-10.4%
15 	scala 	9,432 	8,683 	8.6%
16 	angular.js 	7,326 	10059 	-27.2%
17 	backbone.js 	2,545 	4894 	-48.0%

2015年は2015/01/01〜2015/10/16 12:00時点を範囲とする なんてのが書いてあって、 2014年が一年丸々だとするとそれとは二ヶ月半違うわけで その期間での数字を比べるのはどうなんだろう。 というわけで「単純計算」してみる。

>getclip|tr -d ,|gawk "{print $2,$3,$4}"|gawk -vOFS=\t "{print $1,$2*(12/9.5),$3}"|gawk "{printf \"%11s %8.1f %7d %6.1f\n\", $1, $2, $3, 100*$2/$3}"

 javascript 186801.0  182343  102.4
        css 117661.0  119731   98.3
       html 116821.0  146520   79.7
       ruby  78890.5  101580   77.7
       java  54413.1   54854   99.2
     python  50805.5   34306  148.1
        php  45679.6   54462   83.9
         go  30615.2   32576   94.0
        c++  28423.6   34221   83.1
   react.js  28034.5    5500  509.7
      swift  25237.9   23615  106.9
    node.js  18488.8   20039   92.3
       perl  14084.2   18184   77.5
      unity  13433.7   11865  113.2
      scala  11914.1    8683  137.2
 angular.js   9253.9   10059   92.0
backbone.js   3214.7    4894   65.7

ふむ。

ちゃんと (10/17以降の) 2015年の生データを取ると RubyKaigi とか swiftのオープンソース化の影響なんかが目に見える形で出てそうな気がするけどそれはいいや。 あと、最上位グループと最下位グループは二桁違うので、 増減率もその辺考慮すべき? (元の数字が小さいと率は大きく触れやすいだろうし)

2015年12月17日

■_

ギリシア人の物語 読者への手紙

3+7+7+7+3 5+5+10+5+10+5+10+5+5

■_

ぼのぼのもそんなになるんかー>「連載30周年」

■_

「アンダーフロー」ってそういう意味だったっけ? という記事を見かけたのでそのネタ元記事や関連したもの辿ってみたら Grub2 Bootloader Authentication Bypass 0-Day : programming

Grub2 Bootloader Authentication Bypass 0-Day : programming

Total control ≠ unsafe operations by default.

It makes much more sense to make safe APIs more obvious and easily available than unsafe ones.

E.g. rust has over/underflow-protected integers per default. But you can also declare a variable as wrapping by using the type system

Grub2 Bootloader Authentication Bypass 0-Day : programming

Decrementing 0 and getting -1 is hardly a bug.

In some languages decrementing an unsigned below 0 won't compile - if the compiler can see it, it'll just halt. In some others like ADA you can define a range for your integers (type Hundred is range [0..99];) and it'll raise an exception if you under- or overflow.

Please excuse me if I have the syntax of that wrong. It's been many years since I've written that language.

Grub2 Bootloader Authentication Bypass 0-Day : programming

Is the integer underflow caused by decrementing cur_len detectable by analysis tools? The compiler certainly has no idea but I feel like a good static analyzer would produce a fairly obvious warning: decremented unsigned value without bounds check, or something similar.

Back to 28: Grub2 Authentication Bypass 0-Day

Back to 28: Grub2 Authentication Bypass 0-Day

The Vulnerability 

The fault (bug) is in the code of Grub since version 1.98 (December, 2009). The commit which introduced the fault was b391bdb2f2c5ccf29da66cecdbfb7566656a704d, affecting the grub_password_get() function.

There are two functions which suffer the same integer underflow fault. The grub_username_get() and grub_password_get() located in grub-core/normal/auth.c and lib/crypto.c respectively. Both functions are equal except for a call to printf() in the grub_username_get(). The PoC described here is based only on exploiting the grub_username_get() to obtain a Grub rescue shell.

Back to 28: Grub2 Authentication Bypass 0-Day

  cur_len--; // Integer Underflow 
  grub_memset (buf + cur_len, 0, buf_size - cur_len); // Integer Overflow 

The following example helps to understand how we can exploit this. Assuming that the username buffer resides in the address 0x7f674 and the attacker press the backspace key only once (producing an underflow to 0xFFFFFFFF) the resulting memset will be:

へー(上に切り出した以外にも何ヶ所かありました)。

Arithmetic underflow - Wikipedia, the free encyclopedia math - what are arithmetic underflow and over flow in C - Stack Overflow Underflow

2015年12月16日

■_

というのを見かけ、

というのを見かけたので 紀伊國屋書店(の新宿南店)に行ったのだけど WEB+DB PRESS Vol.90 はなかったでござる○| ̄|_

それと、昨日書いてたカットシステムの新刊てのはこれだけどもちろんなかった。

CUTT System 高速化~の方の著者名以前にも見たことあったかなと調べたら 結構な数が引っかかってびっくり。 Amazon.co.jp: 北山 洋幸:作品一覧、著者略歴

数でびっくりと言えばA間さんは最近どうなんだろう。 さすがに月刊ペースでは出てないと思うけど。

■_

■_

How To Pick Your First Programming Language in 2016 POPULARITY のところ、Python だけ伸びがすごいねえ。

2015年12月15日

■_

カットシステムの本は事前にわからないことが多いなあ…… なんかHさんの新刊もあるみたいだし。

■_

■_

今日の迷?訳 テストの巣を使ったテスティングシステム

テストの巣を使ったテスティングシステム

Lyndsay氏: 鳥の巣は何百という貧相な小片から構成されています。– 個々では無力ですが、 まとまれば育っていく家族を守れるようになります。テスターとして実行できる計測は個々で考えると味気なく平凡ですが、 構築を支援しているシステムの深部にある事実を見つけようとするときには役に立つのです。 心地良い韻を踏むものなのです。

Testing Systems with a Nest of Tests

Lyndsay: Bird nests are built from hundreds of insubstantial scraps – individually inadequate, but together able to protect a growing family. As testers, we can take measurements that are dull or trivial if considered individually, but which can support us as we try to discover deep truths about the systems we’re helping to build. And it rhymes, which is pleasant.

insubstantial scraps が 「貧相な小片」ねえ……

■_

なぞのすくりぷと

>irb --noreadline
irb(main):001:0> require 'date'
=> true
irb(main):002:0> [4,6,8,10,12].each{|d| printf "%2d/%2d %d\n", d,d,Date.new(2015,d,d).wday}
 4/ 4 6
 6/ 6 6
 8/ 8 6
10/10 6
12/12 6
=> [4, 6, 8, 10, 12]

ふむ。

irb(main):003:0> [12,10,8,6].each{|d| printf "%2d\n", Date.new(2015,d,d)-Date.new(2015,d-2,d-2)}
63
63
63
63
=> [12, 10, 8, 6]

なるほど。

2015年12月14日

■_

9月の上旬の土曜日はダメなんだよなあ。 たぶん第一週の方(9/3)になるとは思うんだけど、第二週の可能性も否定できない…

今月10日発売のアニメージュがあっという間に売れてしまったらしいけど 一体ナニがあった。

ピケティ本。 図書館にあるかなあと思って調べてみたら、 あるにはあったが予約の順番待ちが結構なものだったw 区全体で複数冊持ってはいるんだけど予約の数もそれなりなので、 単純計算すると順番が回ってくるまで三、四か月といったところか。 どーすっかねー。

東京都・渋谷で元祖ゴジラ絵師・生賴範義回顧展-開田裕治による追悼作品も | マイナビニュース 東京都・渋谷のPARCO GALLERY X(渋谷パルコ パート1)は、"元祖・ゴジラ絵師"として知られるイラストレーター・生賴範義氏の作品を中心にゴジラの歴史をたどる展覧会「生賴範義(おおらいのりよし)回顧展」を開催する。会期は12月30日~2016年1月17日。

■_

■_

はてなブックマーク - Safari 9.0 の JS で「同じ関数を繰り返し実行しただけで返り値が変わる」という強烈なバグが発見されてる - Qiita 昨日のこれ。

Qiita のエントリからたどってバグデータベースのやり取りを見ると Bug 151354 – [JSC] Should not emit get_by_id for indexed property access

Bug 151354 – [JSC] Should not emit get_by_id for indexed property access

Yusuke Suzuki 2015-12-13 11:16:45 PST 

Investigating, but I think I found the cause of this. 

Seeing the result, while "1" should be handled as get_by_val, current bytecode compiler emits get_by_id. So, "1" is accidentally handled by Inline Caching. But it's not correct. Elements are not handled by Structure's identity check. When adding new element property, there may be no Structure transition.

The situation is the following, 
 
Call getOne({2: true}); 

And get_by_id "1" emits IC for this object's map. 
 
And later we getOne({1: true}). 

{1: true}'s Structure is the same to {2: true} since element property addition does not occur Structure transition. So IC accidentally handles this case.

Tomorrow, I'll check further and submit a patch (since now, 4:13 JST).

この後にもいくつかありますが、基本的には↑の原因と対処で解決っぽい?

2015年12月13日

■_

いろいろだめ。

■_

■_

これって同じようなバグを見た覚えがあるんだけど見つけられない…… はてなブックマーク - Safari 9.0 の JS で「同じ関数を繰り返し実行しただけで返り値が変わる」という強烈なバグが発見されてる - Qiita

2015年12月12日

■_

えっとこれも「課金」とかのお仲間に? 板書をするだけではもう古い? ノートの取り方が変化している!! | マイナビニュース 授業中の板書は生徒にとって重要不可欠な作業です。学生時代を振り返ると、黒板に書いているものを書き写し、工夫と言えばカラーペンを使い分けていた事くらいでしょうか。

名](スル)授業などで、黒板に字を書くこと。「要点を―する」 (ばんしょ【板書】の意味 - 国語辞書 - goo辞書)

ところでウィキペにはこういう記述も(転じて以下の部分) 板書(ばんしょ)とは、近代の学校教育において学校の教師が学習事項を黒板に書くことである。児童・生徒・学生は、それを受動的に書き写すことになる。 転じて、主に数学で生徒に宿題を出して、黒板に書かせることも示す。 (板書 - Wikipedia)

■_

■_

某の二日目でしたが以下略

2015年12月11日

■_

お、これは行っとくか 日本の天文学の父 渋川春海の企画展 大人の社会見学ニュース 今年は、日本最初の天文学者と言われる渋川春海が亡くなってからちょうど300年にあたる。 国立科学博物館ではそれを記念し、企画展「渋川春海と江戸時代の天文学者たち」を12月19日~3月6日の期間開催する。

ちょっと道を間違えたがセーフ(謎)

■_


一つ前へ 2015年12月(上旬)
一つ後へ 2015年12月(下旬)

ホームへ


リンクはご自由にどうぞ

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