ときどきの雑記帖 再起編

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

一つ前へ 2012年3月(中旬)
一つ後へ 2012年4月(上旬)

ホームへ

2012年03月31日

■_

いってきました
x86/x64最適化勉強会3 : ATND x86/x64最適化勉強会3に参加・発表してきました #x86opti - nokunoの日記 GCC -mtune 何やってるか 2012-03-31 - J melancholic afternoon

最近こっち方面ご無沙汰なのよね。うずうず。

コードレビュー テスト

■_ Iteratee とか

ひなたねこ: play.api.libs.iteratee

ひなたねこ: play.api.libs.iteratee

明日はPlay Framework 2.0 ソースコードリーディングの会でIterateeのところを任されたのでちょっと使ってみたり。

Iteratee
適当な説明

    Enumerator -> ストリーム
    Iteratee -> ストリームに対する処理
    Enumeratee -> ストリームの各要素に対する処理

以上!

ふうむ。

■_

■_

資料作りで以下略

2012年03月30日

■_

かくたにさんはあのスライド(複数)をどのくらいの時間でどうやって作ってんだろうと思いながら 某所で使う資料を作っている夜更け。

■_ これはひどい

How not to write python, Part 1. - Thanks Adobe. : programming から。

http://voxel.dl.sourceforge.net/project/malclassifier.adobe/AdobeMalwareClassifier.py にある

The BSD License

Copyright (c) 2012, Adobe Systems Incorporated
All rights reserved.

なコードを読んでみると… マジでこれ Adobe製?

■_ ソースコード発見

古のゲームのソースコードが見つかった。 という話で Prince of Persia creator finds lost source code 23 years later – Video Games Reviews, Cheats | Geek.com

Prince of Persia creator finds lost source code 23 years later – Video Games Reviews, Cheats | Geek.com

Jordan Mechner may not be a name many of you know unless you are up-to-date with your video
gaming history. He's probably better known as the creator of Prince of Persia.

(略)

Along the way, he managed to misplace the original source code for that first Prince of Persia
game and has been searching for it ever since.


Yesterday he found it, and the discovery is all thanks to his father. The three packs 
of  3.5″ Apple ProDOS disks had been safely stored away in a brown box along with a 
load of Amstrad copies of his 1984 game Karateka.


以下略

フォーマットやドライブの問題をさておいても、 時間のたったフロッピーディスクそのもの大丈夫なんだろうかという心配が。 環境の違いというのはあるだろうけど、 わりとカビが生えて使い物にならなくなった…というのはあるような。

■_

■_

2012年03月29日

■_

なんか面白そうなタイトルが(発売はまだ先) Amazon.co.jp: Safe C++: How to Lower the Bug Count of Your C++ Code: Vladimir Kushnir: 洋書 オライリーでのページはこちら Safe C++ O'Reilly Media

そいや、オライリーの正規表現本の新しいのまだだっけか。

■_

■_

■_ スタイルガイド

一部を

copycopter/style-guide

Programming

    Aggressively DRY code during development.
    開発の間、積極的にコードを DRY しよう

    Avoid abbreviations.
    略語を使わないようにしよう

    Avoid comments.
    コメントを排除しよう

    Avoid global variables.
    グローバル変数を使わないようにしよう

    Avoid long parameter lists.
    長いパラメーターリストを使わない

    Be consistent.
    一貫性を保とう

    Delete trailing whitespace.
    行末の空白を削除しよう

    Don't duplicate the functionality of a built-in library.
    組み込みライブラリの機能と重複させない

    Don't over-design.
    設計しすぎない

    Don't program defensively.
    防衛的にプログラムしない

    Don't use an empty line at the beginning or end of methods, blocks or conditionals.
    メソッドやブロック、条件の先頭や末尾に空行を置かない

    Don't vertically align tokens on consecutive lines.
    consecutive lines に対してトークンを垂直方向にそろえない

    Don't write more code than you need.
    必要とする以上のコードを書かない

    Exceptions should be exceptional. Don't suppress them or use them for control flow.
    例外は例外にしておく
    抑制したり、制御フローに使ったりしてはいけない

    Guesses at future functionality should not be designed into the application.

    Keep methods small.
    メソッドを小さく保つ

    Keep the code simple.
    コードをシンプルに保つ

    Limit lines to a maximum of 80 characters.

    Make sure all tests pass before code is merged into a shared repository.

    Name variables, methods, and classes with intention-revealing names..

    No spaces after (, [. No spaces before ], ).

    Order variables and methods alphabetically when possible.

    Prefer single function exit points unless the complexity of the code is greatly reduced by multiple returns.

    Treat acronyms as words in names (XmlHttpRequest not XMLHTTPRequest), even if the acronym is the entire name (class Html not class HTML).

    Use 2 space indentation (no tabs) unless otherwise noted.

    Use an empty line between methods, blocks and conditionals.
    メソッドやブロック、条件の間には空行を置く

    Use ASCII (or UTF-8, if you have to).
    ASCII (そうしなければならない場合には UTF-8) を使おう

    Use default iterators for languages/types that support them.
    言語や型がサポートしているイテレーターを使おう

    Use descriptive names that are both immediately obvious (to a new developer) and as short
    as possible without using abbreviations.

    Use implicit line joining where possible and indent continued lines.
    許されるところでは暗黙の行継続を使い、後続行をインデントしよう

    Use spaces around operators, after commas, colons and semicolons, around { and before }.
    演算子の周り、カンマやコロン、セミコロンのあと、{ の周りと と } の前にはスペースを置こう。

    Use standard language conventions for API documentation.

    Use Unix-style line endings (\n).
    Unix形式の改行を使おう

