ときどきの雑記帖 ぴゅあ

I'd just be the catcher in the rye and all. I know it's crazy, but that's the only thing I'd really like to be. I know it's crazy.

The catcher in the rye
J. D. Salinger

著作権保護期間の70年延長に反対

検索エンジン経由でこられた方へ

このページの内容は日々更新されます。 そのため、検索エンジンに引っかかったものがここに残っているとは限りません。 同じ内容のものは zakkicho[0-9]+.html なページに多分あります。 特に逆ポーランド記法←→中置記法の変換に関して探している人は ここ とか ここ にあります。

最新エントリ (何日分あるかは不定)

2012年02月08日

■_

O'Reilly Media - Tech Books, DRM-Free Ebooks, Videos なんか2冊買うと1冊無料でついてくるって話らしいんですが、 欲しいなあってのが Upcoming - O'Reilly Media の辺りにしかなかったりして。 ラクダ本マダー?

Upcoming - O'Reilly Media

Programming Perl, 4th Edition
By Tom Christiansen, brian d foy, Larry Wall, Jon Orwant
February 2012 (est.)
Ebook: $39.99
Pre-Order Print: $49.99

↓この辺も早く

Upcoming - O'Reilly Media

Code Simplicity
By Max Kanat-Alexander
February 2012 (est.)
Pre-Order Print: $24.99
Upcoming - O'Reilly Media

Think Complexity
By Allen B. Downey
March 2012 (est.)
Pre-Order Print: $29.99

おや、こんなのが。 Free as in Freedom [Paperback] - O'Reilly Media 確か自分が持っているのはハードカバーだったような (ろくに読んでなかったりする :)。

■_ The History of Rubinius