■_ Go 1

いろいろと反響が

Go version 1 is released | Hacker News

Congrats to the Go team! I've been looking forward to this release for a while. Go makes it
easy to do some very complex things, and much of this can be attributed to the wonderfully
built standard library.

For those interested, you can run Go apps on Heroku using this buildpack: 
https://github.com/kr/heroku-buildpack-go

Note: you may need to use the #rc branch until its changes are merged in master


I've been using Go for 2 years now. It's been a lot of fun. It certainly brought fun 
back into programming for me. Very happy to see the 1.0 release hitting the public. 
Congratulations to the Go team and contributors for a job very well done!


My god. Go is _so_ much fun to program. Apart from it's technical pedigree this is its 

most remarkable feature.

■_

reddit のほう。

Go version 1 is released : programming

This sounds like the world's best voodoo:

    We also restructured the Go tool suite around the new go command, a program for fetching,
    building, installing and maintaining Go code. The go command eliminates the need for
    Makefiles to write Go code because it uses the Go program source itself to derive the build
    instructions. No more build scripts!

I hope it either doesn't backfire, or isn't a huge hassle to debug when it does.


    This sounds like the world's best voodoo

Hehe, in that case you might not be surprised to hear the author of the Go tool is Russ Cox,
author of RE2 since quite a few people think regex is some kind of black art as well ;)

I am a level 30 regexer

That doesn't mean much though, just that I can properly escape most of my regexes, use
wildcards and pull a few other cheap tricks. Took me ages to get here though, and there are
more than 2300 known levels of regexing.

レベル30の regexer ってなんだろう…

■_

2012年03月28日

■_

月末付近は雑誌がたくさん。 他にあったかな

24日日経ソフトウエア
25日アフタヌーン ビッグコミック
26日ガンダムエース
27日乱 電撃大王
28日まんがライフMOMO まんがタイムきららキャラット
30日ヤングキングアワーズ

とはいえ、ダムエーと電撃大王はほぼ買わなくなったかな。 ダムエーはオリジンの連載が終わったからで、 電撃大王はよつばと!目当てなんだけど、厚すぎるってのが…

商売上手
Code Simplicity - O'Reilly Media 半額セールということで、新刊ででたこの Code Simpliciy といっしょに何冊か電書を。 日本のオライリーさんはこういうことやってくれないのかしらん。

C Java

コードレビュー

■_ swich

これを活用(悪用)した技があったと思うんだけどなんだったかな。 Duff の device はちょっと違うし。 C: switch with broken if, why does this work? : programming C code - 20 lines - codepad

C code - 20 lines - codepad

#include <stdio.h>

void main(void) {
   int a = 2;
   int b = 0;

   switch(a) {
      case 1:
      if(b==1) {
         puts("a");
         break;
   case 2:
      puts("b");
      break;
   default:
      puts("c");
      break;
   }
   }
}

実行結果を予想してみよう :)

■_ Steering Committee disbands

disband ってなんじゃろかと調べたりして The GNU C Library Steering Committee disbands : programming

The GNU C Library Steering Committee disbands - The H Open Source: News and Features

The GNU C Library Steering Committee disbands

GNU Logo Roland McGrath has announced that the GNU C Library (glibc) Steering Committee is
dissolving. The direction of the project will now be governed more informally by a team led
by the current maintainers.

glibc の運営委員会の解体をアナウンス。
プロジェクトの direction はもっと infromal な、メンテナーたちのチームによって決められる。

McGrath, who is the initial founder of the project, will be leading the development of the
project together with Joseph Myers and Carlos O'Donell. Ulrich Drepper, who, according to the
glibc web site, has had "overall responsibility for maintenance and development" of
the project up until now, is absent from this list. In his email, McGrath thanks both Drepper
and Jakub Jelinek, a member of the disbanded committee, for their years of work on the project
but, like Jelinek, other former members of the Steering Committee are not part of the new
governance group.

いろいろプロジェクトから離れる人がいるけれども、その中に Ulrich Drepper もいる。


略

これに対する反応もなかなか

The GNU C Library Steering Committee disbands : programming

The GNU C Library Steering Committee disbands (h-online.com)


    Ulrich Drepper, who, according to the glibc web site, has had "overall responsibility
    for maintenance and development" of the project up until now, is absent from this list

Good move, if too late. Drepper has been farcically dickish since forever; it blows my mind
that he was ever allowed to head a significant project.


Maybe we'll finally get strlcpy in glibc now.


In guile scheme community we do not have this problem. It is pretty solid. No complaining or
dicks. In fact no one makes or suggests anything at all.