前後のページとの関連がよくわからない(^^:

Razzle Dazzle | 1: Origin Story | The History of Rubinius

The History of Rubinius
As Told by Its Creator
by Evan Phoenix

During the winter of 2006, I got interested in the implementation of the Smalltalk language.
Following discussion with Ryan Davis about Ruby and Smalltalk, I decided to order the Blue
Book from Powell's Books online. The Blue Book is the holy bible of Smalltalk, containing
not only a complete introduction to the language, but also a sample implementation of the
language itself in the last few chapters. The intention of these chapters was to provide
the interested reader some details into how Smalltalk works at the lowest level, so they
could use the language well. To my eyes though, it was like opening the face of a watch to
see the gears turning. It was amazing, and proved to be the initial spark of life for
Rubinius.

(以下略)

■_

幸いまだこの辺で苦しんだことはない。たぶn

getaddrinfo() edge case behavior on Windows, Linux and OS X – klickverbot.at by David Nadlinger

getaddrinfo() edge case behavior on Windows, Linux and OS X

(略)

Host 	Port 	Flags 	Windows 	Linux 	OS X
null 	null 	- 	NONAME 	NONAME 	NONAME
  	AI_PASSIVE 	NONAME 	NONAME 	NONAME
  	"" 	- 	loopback 	loopback 	NONAME
  	AI_PASSIVE 	catchall 	catchall 	NONAME
  	"0" 	- 	loopback 	loopback 	loopback
  	AI_PASSIVE 	catchall 	catchall 	catchall
  	"80" 	- 	loopback 	loopback 	loopback
  	AI_PASSIVE 	catchall 	catchall 	catchall
"" 	null 	- 	public 	NONAME 	NONAME
  	AI_PASSIVE 	public 	NONAME 	NONAME
  	"" 	- 	public 	NONAME 	NONAME
  	AI_PASSIVE 	public 	NONAME 	NONAME
  	"0" 	- 	public 	NONAME 	loopback
  	AI_PASSIVE 	public 	NONAME 	catchall
  	"80" 	- 	public 	NONAME 	loopback
  	AI_PASSIVE 	public 	NONAME 	catchall
"localhost" 	null 	- 	loopback 	loopback (v4) 	loopback
  	AI_PASSIVE 	loopback 	loopback (v4) 	loopback
  	"" 	- 	loopback 	loopback (v4) 	loopback
  	AI_PASSIVE 	loopback 	loopback (v4) 	loopback
  	"0" 	- 	loopback 	loopback (v4) 	loopback
  	AI_PASSIVE 	loopback 	loopback (v4) 	loopback
  	"80" 	- 	loopback 	loopback (v4) 	loopback
  	AI_PASSIVE 	loopback 	loopback (v4) 	loopback
hostname 	null 	- 	public 	loopback (v4) 	public
  	AI_PASSIVE 	public 	loopback (v4) 	public
  	"" 	- 	public 	loopback (v4) 	public
  	AI_PASSIVE 	public 	loopback (v4) 	public
  	"0" 	- 	public 	loopback (v4) 	public
  	AI_PASSIVE 	public 	loopback (v4) 	public
  	"80" 	- 	public 	loopback (v4) 	public
  	AI_PASSIVE 	public 	loopback (v4) 	public

getaddrinfo() behavior on Windows Server 2008 R2, Arch Linux (Kernel 3.1.4, glibc 2.14.1), and OS X 10.7.2 (Lion).

■_

reddit で500overの反応があった記事

Dear Boss: For a programmer, 10 minutes = 3 hours - edw519


Dear Boss: For a programmer, 10 minutes = 3 hours

10:48

Boss: Hey Ed, Sue in Detroit says that sometimes, the wrong Invoice Part Number is showing
      up on the Product History Screen. Can you help us figure this out.

Ed: I'm busy with something else at the moment. Put the ticket in my queue.

Boss: This will only take 10 minutes.

Ed: Are you sure about that?

Boss: Yes. I'll just set up a web conference. Sue can show you right away, then you can
      look into it when you have time.

Ed: OK.

Boss: Great. Check your Outlook for an invite.

(略)

1:48

Boss: OK, this sounds like a problem. It looks like I'll have to escalate this to the
      Steering Committee. I'm glad you had 10 minutes to spare. Thanks.

(Ed continues to read Hacker News in another tab.)

ちゃんちゃん。 詳しい顛末は元記事をどうぞ

Dear Boss: For a programmer, 10 minutes = 3 hours : programming

Crucially, when the boss first says "This will only take 10 minutes", he 
means 10 minutes of his time, not yours

"This is just a simple feature to add in; we're only changing 3 fields. Shouldn't 
take more than 30 minutes."

... and running items on a 3rd party database with no API provided, changing the data 
that is being sent, and turning that into 3 service calls instead of 1, to "speed 
things up a bit".

2 hours later: "Why isn't this done yet?! Don't bill for more than 30 minutes; I 
already told the client that's how long it would take."

My running joke at work when someone asks how long it would take to get a minor change done.

    1 minute to make the change
    1 hour to test
    1 day to get it into QC
    1 week to get someone to sign off on UAT
    1 month to get someone to sign off on PROD

An exaggeration that isn't too far off from reality.

■_ こーどれびゅー

こういうのは全文きっちりやったのほうが良いのかな

ShipSolid - Software Consulting

You Need a Code Review (あなたにはコードレビューが必要だ)

Alex Bartlow 

2012-02-05 
 
On many of my projects, I have the pleasure of working with a team of highly skilled 
developers and designers to deliver a working, finished application. Many of these 
developers are shocked when I often ask for code reviews, or use a pull-request on 
github to deliver a feature, instead of just pushing it into master. It seems that I'm 
regarded as a senior developer, that should be above such formalities that prevent 
junior developers from making a build-breaking change, and as such, I should resent 
the idea of someone else auditing my changes. 
 
I don't resent it. I need it. I need a code review, on every significant commit. 

■_ 温故知新

Simula - Wikipedia INTRODUCTION TO SIMULA Cim for Windows An Introduction to Programming in Simula

なんか動く処理系があるっぽいのでやってみようかという気になりつつある

■_

Twitter / @y_shindoh: grep vs. Awk: http://t.co/ ... Hena Hena Nikki ~悔い倒れの日々~(2012-02-08)

Twitter / @y_shindoh: grep vs. Awk: http://t.co/ ...

grep vs. Awk: quruli.ivory.ne.jp/diary/?date=20… 「GNU grepよりGNU Awkの方が速い!」
という噂を聞いて試してみた。 ちなみに、この結果と正反対の結果が手元のGnuWin32環境では出
たので、環境によってかなり違うと見た方が良さそうだ。

バージョンによって正規表現ライブラリが入れ替わったり(grep)、 インタープリターがバイトコード形式になったり(gawk)で その辺の条件を明確にしないと同じ比較ができないような。

■_ 百万の

Clang: Defending C++ from Murphy's Million Monkeys | GoingNative 2012 | Channel 9 Clang: Defending C++ from Murphy's Million Monkeys : programming Murphy's とあるのは何か深い意味があるんだろうか それはともかく、音声のみのダウンロードもできるっぽいのでそれを聴いてみよう。 初日のキーノートやらも含めると聴くための時間がとんでもなくかかるけど。

Clang: Defending C++ from Murphy's Million Monkeys | GoingNative 2012 | Channel 9

Were we to craft a Lenox Globe of programming languages, C++ might be followed by a famous
cautionary phrase: Here Be Dragons. The language can be complex and daunting to programmers
who are often shouldered with the task of writing large, complex programs. Those millions of
code monkeys need help to resist Murphy's siren song and navigate C++'s treacherous waters
of memory corruption and concurrency bugs.

(略)

code monkey と Murphy's siren song やらからでてきたのかな>百万匹の猿

初日のキーノート。 Day 1 Keynote - Bjarne Stroustrup: C++11 Style | GoingNative 2012 | Channel 9

Day 1 Keynote - Bjarne Stroustrup: C++11 Style | GoingNative 2012 | Channel 9

We know how to write bad code: litter our programs with casts, macros, pointers, naked new
and deletes, and complicated control structures. Alternatively (or additionally), we could
obscure every design decision in a mess of deeply nested abstractions using the latest
object-oriented programming and generic programming tricks. Then, for good measure, we
might complicate our algorithms with interesting special cases. Such code is
incomprehensible, unmaintainable, usually inefficient, and not uncommon.

わたしたちはひどいコード (bad code) の書き方を知っています。
自分たちのプログラムを、キャストやマクロ、ポインター、素の new や delete、それに
複雑な制御構造であふれさせること。です。


■_

2012年02月07日

■_

昨年大晦日に手に入れられなかったアイツが委託されたので COMIC ZIN 通信販売/商品詳細 インフラエンジニア双六 買ってきました。 いけね。証拠写真撮ってないw

■_ 配列(リスト)の添字

PowerShell でリストスライスを取り出そうと $ary[5..-1] として予想外の動作をしてびびる。

Ruby、Python もこれとそれぞれ違って混乱したり。 どれがいい、他はだめということではないのだけど悩みの種ではある (複数使うほうが悪い?)

PS > $ary="a b cd e f g".split(" ")
PS > $ary
a
b
c
d
e
f
g
PS > $ary[0..7]
a
b
c
d
e
f
g
PS > $ary[4..7]
e
f
g
PS > $ary[-4..-1]

d
e
f
g
PS > $ary[4..-1]
e
d
c
b
a
g

減少方向もいけるのね。

PS > 4..-1
4
3
2
1
0
-1
PS > -4..-1
-4
-3
-2
-1

■_ "Programmer" is an Overgeneralization

一般化されすぎということ? > Overgeneralization

Erik McClure: "Programmer" is an Overgeneralization

February 5, 2012
"Programmer" is an Overgeneralization

    "Beware of bugs in the above code; I have only proved it correct, not tried it." - Donald Knuth


Earlier today, I came across a post during a google-fu session that claimed that no one
should use the C++ standard library function make_heap, because almost nobody uses it
correctly. I immediately started mentally ranting about how utterly ridiculous this claim
is, because anyone whose gone to a basic algorithm class would know how to properly use
make_heap. Then I started thinking about all the programmers who don't know what a heap
is, and furthermore probably don't even need to know.

今日わたしは、それを正しく使える人がほとんどいないのだから C++ の標準ライブラリ
関数にある make_heap は誰も使うべきではないという主張を google-fu session の間に
post しました。
basic algorithm class を理解しているような人であれば make_heap の適切な使い方を
知っているでしょうから、わたしは即座にこの主張がまったくばかげているものであることを
mentally ranting しました。
それからわたしは、ヒープがなんであるかも知らず、
それが何のためにあるのかすらも知らないであろう
プログラマーすべてについて考えはじめました。

Then I realized that both of these groups are still called programmers.

そうして、プログラマーにはそういった二つのグループがあるのだということを認識するにいたりました。


Copyright ©2011 Erik McClure. Powered by Blogger.

■_

Four Levels of Idea Theft

Four Levels of Idea Theft
アイデアの剽窃の4レベル

Imagine you've just seen a tremendously exciting piece of software--a mobile app, a 
web app, a game--and your immediate reaction is "Why didn't I think of 
that?!" With your mind full of new possibilities, you start on a project, a 
project enabled by exposure to the exciting software. What happens next is up to you. 
How far do you let your newfound motivation take you?

Borrowing specific features.

General inspiration.

Using the existing product as a template.

Wholesale borrowing of the design.

■_

2012年02月06日

■_

Amazon さんから Kindle touch 買わない? と販促メールが

■_

続編。 code examples ということでそういう話でした。

Why I love Common Lisp and hate Java, part II – code examples « Piece of mine

Why I love Common Lisp and hate Java, part II – code examples

Writing programs that write programs.This is a sequel to my previous post where I urged
those who gave up on programming — probably because of the spoon-fed association with Java
and stress — to give coding another chance with a whole “new” (read: different) approach:
Common Lisp. The purpose of this sequel is to address the open-minded skeptic, unconvinced
yet unafraid of paradigm-shifting change. Common Lisp is not just another language, it is a
different way of coding.

While I tried to make a point that the REPL completely alters the experience of coding 
— which can only be experienced and not by reading a blog post — this time I will try 
to showcase Common Lisp's powerful meta-programming through some example code.

Writing programs to write programs is mind-boggling if you come from the imperative world
of Java. Simply because it is not possible in Java, therefore not taught, hence not even
considered as a powerful way of abstraction and code reduction. We write methods and
functions to abstract away reoccurring computational patterns. Why not write functions
that take the abstraction level even higher and abstract away coding patterns?

(以下略)

■_

NSApplication プログラムの作成 XO: 再:CarbonかCocoaか?

Cocoa での hello, world 的プログラムってどんなんだろうと疑問に思いつつちと調べた。 Windows、昔の Mac OS のように自分でディスパッチするのではないのね。 X のメッセージはどう処理してたっけ?

■_

■_

仕込みの時間が欲しい…

2012年02月05日

■_

文庫化
結構いろいろな本が文庫化されてたようです。 ハードカバーでは…という人もどうでしょうか 「みんなの意見」は案外正しい (角川文庫) これからの「正義」の話をしよう (ハヤカワ・ノンフィクション文庫) 文庫 銃・病原菌・鉄 (上) 1万3000年にわたる人類史の謎 (草思社文庫) 文庫 銃・病原菌・鉄 (下) 1万3000年にわたる人類史の謎 (草思社文庫)
アレやらアレは文庫化されるんだろか。

昨日買った本やら
2週間でできる! スクリプト言語の作り方 (Software Design plus) グレイトフル・デッドにマーケティングを学ぶ 日本語入力を支える技術 ~変わり続けるコンピュータと言葉の世界 (WEB+DB PRESS plus) つながらない生活 ― 「ネット世間」との距離のとり方 Codermetrics: Analytics for Improving Software Teams 絵で見てパッと言う英会話トレーニング 基礎編 (語学書 単品)

■_

■_ 丸め

を丸投げ。 洒落になっとらんな。

javaでの金額の丸めについて(至急、お願いします | OKWave

javaでの金額の丸めについて(至急、お願いします

調べ方が足りていないのかもしれませんが、
わかりませんでした。教えていただけないでしょうか。

金額の丸め処理をしたいのですが、どのように書けばいいのかわかりません。
金額は、もちろんマイナス表記もあります。

100円単位の切捨て、切上げ、四捨五入
1000円単位の切捨て、切上げ、四捨五入

少数以下の処理は、いろいろとサンプルがあったのですが・・・・

どなたかご教授願います。

ANo.2

  class Q7283233 {
    public static void main(String[] args) {
      int c = 100;

      int n = 113;
      System.out.println((int)Math.floor((double)n / c) * c);
      System.out.println(Math.round((double)n / c) * c);
      System.out.println((int)Math.ceil((double)n / c) * c);

      n = 355;
      System.out.println((int)Math.floor((double)n / c) * c);
      System.out.println(Math.round((double)n / c) * c);
      System.out.println((int)Math.ceil((double)n / c) * c);

      n = -113;
      System.out.println((int)-Math.floor((double)-n / c) * c);
      System.out.println(-Math.round((double)-n / c) * c);
      System.out.println((int)-Math.ceil((double)-n / c) * c);

      n = -355;
      System.out.println((int)-Math.floor((double)-n / c) * c);
      System.out.println(-Math.round((double)-n / c) * c);
      System.out.println((int)-Math.ceil((double)-n / c) * c);
    }
  }
ANo.1


100円単位なら、元の金額を100.0で割ってから切り捨て・切り上げ・四捨五入の操作を行い、その結果を100.0倍する。

この回答者さんたちはわかってて質問者をからかっているのかそれとも(ry

■_ 翻訳むずい

大英帝国海軍の戦艦あたりの命名規則はなかなか理解しがたいものが (彼らにしてみれば、日本海軍の駆逐艦なんかはなんじゃそらだろうなあ)

ジャック・キャンベル ~彷徨える艦隊~ 2番艦c

623 名無しは無慈悲な夜の女王 [sage] 2012/01/09(月) 02:28:08.28 ID: Be:
    7巻表紙の女性は誰?
    デシャーニ大佐だよね?
    副題がドレッドノートだからジェーン・ギアリー大佐? 

624 名無しは無慈悲な夜の女王 [sage] 2012/01/11(水) 13:22:58.35 ID: Be:
    ドーントレス以外だと作中の活躍とリンクしてない名前だよね
    ヴィクトリアスってなんかやったっけ 

625 名無しは無慈悲な夜の女王 [] 2012/01/12(木) 15:39:15.58 ID: Be:
    日尼見ると、8巻のハードカバーとペーパーバックが同じ月に出ることになってるがおかしいな。

    翻訳の質はともかく、刊行中のシリーズに追いつきピッタリマークしてるなんてなかなかないな。 

626 名無しは無慈悲な夜の女王 [sage] 2012/01/12(木) 19:23:27.12 ID: Be:
    >>624
    戦艦の名前じゃなくてただの形容詞 

627 名無しは無慈悲な夜の女王 [sage] 2012/01/13(金) 01:36:41.43 ID: Be:
    >>626
    何が形容詞だって?

    彷徨える艦隊 旗艦ドーントレス
    彷徨える艦隊 2 特務戦隊フュリアス
    彷徨える艦隊 3 巡航戦艦カレイジャス
    彷徨える艦隊 4 巡航戦艦ヴァリアント
    彷徨える艦隊 5 戦艦リレントレス
    彷徨える艦隊 6 巡航戦艦ヴィクトリアス
    彷徨える艦隊 7 戦艦ドレッドノート

628 名無しは無慈悲な夜の女王 [sage] 2012/01/13(金) 01:59:52.75 ID: Be:
    帰還によって初期の目標を達成し勝利を得たではないか。
    艦名とその意味を掛けてるんじゃない?と思うのだが。

    1.Dauntless  不屈の
    2.Furious    怒り狂った
    3.Courageous 勇敢な
    4.Valiant     雄々しい
    5.Relentless  冷酷な
    6.Victorious  勝利を得た
    7.Dreadnought 恐れ知らず 

629 名無しは無慈悲な夜の女王 [sage] 2012/01/13(金) 03:26:47.16 ID: Be:
    >>628
    いや、そうじゃなくて >>626 は、
    >戦艦の名前じゃなくてただの形容詞
    と言った 

630 626 [sage] 2012/01/13(金) 04:16:59.38 ID: Be:
    形容詞だろ
    戦艦の名前とかけてるけどそれ自体はただの形容詞だろ 

631 名無しは無慈悲な夜の女王 [sage] 2012/01/13(金) 06:18:27.32 ID: Be:
    >>627
    原書のサブタイには「旗艦」だの「特務戦隊」だの「戦艦」だのといった単語は付いてません
    日本語版のタイトル付けた奴のチョンボ 

632 名無しは無慈悲な夜の女王 [sage] 2012/01/13(金) 08:35:51.55 ID: Be:
    「戦艦の名前とかけてる」のはみな理解してる。
    >>624 がいってるのは、
    「ドーントレス以外だと作中の活躍とリンクしてない」

    活躍じゃないけど撃沈されたのはあったと思う。

635 名無しは無慈悲な夜の女王 [sage] 2012/01/13(金) 22:33:50.60 ID: Be:
    まぁ軍艦の名前ってのは最重要な要素だと思うが、
    本の内容と関わってるのはその意味の方だ罠
    原書は読んだことないので俺には分からんけど、艦名の冠にH.M.Sみたいなのが付いてたら
    副題はもう純粋に形容詞だがw 

636 名無しは無慈悲な夜の女王 [sage] 2012/01/13(金) 22:37:30.20 ID: Be:
    書き込んでから気付いたが、theが付いてないから形容詞の方が主か 

637 名無しは無慈悲な夜の女王 [sage] 2012/01/14(土) 00:42:41.95 ID: Be:
    >>628
    故郷への生還で始まり凱旋で終わる第6巻に「Victorious」とつけるあたり、
    作中での艦の活躍よりは「形容詞」重視っぽいね。 

638 名無しは無慈悲な夜の女王 [] 2012/01/14(土) 05:37:30.61 ID: Be:
    普通にストーリー上のタイトルロールの艦と形容詞的用法上のダブルミーニングを狙ってるんだろ。
    タイトルロールの艦の活躍がちょびっとorほぼ見当たらない巻もあるし、
    それほど各巻ごとに大きな変化があるストーリーでもないけど。

    さて、これから巻名になりそうな艦名を拾ってみると
    Vengeance 復讐
    Vanguard 前衛
    Revenge 復讐
    Triumph 勝利

    次点で
    Majestic 堂々とした
    Brilliant 光り輝く

    こりゃなんじゃ?
    Intemperate 不摂生な

642 名無しは無慈悲な夜の女王 [] 2012/01/14(土) 13:29:57.81 ID: Be:
    >638
    やり過ぎ、の方が良いかも。
    呑んだくれって意味の方も捨てがたいがw

    異星人の脅威が明らかになると
    Redoubtable 恐るべき
    とか

    最終巻は
    Glorious 栄光ある
    だろうなぁ 

781 名無しは無慈悲な夜の女王 [] 2012/02/01(水) 13:11:25.95 ID: Be:
    ついでに

    艦隊が与えた損害をギアリーが見積もらなければならないが、今の時点では大虐殺としかいいようがない。

    now he had to figure out how much damage they had done. All he could tell at the moment was that the damage hadn't been the massacre it might have been.

    翻訳の無免許運転としか言いようがない。 

782 名無しは無慈悲な夜の女王 [] 2012/02/01(水) 13:44:58.81 ID: Be:
    逆だね。 

789 772 [sage] 2012/02/01(水) 17:02:38.63 ID: Be:
    >>781
    そこも「?」と思ったところだった。
    大した損害がないのに“大虐殺”とはこれ如何にと・・・

    >>778兄,>>779兄のおかげでスッキリしたよ。 

790 777 [sage] 2012/02/01(水) 20:36:13.73 ID: Be:
    やっぱり誤訳かよ!
    チェック体制とかどうなってんだ……返金ものだろ…… 

791 名無しは無慈悲な夜の女王 [] 2012/02/01(水) 20:54:33.96 ID: Be:
    景気悪い
     ->出版社: 経費節減
      ->翻訳のチェック無し(翻訳者まかせ)
       翻訳料も下げ
       ->翻訳者: 見直し最低限(細かいことやっとれん、出版社でやれよ)
        下訳料金も下げ(or 翻訳ソフトでもいいか)
        ->下訳者: 雑でもいいな(金に見合うし)、
         ついでに間違いも入れといたろ

    まさか、こんなじゃないだろうな... 

■_ Sorting algorithms used in the CL implementations

Sorting algorithms used in the CL implementations « Jorge Tavares weblog

Sorting algorithms used in the CL implementations

(略)

What sorting algorithms do the major open source CL implementations actually implement?
I was curious about it and went to check the source for ABCL, CCL, CLISP, CMUCL, ECL and
SBCL. Not surprising, we find some differences between the implementations. What it was
more unexpected to discover is that some implementations also use different sorting
algorithms according to the sequence type. A quick survey of the findings is summarized
in the following table (if anythings is incorrect, please tell me). The links for the
source code are in the implementation name (careful, in CCL and SBCL there are two links).

Implementation 	sort 	stable-sort
ABCL 	merge sort (lists) / quicksort 	merge sort
CCL 	merge sort (lists) / quicksort 	merge sort
CLISP 	tree sort 	tree sort
CMUCL 	heapsort 	merge sort
ECL 	merge sort (lists) / quicksort 	quicksort (strings + bit vectors) / merge sort
SBCL 	merge sort (lists) / heapsort 	merge sort

 
In terms of the implementation of sort, quicksort is the most used algorithm, followed by
heapsort. The choice for these algorithms is expected. Both have an average-case
performance of O(nlgn) and heapsort guarantees a worst-case performace of O(nlgn) too.
Quicksort has a worst-case performance of O(n2) but it can be optimized in several ways
so that it also gives an expected worst-case performance of O(nlgn). However, it seems
that the quicksort implementations are not completely optimized. In ECL (and ABCL)
quicksort implements a partition scheme which deals better with duplicate elements
(although is not the three-way partitioning) but it always picks as pivot the first
element. CCL chooses the pivot with a median-of-3 method and always sorts the smaller
partition to ensure a worst-case stack depth of O(lgn).

(略)

使われている度合いではクイックソートが一番というのはともかく、 続いてヒープソートってのは意外な気が。

■_ LANG=

わたなべさんのところから辿った元記事。 Re: テキストファイルをソートするときに頻繁に使うUnixコマンド - jarp,[O] テキストファイルをソートするときに頻繁に使うUnixコマンド で、 sort するときは LC_ALL=C sort を使わないと、環境によって結果が変わってしまう場合があるし、一定量以上のファイルをsortする際には、sort処理自体の速度もLC_ALL=Cありの方が速いです。 locale が C でない場合に処理速度ががた落ちになってしまうというのはおいといて (ありゃあ実装が以下略なところもあるような気がしないでもない。 といってきちんとしたコードを書くのも大変だろうなあ)、 sort するのに collating order 無視というのはどうなんだろうねえ。 まあ、基本的に文字コード順で不自由ないんだろうけど。

LC_ALL. LANG, LC_COLLATE その他の役割(とか影響範囲)ってあまり理解されてない? いやまあメッセージ出力のエンコーディングがどうこうはわかってるんだろうけど。

■_

600近くのコメントが → Dear Boss: For a programmer, 10 minutes = 3 hours : programming

■_

紀伊国屋書店新宿南店の洋書売り場も模様替えやらなんやらでCSの棚がだいぶ寂しく…

2012年02月04日

■_

GoingNative 2012 | Channel 9

codermetrics

洋書のスペースがさらに狭くなったジュンク堂で発見。 去年の8月に出ているもの (Codermetrics - O'Reilly Media) だったのか。 今までぜんぜんアンテナに引っかかってこなかったw 家に帰って確かめるまで、ずっと「codemetrics」と思い込んでました。 こんなサイトも → Codermetrics.org

んで、裏表紙にはこういう一文が Codermetrics is the Moneyball for software teams. Who would have thought that sports and software development had so much in common? The book is purposeful and thought-provoking -- a great read for any software team participant.

Codermetrics: Analytics for Improving Software Teams

容量が4GBってのだけでもいいなあ Kindle Touch WiFi モデルが日本からも購入可能に、139ドル -- Engadget Japanese

■_ チャート

これは自分も疑問に思ったことがあるんですが、なんでなんでしょうね。

スレ立てるまでもない質問はここで 116匹目

868 デフォルトの名無しさん [sage] 2012/02/04(土) 09:01:26.61 ID: Be:
    何で日本はチャートの事をグラフって教えるんだろうか。 

869 デフォルトの名無しさん [sage] 2012/02/04(土) 09:02:46.27 ID: Be:
    図のことをフィギュアとは言わないなあ。 

870 デフォルトの名無しさん [sage] 2012/02/04(土) 09:41:08.80 ID: Be:
    マならチャートとフィギュアを使うのは当然だよな。
    グラフなんて言ったら紛らわしいし。 

■_ 丸投げ

C言語での桁落ちの以下のプログラムを教えてください | OKWave

C言語での桁落ちの以下のプログラムを教えてください

C言語の本の問題で答えが書いてなく困っております。


f(x)=xの5乗-ルート(1+xの10乗)+1/{2×ルート(1+xの10乗)}の式が与えられ

x=0,1,2・・・50 における f(x) の値を求める場合のプログラムを教えてください。

注**そのまま計算した場合と式を変形して正確に計算した場合を比較せよ(一つのプログラムで両方計算).

何が分からないと?

補足

C言語での桁落ち::: f(x)=xの5乗-ルート(1+xの10乗)+1/{2×ルート(1+xの10乗)}の式
が与えられていてx=0,1,2・・・50 における f(x)のプログラムです。

丸投げっぷりは脇に置いといて、R は↓こーゆーことができるので好き :)

> fx <- function(x){x**5 - sqrt(1+x**10) + 1/(2*sqrt(1+x**10))}
> fx(1:50)
 [1] -6.066017e-02 -3.810975e-06 -8.711305e-09 -1.164152e-10 -4.150059e-12 -4.044512e-13 -7.689121e-13
 [8] -7.105427e-15  2.710343e-12  5.583029e-12  1.370892e-11  1.197672e-12  1.113648e-11 -2.059970e-11
[15] -8.846262e-12 -2.168404e-19  1.082057e-10  1.151358e-10 -1.664620e-10 -2.121925e-10 -4.295505e-11
[22]  1.614090e-10  3.840912e-10  3.947581e-10  9.085810e-10 -7.581706e-10 -5.443981e-10 -7.500674e-10
[29] -1.700046e-09 -1.775610e-09 -1.161735e-09 -6.617445e-24 -2.125002e-09  3.554049e-09  2.069262e-09
[36]  8.185052e-10  7.210434e-09  6.310329e-09  5.541751e-09  4.882813e-09  4.315695e-09  3.825811e-09
[43]  3.401165e-09  3.031842e-09  2.709614e-09  2.427621e-09  2.180122e-09  1.962293e-09  1.770067e-09
[50]  1.600000e-09
> gx <- function(x){1/(2*sqrt(1+x**10))-sqrt(1+x**10)+x**5}
> gx(1:50)
 [1] -6.066017e-02 -3.810975e-06 -8.711311e-09 -1.164153e-10 -4.092726e-12  0.000000e+00  0.000000e+00
 [8]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
[15]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
[22]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
[29]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
[36]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
[43]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
[50]  0.000000e+00
> (function(x){1/(2*sqrt(1+x**10)) - sqrt(1+x**10) + x**5})(1:20)
 [1] -6.066017e-02 -3.810975e-06 -8.711311e-09 -1.164153e-10 -4.092726e-12  0.000000e+00  0.000000e+00
 [8]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00
[15]  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00  0.000000e+00

式を変形して正確な値を求めるというのはこういうことですよね。 三つ目のはお遊び :)

■_ 生産性が十倍ならば

As a software development manager I have seen productivity vary up to 10x between developers, should pay also vary up to 10x depending on productivity? : programming が結構な伸び。

その話題の元

10x Productivity Myths: Where's the 10x Difference in Compensation? - 10x Software Development

10x Productivity Myths: Where's the 10x Difference in Compensation?

In response to my recent blog post on the research support for 10x productivity differences
among programmers, Pete McBreen made the following comment: 

    "One point in his article that McConnell did not address--programmer compensation
    does not vary accordingly. This is a telling point--if the difference is productivity
    can be 10X, why is it that salaries rarely fall outside the 2X range for experienced
    developers?" [emphasis in original] 

This is a good question. It's timely because the Software Engineering Productivity group
on LinkedIn has recently had a 130-comment discussion on the question of “Should pay be
tied directly to productivity?” It's also a question that I wrestled with personally for
about the first 10 years of my career. Indeed, it's part of the original reason I decided
to became self employed back in 1989 and eventually founded my own company in 1996.

The Intuitive Version of the Question

I started my personal “10x compensation quest” from the point of view of, “I know 
I'm 3-5x as productive as the guy sitting next to me. Why am I not making 3-5x as much 
money?” Over a period of many years I found that this formulation of the question 
embodied several assumptions that were naïve or just plain wrong from a business 
perspective.

Six Myths of 10x Compensation

Let's look at each of these myths of 10x compensation.


Myth 1. The guy next to me is getting paid what he's worth.
略
Published Jan 22 2011, 05:42 PM by Steve McConnell

■_ 問題

t1: Expressing integers using four nines :: Strangely Consistent

3 Feb, 2012
by Moritz Lenz

t1: Expressing integers using four nines

(This is a guest post by Moritz Lenz. If you're wondering what this is all about, it's 
the aftermath of The 2011 Perl 6 Coding Contest. If you're not wondering, it's still 
about that.)

Let's consider the first task from the Perl 6 Coding Contest 2011.

Here is the description of the task once more:

What non-negative integers can you write as expressions containing exactly four occurrences
the number 9, and any of the binary operators *, /, %, +, -, prefix negations, and any
number of matching pairs of parentheses you care to use?

9 が四つと二項演算子 *, /, %, +, -、前置の negation、任意個のカッコ対を使った
式として記述できる非負の整数
#よくわからん

The program should accept an upper limit N as a command-line argument. It should then print
all integers 0..N in increasing order, along with an expression with four nines, if any
such was found.

この問題はコマンドライン引数として上限値 N を受理すべきである。
0 から N までのすべての4つの9で表現できる整数を昇順に出力する。
#でいいのかな

It was probably the easiest of all tasks, and the one we got the most submissions for. Yet
there were still some things that could go wrong, and some submissions got some of them wrong:

    non-negative implies that we start at 0 = 9 + 9 - 9 - 9, not at 1
    1 からではなく 0 から開始

    integers means that the result must be an integer; it does not mean that intermediate
    results are automatically rounded or truncated
    結果は整数でなければならない。中間結果は自動的に丸められたり切りめられたりしない

    the expressions must consist of four times the number 9, not the digit nine. Thus 99
    is not a valid expression of two nines.

    式では数字の 9 ではなく、数値の9 を4つ含んだものでなければならない。
    したがって 99 は二つの9を使った vaild な式ではない


略

■_

■_

しかし池袋のジュンク堂、CS関連の洋書の棚をあそこまで削るとは… ○| ̄|_ 紀伊國屋書店も以前よりは面積減ってるしなあ。 どうすべえ。


過去の雑記帖

  1. 2012年2月(上旬)
  2. 2012年1月(下旬)
  3. 2012年1月(中旬)
  4. 2012年1月(上旬)
  1. 2011年
  2. 2010年
  3. 2009年
  4. 2008年
  5. 2007年
  6. さらに前
リンクはご自由にどうぞ。

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