This is the first comment of yours that has had me busting out laughing. More of this, 
less "<mentions guile scheme arbitrarily>" would be genius.

he'd be better off using Common Lisp ;-P


If I give you an upvote, will you send me a new keyboard to replace the one I just 
burst coffee on?


    Drepper has been farcically dickish since forever;

it takes a special kind of character for this sentence to be a severe understatement.

    it blows my mind that he was ever allowed to head a significant project.

personality aside, he knows his stuff, and is quite a competent developer. his paper on memory
(amongst a few others) is also a very useful read, higly regared for its informational value.

http://lwn.net/Articles/250967/


Osama bin Drepper, the world's only open source terrorist.


Surely you mean, Osama /bin Drepper.


what about Theo De 'Rant'?


He may have been an asshole, but he's damn good at what he does.

うるりっひがいなくなるから strlcpy が入るんじゃねえとか。

■_ 4巻

待ってる。期待はしてないけど。

【護衛艦隊】架空戦記総合スレ80【雷撃電光】

563 名無し三等兵 [sage] 2012/03/27(火) 21:54:57.14 ID:??? Be:
    パシストも書かれてから十数年経過か……早いなあ
    4巻目を待っている奴はさすがにいないだろうなあ 

三州公の突撃のその後も待ってる。

■_

■_ 1.0

The Go Programming Language Blog: Go version 1 is released だそうです。

2012年03月27日

■_

無事円盤ゲット。

電人ザボーガー スペシャルエディション(Blu-ray Disc)
電人ザボーガー スペシャルエディション(Blu-ray Disc)

電人ザボーガー スペシャルエディション [DVD]
電人ザボーガー スペシャルエディション [DVD]

■_ えにぐま

Excel のシートで実現してるっぽい。 Enigma Machine Spreadsheet - YouTube Enigma in a spreadsheet! Back in the summer of... - William Edwards, Coder

■_ R

ぐぐるさんがこのようなことを Google summer of code 2012 – and R – a call for students | (R news & tutorials)

List of projects

Project 	Description
hyperSpec 	Improve R's capabilities of working with spectroscopic and hyperspectral data.
Interactive Animations 	Make an animated, interactive plot to visualize high-dimensional time-series data
Image Labels 	Develop a framework for labeling plots using images instead of textual factor names
CRAN Stats 	Aggregate download statistics across CRAN mirrors to gain global view of R package ecosystem.
Interactive Web Graphics 	Allow the results of visualization analyses to be presented in the form of interactive applets on the web
Open Science Repository Interfaces 	Develop tools for visualization and exploration to enable broader practice of Open Science in R
KnitR Web extensions 	Extend the knitr package for better applications in the web so that web pages can be easily compiled
Finance: Bacon Performance Attribution 	Add portfolio performance and attribution functionality from Bacon to PerformanceAnalytics package
Finance: Advanced Risk and Portfolio Management 	Port Matlab code published by Attilio Meucci for risk and portfolio management to R.
Finance: Extend RTAQ 	Extend the RTAQ package with additional data interoperability and volatility measures.
Time Series: Extend xts 	Improve data subsetting approaches, visualisation, and data analytics for xts time series objects.
Disciplined Convex Optimization 	Implement an optimization modeling tool for R similar to CVX (Matlab) or CVXOPT (Python),
and apply standard solvers in R.
Alternatively, write an R package integrating the convex solver SeDuMi with R.
RMaxima 	Develop an R package interfacing the powerful and free Computer Algebra System (CAS) Maxima. The integration of Maxima with the Euler Toolbox will serve as paradigm.
Finance: Portfolio Performance Measurement and Benchmarking 	R code for Portfolio Performance Measurement and Benchmarking from Christoperson, Carino, and Ferson(2009)

■_ あとでチェック

Scala: Sink or Swim? Part 1 | zeroturnaround.com Scala: Sink or Swim? Part 2 | zeroturnaround.com Scala: Sink or Swim? Part 3 | zeroturnaround.com

■_

■_


Get-ChildItem -Recur . | ForEach-Object {$_.extension} | where {$_.length -gt 0} | Group-Object | Sort-Object -Property count,name | ForEach-Object {[string]::join(",", ($_.count, $_.name))}
Get-ChildItem -Recur . | ForEach-Object {$_.extension} | Where-Object {$_.length -gt 0} | Group-Object | Sort-Object -Property count,name | ForEach-Object {[string]::join(",", ($_.count, $_.name))}

めんどくせー

あ。エイリアス使ってないのはわざとです。はい。

2012年03月26日

■_

光る円盤

【怪奇の事件は】電人ザボーガーVol.4【Σの仕業】

343 どこの誰かは知らないけれど [sage] 2012/03/26(月) 20:57:39.89 ID:xwgyM5vk Be:
    尼で予約してた劇場版DVD(スペシャルエディション)の発送通知が来た!
    週末まったり見るのが楽しみだ。 

げ、あさって発売日なのにもう?

■_ C++ は

未来の言語 (language of future) か? 200以上コメントがあるので適当に

Is C++ the Language of the Future? : programming

Is C++ the Language of the Future? (claystuart.blogspot.com)


C++ will still be around in 50 years.

The problem is that most of the good alternatives are good languages, not good alternatives to
C++. There are a few like D, but they aren't compelling enough to be a killer alternative.

But the main question is about what we will see in 50 years. If C++ continues to be successful,
then it will be a very different language to the C++ of today (and I'd be disappointed if it's
not). If it does decline, then it'll be similar to what we have today, but with all the
DailyWTF type stories about maintaining legacy system stories mentioning C++ instead of COBOL
or Fortran (i.e. "X-Software Company is still using C++, can you believe that!?!?!").


C++ gives me a pretty good balance between productivity and power. I can write nearly 
declarative code using the STL and still have it run reasonably fast on the machine. And, if
I need to go extremely low level with void pointers and bit twiddling, I can do that too.

I can see it sticking around for a while.


May the performance be with you, always.


Writing C++ programs that use smart pointers make C++ a tad easier to program for than 
comparable Java programs. I am telling you this from experience, of course.

I know you hate C++, we have discussed this before. But please, take a chance to leave your
preconceptions out for a moment so as that we can have a discussion.

    What we need are better languages that compile to native machine code, not scripting
    languages, not virtual machines.

    I have never really understood the reasoning behind java etc.

GC.

Garbage collection is such an incredible boost to productivity and the ability to 
reuse code that it's worth giving up a lot to get it.

I disagree. GC is only really good for trivial problem sets, so it's a nice feature to have in
a junior/learning programming language, but it fails to fully solve the problem that it
purports to solve (that is to say, programming mistakes can still result in resources not
being released) and introduces its own set of problems (non deterministic object lifetimes,
unpredictable periodic spikes in CPU usage).

■_ Is C++ the Language of the Future?

↑のネタ元

例によって、見出しの辺りだけ抜き出すので 興味のある向きはぜひ元記事へ :)

Thinking Anthropologically: Is C++ the Language of the Future?

Friday, January 20, 2012

Is C++ the Language of the Future?

I've spent the last five years studying a wide array of different programming languages and
paradigms and here are the big trends that I think will matter most in the near future.

CONCLUSION

The trends of this essay suggest that the ideal programming language of the near future is
going to have the following characteristics:

このエッセイで述べてきた以上のようなトレンドは、近い将来における理想的なプログラミング言語
は以下のような特性を持ったものになるであろうことを示唆しています

    Good for distributed computing
    (分散コンピューティングに向いていて)

    Good at producing fast code for when distributed computing isn't  possible
    (分散コンピューティングができないときにも高速なコードを生成でき)

    Good at producing efficient code for saving on battery life
    (電池寿命を長持ちさせるような効率的なコードを生成でき)

    Good at producing small, stand-alone code for saving on bandwidth
    (帯域を節約するような小さく、スタンドアローンなコードを生成でき)

    Good at producing cross-platform code
    (クロスプラットフォームなコードを生成できるもの)

So who are the contenders?

(結論の肝心な部分は省略)

■_

■_

週末に向けていろいろと

2012年03月25日

■_

髪切った。 まだいいかなとも思ったのだけど、今度の土日はどちらも勉強会が入ってて 二週間後はどうかあなあという判断で。

■_ 発掘されたネタ

いつものように What is your favorite C programming trick? - Stack Overflow

What is your favorite C programming trick? - Stack Overflow

For example, I recently came across this in the linux kernel:

/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))

So, in your code, if you have some structure which must be, say a multiple of 8 bytes 
in size, maybe because of some hardware constraints, you can do:

BUILD_BUG_ON((sizeof(struct mystruct) % 8) != 0);

and it won't compile unless the size of struct mystruct is a multiple of 8, and if it 
is a multiple of 8, no runtime code is generated at all.

Another trick I know is from the book "Graphics Gems" which allows a single 
header file to both declare and initialize variables in one module while in other 
modules using that module, merely declare them as externs.

#ifdef DEFINE_MYHEADER_GLOBALS
#define GLOBAL
#define INIT(x, y) (x) = (y)
#else
#define GLOBAL extern
#define INIT(x, y)
#endif

GLOBAL int INIT(x, 0);
GLOBAL int somefunc(int a, int b);

With that, the code which defines x and somefunc does:

#define DEFINE_MYHEADER_GLOBALS
#include "the_above_header_file.h"

while code that's merely using x and somefunc() does:

#include "the_above_header_file.h"

So you get one header file that declares both instances of globals and function 
prototypes where they are needed, and the corresponding extern declarations.

So, what are your favorite C programming tricks along those lines?

結構プリプロセッサーマクロ駆使した技が目立ってるような気がする。

■_

発掘元

What is your favorite C programming trick? : programming

What is your favorite C programming trick? (stackoverflow.com)


Anything considered a "trick" should be regarded with deep suspicion in production
code. However, most of those questions aren't tricks, they're just parts of the langauge. Most
of them covered by any C book. e.g. FILE, c99 array initializers etc.

If you're learning things from that question then you either don't program in C (and this isn't
going to help you learn it); should go back to reading the original source materials you learnt
it from; or have genuinely stumbled upon a useful but non-obvious 'trick' (e.g. the #import for
struct definitions. xmp (or something similiarly named) image file format relies on that.

Many CPP tricks, few C tricks.


Duff's Device is both the most awesome and the most terrible C "trick" that I'm aware
of. In a "worst but at the same time most interesting abuse of the language" kind of way.

Duff の device は定番っちゃー定番ですね。 もうひとつ~の device ってあったような気もするんだけど思い出せない。

■_

あれやらこれやらやってたらネタ仕込む余裕もなくなったw

■_

2012年03月24日

■_

こういうのも訳して欲しいんだけど無理かな→ InfoQ: Titanic, COBOL and the 100 Year Platform

コンピュータのための数学―論理的アプローチ
コンピュータのための数学―論理的アプローチ
を明倫館で見かけたのだけど7500円だったので断念。 ム板のどこかで褒めてる記述を見た覚えがあるので気になったんだけど。

で、↑をAmazonで検索してみたら類書でこういうのが。 「翻訳がひどい」ねえ。中身は気になる。 Amazon.co.jp: 数学嫌いのためのコンピュータ論理学―何でも計算になる根本原理: マーティン ディヴィス, Martin Davis, 岩山 知三郎: 本

センゴク天正記の今やってる武田家の状況やら 新刊の出た大東京トイボックスを読んでいるとなんというかこう(省略されました)
大東京トイボックス (8) (バーズコミックス)
大東京トイボックス (8) (バーズコミックス)

アフタヌーン、ヒストリエはなし。

■_ MEAP

最近こういうのを買いまして Manning: Programming the TI-83+/84+

ほかにも結構気になるタイトルが Manning: PowerShell in Depth Manning: Functional Programming in Scala Manning: Scala in Depth

フォーマットがPDFだからちょっと躊躇するんだけどw

■_ 今日の一言

金。だよなあ。

WW2時の空母に関する雑談スレ22隻目

279 名無し三等兵 [sage] 2012/03/24(土) 10:35:30.66 ID:??? Be:
    みんなビンボが悪いんや!条約が無くても載せる人員のアテは無し!
    優秀な人材は陸軍と奪い合い、士官はそうそう増やせないし、母艦搭乗員もそうそう居ない。


    やっぱり戦艦で殴り合って負けた方がよかったんでは無いかなとか思い詰める私 

■_ 人気不人気

Poll: What's Your Favorite Programming Language? | Hacker News ハッカーニュース人気言語 - karasuyamatenguの日記

Poll: What's Your Favorite Programming Language? | Hacker News

Below are the most popular languages. If your favorite isn't below select other and 
comment what it is below.

Note: By voting for a language you are not up voting this poll. Please up vote this 
poll to keep it alive.

で、いろいろとプログラミング言語名が挙げられているのですが

Actionscript
	71 points
	
Ada
	17 points
	
Assembly
	75 points
	
C
	729 points
	
C++
	399 points
	
C#
	603 points

以下略

これが気にになる

Other
	163 points
  

言語リストのあとのやり取りもなかなか熱いものが

C# really feels like the most mature language that I've ever dealt with. Writing it feels
clear, if something is wrong the debugger is very clear. The number of features that are
there is incredible (especially post C# 2.0 when they added generics). Properties are
delightful.

How do you convert to a string? Convert.ToString(). How about an integer? Knowing only that
one, it's what you'd expect!

I also picked JavaScript because I am in a love affair with this weird little language. I
lso think it is one of the easiest languages to teach basic programming with (videos
forthcoming).

The amount of time it takes to whip up a five-cent program with javascript without even
leaving my browser, heck without even leaving this tab is just astounding to me even after
all these years.

One thing I noticed though while writing this comment is that more than the language itself,
the tools that I use while building things in the language are what really make them a
pleasure to use. If I wasn't using Google Chrome's web developer tools I'd probably consider
JavaScript to be a nightmarish corpse of a language that punishes the slightest of typos with
a silent malicious grin, as code execution carries on as if A.blah = 5 and A.blsh = 5 were
both equally worthy of existing to the JS compiler/interpreter. Only by the grace of tools is
JS tame at all.

■_

こういうのも Poll: What's Your Most Disliked Programming Language? | Hacker News 数字は変わっていくだろうけど、 これを書いている時点で目立ったのを挙げてみると

Poll: What's Your Most Disliked Programming Language? | Hacker News

Java
	370 points
	
JavaScript
	141 points
PHP
	308 points
Visual Basic
	232 points

ま、さもありなん。

I don't expect that the responses to this will be enlightening. In fact, I can predict right
now that the winner of this poll will be the most commonly-used language which isn't widely
considered to be "nice". Depending on the precise demographics of this site, that's
either going to be Java, C++ or Javascript, despite the fact that there are clearly worse
languages out there (Fortran, COBOL, Brainfuck...)

The reasoning is explained well in a post by Terence Tao [1] in the context of 'List of the
worst movie of all time'. Briefly, assuming that there is at least some correlation between
programming language quality and uptake of that language (which doesn't seem to be
controversial, especially among the users of HN) then you expect that languages which are
generally worse will not be used so much, and so there will be fewer people who are able to
vote for them as being "the worst".

For example, I have never used Delphi (to pick an example at random). I know literally nothing
about it. It could be a stinking ball of crud that irreparably crushes the soul of anyone who
tries to use it, but because it's not that popular, I've never used it, and so I'd never get
to vote it down for being the horrendous pile of fecal matter that it may well be (I repeat
again that I know nothing about Delphi, and it might be wonderful - I'm using it to illustrate
a point).

If you make some simplifying assumptions about the probability that someone has used a language
given its quality, then you can demonstrate that the language which will end up topping polls
like this is whichever one is "just good enough" to be popular - which in this case
means Java, C++ or Javascript.

[1]: https://plus.google.com/114134834346472219368/posts/TPjSPPd1...

■_ 歴史

文字コードの最初のやつ(Baudot code)知らなかった。 Encodings, Unicode and Erlang

Encodings, Unicode and Erlang

All you wanted to knowabout Character Encodingsbut were too afraid to ask 

Why are there so many different encodings?

What does all the terminology mean?

What do I need to keep in mind?

What is all this Unicode stuff anyway?

How does Unicode work in Erlang?

How do we switch our system to Unicode?

Encodings, Unicode and Erlang

In the beginning, there wasthe Teleprinter

Incoming characters are printed to paper

Keypress is sent to the remote teleprinter orcomputer (and printed on the paper, for feedback)

The first teleprinters were invented in the 1870s

Baudot code (5-bit, shifted state for letters/symbols)

■_

■_ 様子見

このへん

"Is C++ the Language of the Future? : programming" 
http://www.reddit.com/r/programming/comments/ra0pf/is_c_the_language_of_the_future/

"Teaching Python's "reduce" to a functional-style newbie : Python" 
http://www.reddit.com/r/Python/comments/ra1g8/teaching_pythons_reduce_to_a_functionalstyle/

"'Point-Free style: What is it good for?' - OJ's rants" 
http://buffered.io/posts/point-free-style-what-is-it-good-for

"Point-Free Style: What Is It Good For? : programming" 
http://www.reddit.com/r/programming/comments/rac73/pointfree_style_what_is_it_good_for/

"Function Pointers in C are Underrated — Vicky Chijwani's Blog" 
http://vickychijwani.github.com/2012/03/22/function-pointers-in-c-are-underrated/

"Function Pointers in C are Underrated : programming" 
http://www.reddit.com/r/programming/comments/r8ujk/function_pointers_in_c_are_underrated/

"Turning Your Code Inside Out" 
http://prog21.dadgum.com/131.html

"Turning Your Code Inside Out : programming" 
http://www.reddit.com/r/programming/comments/ra5ds/turning_your_code_inside_out/

"What is your favorite C programming trick? - Stack Overflow" 
http://stackoverflow.com/questions/599365/what-is-your-favorite-c-programming-trick/?

"What is your favorite C programming trick? : programming" 
http://www.reddit.com/r/programming/comments/r9zp5/what_is_your_favorite_c_programming_trick/

2012年03月23日

■_

フォークの歯はなぜ四本になったか 実用品の進化論 (平凡社ライブラリー)
フォークの歯はなぜ四本になったか 実用品の進化論 (平凡社ライブラリー)

↑ @nair3 さんの wishlist にあった本なんだけど、 本屋で見かけて自分も気になっていたのよね。

スペリオール
ガンダムのサイドストーリーの連載が始まったけど 同じ作者の MOONLIGHT MILE はどうなったんだろか

■_ Mad people of comp.lang.lisp

リストに載っている人知らない人ばかりだ…

Mad people of comp.lang.lisp

Mad people of comp.lang.lisp
Why? Because it amuses me.

(略)

This list can obviously never be complete, and in any case is merely the opinion of one person.
New entries are added at the start, and nothing is ever removed. People change their aliases
from time to time, so some of the searches here may not match tall their articles, or may match
articles by the wrong person. It's also possible that the same person has posted under
different aliases so some of these people may actually be the same person.

このリストは決して完成することはないだろうし、一個人の見解にすぎません。
新しいエントリーは先頭に追加し、取り除くことはしません。
人は自分の別名を時に応じて変えることがあるので、アーティクルと対応していないものが
あるかもしれません。あるいは間違った人のものになっているかも知れません。
また、同一人物が異なる複数の別名で投稿している可能性があり、


I haven't made any attempt to be complete, and there are few new entries after the 
start of June, 2003. For a while after 2003 there was a lower incidence of mad people, 
although unfortunately the number has now (2012) gone up significantly as has their 
unpleasantness: I suspect they will kill cll in due course.

namekuseijin 	From 2012, I think. Some kind of cohort of `WJ' perhaps, though it's unclear.

Ed Strolek 	From early 2012. This may be the same person or machine as Cthun: 
certainly he/it shows some of the same repetitive aggression.

Cthun 	From early 2011. Might not be a human based on some very formulaic & 
repetitive responses: if they are human they seem to be ill. Seems to have leaked in 
from some other group. May be the same as "Deeyana", and also someone who 
posts as "Seamus McRae"

(以下略)

reddit での反応からひとつ。

Mad people of comp.lang.lisp : lisp

For comparison, when I posted a question to C++ newsgroup (probably comp.lang.c++.moderated),
it was arrogantly dismissed because example I included used Microsoft Visual C++ standard
library (as that was a context where I had a problem). They told me to post to MSVC-specific
newsgroup instead, which I already did, with no success.

I then reformulated example to include only standard C++ features and made sure that it works
with g++ and problematic behaviour is reproduced. Still no useful reply.

I then asked on C++ IRC channel and got some bullshit for reply.

I finally got answer from my friend who is C++ expert, it turned out that it is a hole in
language semantics which doesn't let iostreams to interoperate smoothly with wide (wchar_t)
strings. Go figure.

If you ask something on c.l.l, you might get some joke in reply, but at least you'll have your
question answered. This is far more important for me than a lack of bad jokes.

なぜかC++の話が

■_

■_

それにつけても以下略

2012年03月22日

■_

欲しい
O'Reilly Japan - チーム「オライリー」グッズ第2段 - 2012年3月のWeb直販キャンペーン - Sales Information

が、買うものあったっけか。

■_ 来た

■_

■_

あとでよむ

Solarian Programmer | My programming ramblings

For your convenience, I've uploaded on github a binary version of Clang and GNUstep. My
recommendation is to compile it yourself as described in the article. If you need a quick way
to use Clang and GNUSstep, you can use the linked binary:
https://github.com/sol-prog/Clang_GNUstep_Objective-C_for_Windows 
 
If you want to start learning Objective-C on a Windows computer, you've come to the right
place. This tutorial will show you how to install a compiler and the necessary frameworks to
start hacking Objective-C on Windows today. Be warned that I'm not talking about developing
the next Objective-C iPhone/iPad application on Windows, this is not possible at the time of
this writing!

2012年03月21日

■_

ついったで Lisp のあの書式を「逆ポーランドの逆」と表現しているツイートを見かけて、 そういう見方をするのかーと感心してみたり。

バトルシップ
(公式サイト) をわりと楽しみにしている

■_ \ 地獄

これも繰り返し質問されるあれ。

bash - Find and replace "\" with sed - Stack Overflow


I am trying to do a find and replace with sed and BASH variables. As the replaced content
contains many / characters, I have used # instead of /, as is typically used in sed:

 sed -i "0,\#^$word#s##$replacement#" ./file

The item I want to replace contains the \ symbol:

 replacement=$(echo "\macro{some text}")

However, when I do the replacement, \ always disappears. I have tried these:

 replacement=$(echo "\\macro{some text}")
 replacement=$(echo "\\\macro{some text}")

No matter what I tried, the \ always disappears.

How can I do a find and replace with sed when \ is part of the replacement text?
Backslashes make life complicated

Life always gets tricky when you have the shell and sed both trying to interpret 
backslashes. In fact, it gets really painful.

Let's take a simple case: you want sed to replace the first backslash on a line by an 
at sign:

  sed 's/\\/@/' file

Note that we needed to specify two backslashes here, and because the command was in 
single quotes, the shell didn't do any interpretation for us — thank goodness!

Now, let's suppose we need to use double quotes instead of single quotes. Now we need 
to type:

  sed "s/\\\\/@/" file

Why? Because the shell first scans the string, and it sees backslash-backslash and 
translates that to a single backslash; and then it sees a second backslash-backslash 
and translates that to another single backslash. So, then sed gets to see the two 
backslashes and does what you wanted it to do.

You may have a /bin/echo on your machine (I do on mine, which is Mac OS X 10.7.3) 
which behaves differently from bash's built-in echo. I can get the following output 
(from /bin/bash):

  $ echo '\\' | sed "s/\\\\/@/"
  @\
  $ /bin/echo '\\' | sed "s/\\\\/@/"
  @\
  $ echo '\\' | sed 's/\\\\/@/'
  @
  $ /bin/echo '\\' | sed 's/\\\\/@/'
  @
  $ 

Let's throw another spanner in the works (my brain's hurting — how's yours coping?). I get a
different answer from /bin/sh (which is very similar but not identical to /bin/bash; the
difference is 64 bytes on disk, and both are bash version 3.2):

  $ echo '\\' | sed "s/\\\\/@/"
  @
  $ /bin/echo '\\' | sed "s/\\\\/@/"
  @\
  $ echo '\\' | sed 's/\\\\/@/'
  \
  $ /bin/echo '\\' | sed 's/\\\\/@/'
  @
  $

Yes, there's a difference. And now I'm confused!

In your discussion, you mention using:

replacement=$(echo "\\\macro{some text}")

This complicates life. You've got the shell processing that text, and bash's built-in echo
also processing the text. And if you use bash as sh you get one answer and if you use bash as
bash you get another answer.

When I tested with bash as sh, I found:

replacement="\\\\macro{some text}"   # 4 slashes, not 3

This gets two backslashes into $replacement. You can demonstrate that by running:

$ /bin/echo "$replacement"
\\macro{some text}
$ echo "$replacement"
\macro{some text}
$

So helpful...so, to get the $(echo ...) to produce two backslashes in the output when 
you subsequently echo it, you need no fewer than 16 (!) backslashes in the string:

$ replacement=$(echo "\\\\\\\\\\\\\\\\macro{some text}")
$ echo "$replacement"
\\macro{some text}
$

Beware: that applies to bash-as-sh; running bash-as-bash, you get:

$ replacement=$(echo "\\\\\\\\\\\\\\\\macro{some text}")
$ echo "$replacement"
\\\\\\\\macro{some text
$

Isn't life fun! So, to get this to work, you're going to have to preprocess your search
pattern and your replacement patterns rather carefully to get enough backslashes into each
one. How many? Ugh...

Test script

Here's a test script which I called, with stunning originality and explicitness of name, xx:

#!/bin/bash

echo "happy /word/ today" > file

word="/word/"
/bin/echo "word=<<$word>>"

replacement='\\\\macro{some text}'
/bin/echo "repl=<<$replacement>>"
echo "repl=<<$replacement>>"

/bin/echo sed -e "s#$word#$replacement#" file
sed -e "s#$word#$replacement#" file

echo
replacement="\\\\macro{some text}"
/bin/echo "repl=<<$replacement>>"
echo "repl=<<$replacement>>"

/bin/echo sed -e "s#$word#$replacement#" file
sed -e "s#$word#$replacement#" file


echo
replacement=$(echo "\\\\\\\\macro{some text}")
/bin/echo "$replacement"
echo "$replacement"
echo

replacement=$(echo "\\\\\\\\\\\\\\\\macro{some text}")
/bin/echo "$replacement"
echo "$replacement"

Test script run by bash-as-bash

This is the output from bash xx:

$ bash xx
word=<</word/>>
repl=<<\\\\macro{some text}>>
repl=<<\\\\macro{some text}>>
sed -e s#/word/#\\\\macro{some text}# file
happy \\macro{some text} today

repl=<<\\macro{some text}>>
repl=<<\\macro{some text}>>
sed -e s#/word/#\\macro{some text}# file
happy \macro{some text} today

\\\\macro{some text}
\\\\macro{some text}

\\\\\\\\macro{some text}
\\\\\\\\macro{some text}
$ 

Test script run by bash-as-sh

And this is the output from sh xx:

$ sh xx
word=<</word/>>
repl=<<\\\\macro{some text}>>
repl=<<\\macro{some text}>>
sed -e s#/word/#\\\\macro{some text}# file
happy \\macro{some text} today

repl=<<\\macro{some text}>>
repl=<<\macro{some text}>>
sed -e s#/word/#\\macro{some text}# file
happy \macro{some text} today

\\macro{some text}
\macro{some text}

\\\\macro{some text}
\\macro{some text}
$ 

Somewhere in amongst all that is (most of) the answer to your problem. To say I was surprised
to find this much difference between bash-as-bash and bash-as-sh doesn't begin to cover the
territory.

■_ Go

1.0rc1 がでましたが Why I don't want to use Go - Shaneal Manek's Blog

Why I don't want to use Go - Shaneal Manek's Blog

March 19, 2012

Why I don't want to use Go

There has been a lot of excitement about Go's upcoming 1.0 release - but I'm going to express
a controversial opinion: I don't really care and have no intention of using Go.

I'll grant that C is sometimes painful - I've often searched for a more 'modern' systems-level
language (with built-in decent implementations of standard datastructures, a well defined
memory model, cross-platform abstractions for things like I/O and concurrency, saner imports,
and a type-system strong enough to not require constant casts). D was fragmented last time I
looked, so C++ seemed like the obvious choice, and it's perfectly workable as long as you
limit yourself to the sane parts (although, I never really loved it - it's too big and
complex, and has too much C-cruft hanging around).

C が painful なことがあるのは自分も認めていて、もっと "modern" なシステムレベルの言語
それも 標準的なデータ構造、well defined なメモリモデル、入出力や並列性に対する
クロスプラットフォーム抽象、saner (まともな?) import、constant に cast を要求したりしない
十分強力な型システムを組み込みで実装されているものを探していた。
D や C++ にも満足しなかったと。


So, when Go was first announced, I was excited. Who wouldn't be by the prospect of a new
language for systems work by Pike, Thompson, et al? But after a few days of playing, I had
trouble figuring out what niche Go is supposed to fit into.

そういった状況だったから、Go のアナウンスがされたときには興奮した。
Pike や Thompson が関わっている新言語だし。
でも何日かいじってみたあとで、

(以下略)

理由は元記事を読んでのお楽しみ

■_ "Rockstar"

この辺で使われるんだけどどういうニュアンスなのか良くわからない → The Number One Trait of a Great Developer | Engine Yard Blog I will not learn Rails | Tyler Menezes

■_


一つ前へ 2012年3月(中旬)
一つ後へ 2012年4月(上旬)

ホームへ


リンクはご自由にどうぞ

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