■_
どうもこの出版社の本に対する情報が入ってくるのが遅いなあ。
入手元の問題だろか。
Amazon.co.jp: ECMA-262 Edition 5.1を読む: 竹迫 良範: 本
発売日: 2013/9/25
すぐじゃーん。
そういやYAPCの会場で竹迫さんと(二回ばかり)間近ですれ違ったんだけど、
shibuya.pm でわたしが発表したのは二年ちょっと前だったりしたので
気づかれなかった。いやまあこちらから声かけるべきなんですけどねねね。
一つ前へ
2013年9月(上旬)
一つ後へ
2013年9月(下旬)
どうもこの出版社の本に対する情報が入ってくるのが遅いなあ。
入手元の問題だろか。
Amazon.co.jp: ECMA-262 Edition 5.1を読む: 竹迫 良範: 本
発売日: 2013/9/25
すぐじゃーん。
そういやYAPCの会場で竹迫さんと(二回ばかり)間近ですれ違ったんだけど、
shibuya.pm でわたしが発表したのは二年ちょっと前だったりしたので
気づかれなかった。いやまあこちらから声かけるべきなんですけどねねね。
むかーーーーしとある雑誌で 「言語にとっての美とは何か」とかいった特集があったような。 あ、ここでいう「言語」は「プログラミング言語」のことね。
Perlは汚すぎる。Rubyは、まあ何でもできるけど面白くない。Pythonはいい噂をよく聞くけど、正直あの文法は慣れない。インデントを強制されるのも嫌だ。Schemeは覚えたいが・・・なかなか。
— Ryou Ezoe (@EzoeRyou) September 19, 2013
なんかこうまとめるキリョクが… とりあえず気になったのは飲食禁止なルールを守ってない人がちらほらいたこと。 理由はともあれ会場貸している側からの要望だしねえ。 ちょっと離れてたんでよくわからなかったけどなんか食ってるのもいたねえ (開場する前の入り口付近)。 あと「開放厳禁」の張り紙が貼ってある扉を開けようとしてた(たぶん)外国からの参加者がいたなあ。 まあこれはその「開放厳禁」が日本語でしか書かれてなかったからどうしようもないけど (こういうのも多言語化せんといかんのですかねえ)。 さすがに教えないとと思って近づこうとしたらすぐに諦めてたんでなにもしなかった。
今日はYAPC::Asia Tokyo 2013の1日目です - 北海道苫小牧市出身のPGが書くブログ
この辺が印象強かった。→ 正規表現の文字集合の演算
Python的な局所サブルーチン → my sub
Perl5.20 での新機能もなかなか。
チューリングの名前が書名にあるのでとりあえずちぇっく。
【11月の新刊・1】 田中一之『チューリングと超(メタ)パズル』。アラン・チューリングが晩年に執筆した記事「解ける問題と解けない問題」。本書は、その記事をモチーフにしながら、大きなパズルの世界を数学的な視点から描きます。 http://t.co/ZEhu7G7qkF
— 東京大学出版会 (@UT_Press) September 19, 2013
Edward C++Hands : haskell Edward C++Hands | Bartosz Milewski's Programming Cafe
Edward C++Hands | Bartosz Milewski's Programming Cafe Every programmer who’s serious about concurrency and parallelism should learn enough Haskell to understand how it deals with it. There is an excellent book by Simon Marlow, Parallel and Concurrent Programming in Haskell. After you read it, you will either start using functional techniques in your C++ programming, or realize what an impedance mismatch there is between parallel programming and an imperative language, and you will switch to Haskell.
挙げられている本はこれですね。 都内で読書会もやってたような。
kindle 版はこちら
Parallel and Concurrent Programming in Haskell: Techniques for Multicore and Multithreaded Programming
知らん間にこんな機能までついてたのか
Reference Counting and Object Harvesting in Delphi | Dr Dobb's
In the new compiler, the call to Free is replaced with the assignment of the variable to nil.
In the case where this was the last reference to the object, the object is removed from memory after calling its destructor.
If there are other standing references when Free is called, only the reference count is decremented.
盛り上がってるのであとで読む(実は元記事ちょっと読んだ) If You're Programming a Cell Phone Like a Server You're Doing it Wrong : programming High Scalability - High Scalability - If You're Programming a Cell Phone Like a Server You're Doing it Wrong
全然出版情報引っかからなかったんだけどなんでだ。
一昨日書泉ブックタワーで現物見かけた(買わなかったけど)。
プログラムはこうして作られる プログラマの頭の中をのぞいてみよう|書籍情報|秀和システム
世間一般のプログラム入門書には重大な欠陥があります。それはプログラムを自分で作るにはどのように頭を動かせばいいのかという根本の考え方を教えてくれないことです。
こういう切り口は良いと思うんですよね。
あー明後日からかー(前夜祭はカウントせず) YAPC::Asia 2013 に参加される全ての皆さんへ、タイムスケジュールと注意事項 | Things You Should Know Before Coming To The Venue | YAPC::Asia Tokyo 2013
なにやら
Material from the Rakudo and NQP Internals course | 6guts One aim of developing the course was to help with the state of documentation of the NQP and Rakudo internals. Typically at Edument, we only give out our material to those attending a delivery of our courses, and even then not the original source! However, for this course, we’ve made an exception and released the course material under a Creative Commons license. So, while I hope that we’ll be able to put together future “live” deliveries of the material for other new (or potential) contributors, this means it will now always be available to the community at large. :-)
書いてる内容がないよう
スピーカーに女性が少ないからカンファレンス行きたくないと文句を言っても状況は全然改善しないと思うんだが。
— Yukihiro Matsumoto (@yukihiro_matz) September 18, 2013
今回は匿名で選ぶやつだったから純粋に面白い提案出した人が選ばれたわけで、結果として女性が少ないのはしょうがないんじゃないかな。ということも踏まえて「いきたくないなあ」みたいなことだとしたら、これはかなり根が深い問題といいますか…もっと女性が増えるといいですよね…
— nari3 (@nari3) September 18, 2013
@nari3 踏まえて、ですよ。結果は「しょうがない」じゃなくて「良くない」ものであるという結論ありきなので、そんな結果にしかならないんだったらその選考方法は間違っている、という主張のようです。 https://t.co/bTSX423VR7
— Akira Matsuda (@a_matsuda) September 18, 2013
状況が断片的にしか分からないんだけど たぶん夜が明ける頃にはまた reddit とか HN でもりあがってんだろか。 ところで Ruby 以外のカンファレンスでこういう話題が出ることってあまりない?
stack overflow が5周年とかなんとか Five years ago, Stack Overflow launched. Then, a miracle occurred. : programming Five years ago, Stack Overflow launched | Hacker News
Creighton Kirkendall discusses how polymorphism is implemented in Clojure, Ocaml, Haskell and Scala.
The panelists discuss the future of the JVM in the context of parallelism and high concurrency of tomorrow’s thousands of cores.
まーとまらねー
天候がアレなので昨日今日とほとんど外出してなかったんですが 積ん読の解消もあまり進んでなかったり。 論文も家だとなんか読む速度が上がらないんだよなー。
.NETでメタプログラミング - L'eclat des jours(2013-09-16)
コミュニティによってブレ(日本語の訳語が複数あったりカタカナにしたり決定されていない)がある各種用語については初出の脚注で、
辞書的な意味やカタカナを使う場合と日本語を使う場合についての使い分けについて説明している
(基本的にはカタカナを使っているが、翻訳書を読んでいる多くの読者は、そもそもそのカタカナが通じない可能性があるわけだから、
元の綴りと辞書的な意味を示すのは良いことなのだろう)。
へー、ちょっと読んでみよう。
今年も行[かけ]なかったなあ。 なんか見えない壁を感じるんだよなあ(意識しすぎです) PyCon JP Blog: PyCon APAC 2013 in Japan が開催されました
例によって比べてみると面白い。 優秀すぎるスター開発者は会社にとって本当に必要なのか | スラッシュドット・ジャパン デベロッパー Ask Slashdot: Are 'Rock Star' Developers a Necessity? - Slashdot ところで 「Rock Star developer」を「(優秀すぎる)スター開発者」と訳すのはいいんだろかと 気になったり。
向こうのコメントの一つによれば
Ask Slashdot: Are 'Rock Star' Developers a Necessity? - Slashdot From Urban Dictionary: Rock Star Programmer - A computer programmer with such strong skills and so much specific experience that they are the equivalent of a rock star in the domain of software. Many people play guitar pretty well, but only a few become rock stars. These programmers can develop more software than 5 - 10 newly hired regular programmers because they know what needs to be done and how to do it. They also might set the architecture of the product that dozens will build upon. Usually associated with dot com websites. Usage: Jeff was the guy behind ebay.com He's a rockstar programmer. Yes they exist, typically large IT organizations have a few of them just in case. Many are like the fictional TV personality, House. If you can tolerate them, they are nice to have around for large, unsolvable problems that need to be fixed now. Many can deduce, diagnose, analyze, and fix things before your standard programmers can even formulate the problem. I have witnessed this on several occasions. If time is money, they are great insurance but be prepared for arrogance. The one I formerly worked with brought his dog to work and forced a fortune 500 company to give the dog a swipe badge. It was pretty hilarious.
わかったようなわからないような>後半
なんか見覚えあると思ったら
Reality for Windows developers: Users want Android, iOS apps | Mobile development - InfoWorld
The report was authored by Dimensional Research and sponsored by software development tools vendor Embarcadero Technologies.
こいつと情報元は同じなのね →
Developers Voice on Mobile Application Scenarios
で、それに対する反応。
Reality for Windows developers: Users want Android, iOS apps | Mobile development : programming
も1つ。Windows は FS 上の領域の存在と名付けをキチンと分離すべき…FILE_SHARE_DELETE は本質的解決には繋がってない。この問題と CreateProcess の問題で過去何度苦汁をなめたことか
— 眼力 玉壱號 (@objectxplosive) September 15, 2013
FILE_SHARE_DELETE ってなんだっけ? と調べてみると
CreateFile 関数 dwShareMode オブジェクトの共有方法を指定します。0 を指定すると、オブジェクトを共有できません。このハンドルを閉じない限り、それ以降にこのオブジェクトを開こうとしても失敗します。 オブジェクトを共有するには、次の値のいずれかまたは任意の組み合わせを指定します。 値 意味 FILE_SHARE_DELETE Windows NT/2000:これ以降、オブジェクトを開こうとしたときに削除アクセスを要求した場合のみ、その操作を許可します。 FILE_SHARE_READ これ以降、オブジェクトを開こうとしたときに読み取りアクセスを要求した場合のみ、その操作を許可します。 FILE_SHARE_WRITE これ以降、オブジェクトを開こうとしたときに書き込みアクセスを要求した場合のみ、その操作を許可します。
オブジェクトを開こうとしたときに削除アクセスを要求
ってどゆこと?
でさらに調べる
Use FILE_SHARE_DELETE in your shell extension | mg.to
Use FILE_SHARE_DELETE in your shell extension | mg.to There's an easy way to fix this for Windows NT, 2000, and XP. In the CreateFile() call that opens the file, use FILE_SHARE_READ | FILE_SHARE_DELETE in the dwShareMode parameter. The MSDN documentation doesn't make it clear at all, but FILE_SHARE_DELETE works with MoveFile() in the same way it does with DeleteFile(). In other words, it gives you Unix-style delete/rename semantics. Even while you have the file open, Windows can delete it or rename it right out from under you, but you can keep reading it—your handle to the file remains valid until you close it.
ああ、そういう。
しかしNT からあったとか全然記憶になかったわー
lsを読まずにプログラマを名乗るな!|書籍情報|秀和システム この本結構話題になっているっぽい。昨日今日のついったでもよく見かけたし。 はてなブックマーク - lsを読まずにプログラマを名乗るな!|書籍情報|秀和システム
藤原さんはSolarisのNFSやZFSなどの実装に詳しいファイルシステム界隈の人。内容凄そう。 / “lsを読まずにプログラマを名乗るな!|書籍情報|秀和システム” http://t.co/XG6BcejaaK
— Takumi IINO (@troter) September 16, 2013
最近、各種OSのlsの実装比較した記事なかったっけかと思ったら echo の間違いだった。 UNIX V5, OpenBSD, Plan 9, FreeBSD, and GNU coreutils implementations of echo.c
見かけたやり取り。
補完原理主義の人、ぼくの観測範囲だと C# の人とネオコン使ってる人に多い (後者はまあ因果関係が逆だ
— 斧 (@kikairoya) September 15, 2013
@kikairoya 逆ですね。補完に頼っている(覚えられない)からこそネオコン等を使うのです。C#, Java, Objective-Cだと識別子が長いし、クラス階層は複雑だし、補完に頼らざるを得ないんでしょう。幸い、それらの言語は比較的解析も簡単で便利なIDeも存在する
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 15, 2013
@ShougoMatsu 覚えてないような名前の(メソッド|メンバ|...)をどうして使おうという気になるのかが理解できないですね、それが何をするのかリファレンス見ないと分からないはずなのに
— 斧 (@kikairoya) September 15, 2013
@kikairoya 補完が前提の名前になっているからでは? あと、短い名前で合っても、一部分しか覚えていないという状況はよくあると思います。そういうときには補完候補を見て、それで思い出して入力できるならそのほうがリファレンス引くよりも高速ではないでしょうか。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 15, 2013
@ShougoMatsu 補完が前提の名前ってのがわからないですね、補完機能を期待できるかどうかに関わらずつけるべき名前はそれが何をするかによって定まるものでは (補完が期待できる場合長ったらしくなることを躊躇しない、程度はまああるかもしれない
— 斧 (@kikairoya) September 16, 2013
@kikairoya 補完を前提としていないのは、例えばstrcpy()ですね。これはstring copyではなく、strcpyという一単語で覚えていなければ出せません。「それが何をするのか意味する」という意味ではstring_copy()とでもなっていないとおかしいですよね。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 16, 2013
@ShougoMatsu それは補完とか以前の問題で6文字制限があった時代の名残です
— 斧 (@kikairoya) September 16, 2013
@kikairoya その6文字APIに限らず、UNIXの世界には単語の省略が多いですが、あれは補完を前提としていないからでは? シェルに補完が最初から実装されていたわけではないですし。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 16, 2013
@ShougoMatsu ストレージやメモリのサイズ、あるいはテレタイプの制限に由来する物を補完と結びつけるのは少々乱暴すぎるのでは
— 斧 (@kikairoya) September 16, 2013
@kikairoya 補完ができるようになったのはそもそもマシン『パワーが上がってきたからだと思います。自動補完はさらにリソースを食いますし。つまり、補完とマシン性能の話も関係があります。もちろんそれが全てではないと思いますけど。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 16, 2013
@ShougoMatsu 関係はあるけど因果関係が逆です
— 斧 (@kikairoya) September 16, 2013
@kikairoya 私が考えているのは、6文字制限時代の古い仕様と補完を前提としていない省略記法がうまくマッチしたんじゃないかという事です。もちろん制限としては6文字の方が先でしょうけど。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 16, 2013
@ShougoMatsu 補完を前提としなくても省略しない名前を付ける習慣は普通にあったのでは ( Microsoft が IntelliSence を実装したのは 96 年の VB5 からで、Windows API の命名規則は 16 ビット時代以降特に変わっていないはず)
— 斧 (@kikairoya) September 16, 2013
@kikairoya 確かに、Windows APIの識別子はやたらと長いですね。とはいえ、MS-DOS時代の識別子は短かったですが。あの間に方針転換があったんでしょうね。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 16, 2013
@kikairoya Windows Power Shellなんかも識別子は長いですね。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 16, 2013
@ShougoMatsu MS-DOS は CP/M とかの流れを汲んでいるはず (この辺は伝聞でしか知らない) なので更に10年以上遡りますね
— 斧 (@kikairoya) September 16, 2013
@ShougoMatsu あれはまあ .NET からの輸入なので長くて当たり前というかまああれです
— 斧 (@kikairoya) September 16, 2013
@kikairoya 今思い出したんですが、MS-DOS時代も後半にはIDEもどきなエディタが登場していて、それが補完機能をもっていたのかもしれないです。あとは新規開発者への分かりやすさを優先したのかも知れませんが……。補完がないと辛いAPIなのは確かですね。
— 暗黒美夢王(Shougo) (@ShougoMatsu) September 16, 2013
「原理主義」とはどういう意味でしょうか - お気軽Q&A [原理主義]の意味をわかりやすく教えてください。 | 国語のQ&A【OKWave】
ひさびさの重箱の隅。
バーチャルパネル: 低レイテンシ環境でJavaを使う Q2: Javaを使う利点として、豊富なライブラリ、フレームワーク、アプリケーションサーバなどへのアクセスや、使える プログラマが多いことが挙げられます。こうした利点は低レイテンシコードにも当てはまるのでしょうか? もし当てはま らないなら、C++よりも何か利点はあるのでしょうか?Thompson氏: Javaで書かれた低レイテンシシステムは、サードパーティ製ライブラリや、標準ライブラリすら使っていな いことが多いです。これには大きく2つの理由があります。1つは、多くのライブラリはパフォーマンスを考慮して書かれ ておらず、スループットや応答時間が不十分であるためです。もう1つは、並行動作にロックを使っていることが多く、 大量のGCを引き起こすためです。ロックの競合とGCのために、応答時間はかなりばらついてしまいます。 Javaは言語のなかでもツールのサポートがすぐれており、生産性を大きく高めてくれます。取引システムを構築する場合、 市場に出すまでの時間が重要な要件であることが多く、Javaを使うことで開発期間を短縮することができるでしょう。
Virtual Panel: Using Java in Low Latency Environments Thompson: Low latency systems written in Java tend to not use 3rd party or even standard libraries for two major reasons. Firstly, many libraries have not been written with performance in mind and often do not have sufficient throughput or response time. Secondly, they tend to use locks when concurrent, and they generate a lot of garbage. Both of these contribute to highly variable response times, due to lock-contention and garbage collection respectively. Java has some of the best tooling support of any language which results in significant productivity gains. Time to market is often a key requirement when building trading systems, and Java can often get you there sooner.
「大量のGCを引き起こす」って原文にはないと思うんだけど。
they generate a lot of garbage
は (GCの対象となる)ごみを大量に作るのであって、
それによってGCがどのように起きるか(そりゃあゴミの量に比例はするでしょうけど)は書いてないんじゃないでしょか。
Ken Thompson の regexp のつづき。 Implementing Regular Expressions にいろいろと。 ここ、前にも見てるはずなんだがなあ。
Implementing Regular Expressions Ken Thompson, “Regular expression search algorithm,” Communications of the ACM 11(6) (June 1968), pp. 419–422. http://doi.acm.org/10.1145/363347.363387 (PDF) The first efficient regular expression search. Four pages but dense: every time I read it I learn something new. Take an IBM 7094 cheat sheet with you. See also old slides from a lecture about the paper.
一つめのが前に紹介したやつ。 んで、old slides のリンク先(上記引用ではリンクになってません)を見ると色々解説が。 あと IBM 7094 について。 こいつ Lisp が最初に実装された 709 と近いのね。道理でレジスター構成に見覚えが。 IBM 7094 Cheat Sheet んで、
IBM 7094 Cheat Sheet ACL addr add and carry logical word: AC <- AC + M[addr] AXC addr, index address to index complement: XR[index] <- 215 - addr (note that addr, not M[addr], is being used.)
いろいろな命令で、オペランドの complement を~ ってなってるんだけどなんでわざわざ complement とってるのかわからんちん。 add and carry ってのも add with carry とは違うんだよね。たぶん。 IBM 7090/94 Architecture Home Page IBM 709 - Wikipedia
実写版パトレイバー。 押井メルマガでちょっと話がでてきたんですが、25日になにやら発表のイベントがあるとか
折りたたみ傘。 デパートやらの傘袋に入れるのもサイズがあわないし、 傘立ても… ということで使用済みの折りたたみ傘はどうするのがよいのでしょー。 なんか「格納袋」つきの折りたたみ傘ってのをどこかで見かけた気がするのだけど
7 Ways More Methods Can Improve Your Program | Henrik Warne's blog
7 Ways More Methods Can Improve Your Program | Henrik Warne's blog A lot of code I come across consists of relatively few, but long, methods. The code does what it is supposed to do. However, it could be improved a lot. Refactoring to use more methods can produce better structured programs that are easier to understand, easier to modify, easier to test and easier to debug. Below are 7 reasons why using more methods can be a good idea.
七つの項目は以下の通り。詳しくは元記事。
これ、もうちょっと面白い書き方できると思うんだけど面倒なのでやらない Ruby での日付のあらわし方について | RubyのQ&A【OKWave】
この記事はすぐにでも訳されるかなあ Developers Voice on Mobile Application Scenarios
Developers Voice on Mobile Application Scenarios Embarcadero Technologies in collaboration with Dimensional Research recently conducted a global survey comprising of over 1300 Windows developers from around the world to measure their interest in the rapidly changing mobile application development. These developers comprised of those who have experience in the development of Windows based applications.
お、このパラグラフは
Developers Voice on Mobile Application Scenarios I can't believe this but as per the tabulated survey results, nearly 83% of Windows developers prefer Android platform and only 33% vouched for Windows Phone. Apple iOS was positioned at 67% and placed in the second spot. While 14% of developers preferred blackberry, only 4% voted for other platforms such as Symbian. Nearly 83% of developers preferred Android platform for the development of mobile apps for their users. The results have been divided among those with and without mobile responsibility.
三菱東京UFJ。 ATM (コンビニに設置のそれを含む) での現金引き出しや振り込みのときの料金改定 とかでお手紙が。 話には聞いてたけどずいぶんとまあ変わるのねえキツイ方に。
待ち行列。 某書店1Fのレジの順番待ちで、前に人が全然いない状態で会計始めたら(レジ自体はほぼ埋まってたけど) 終わる頃には待ち行列が結構な長さになっててびっくり。 ポアソン分布やら指数分布を使って…となるのは職業病w G/G/1型<待ち行列<オペレーションズ・リサーチ<Web教材<木暮
これ、全体の数(N=421)は明示されてるけど各言語のNがわからないのにその正解率やら(平均の?)回答時間やらを比較してよいものなんだろか
.,,..,,,,_ / ,’ 3 `ヽーっ l ⊃ ⌒_つ `’ー—‐””’”
プログラマーの日 Programmers' Day - Wikipedia, the free encyclopedia
irb(main):012:0> Time.now.strftime("%j") => "256"
こっちの方がいいか
irb(main):022:0> Time.local(2013,9,13).strftime("%j") => "256"
なんかこう、書き方がおとなしくなった? 9月プログラミング言語人気 | マイナビニュース とりあえず見出しだけ列挙。
C/Objective-C下がる - TIOBEプログラミング言語人気調査 [2013/8/9] 7月プログラミング言語人気 - PHP急上昇 [2013/7/9] 6月プログラミング言語人気 [2013/6/11] C言語、人気継続で1位 - 5月プログラミング言語人気 [2013/5/10] C言語、人気1位へ - 4月プログラミング言語人気 [2013/4/12] Bashが急上昇 - 3月プログラミング言語人気 [2013/3/12] Javaが首位に返り咲く - 2月プログラミング言語人気 [2013/2/13] Objective-CがTIOBE人気言語アワードを受賞 - 1月プログラミング言語人気 [2013/1/10] Cが1位を維持、Objective-Cの人気が続く - 12月プログラミング言語人気 [2012/12/7] Objective-Cの勢い止まらず - 11月プログラミング言語 [2012/11/7] 上位は変わらず、Dartが初のトップ50入り - 10月プログラミング言語 [2012/10/10] 順位の変動は見られず - 9月プログラミング言語人気 [2012/9/12] C#の下落が続く - 8月プログラミング言語人気 [2012/8/15] Objective-CがC++を抜く - 7月プログラミング言語人気 [2012/7/10] Visual BasicがPHPを抜く - 6月プログラミング言語人気 [2012/6/14] CとObjective-Cが好調 - 5月プログラミング言語人気 [2012/5/11] 首位が交代、CがJavaを抜き1位に - 4月プログラミング言語人気 [2012/4/9]
まあ以前のは大げさすぎる感じがあったし
インタビュー記事。 Advanced UNIX Programming: An Interview with Stephen Rago
Advanced UNIX Programming: An Interview with Stephen Rago Advanced Programming in the UNIX Environment (APUE) is highly regarded as a solid reference for programming in the UNIX-based environments. The book is designed to provide a comprehensive knowledge of programming in C for the UNIX environment. Topics covered include file I/O, processes, signals, threads, interprocess communication, and sockets among many others. For this edition of the book these concepts are discussed as they relate to FreeBSD 8, Linux 3.2.0, OS X 10.6.8, and Solaris 10. The 3rd edition of APUE was recently published and InfoQ had the opportunity to speak with author Stephen Rago about his latest edition and UNIX development in general.略
InfoQ: Given C’s historical relationship with UNIX, C is used for all of the examples. Do you see any viable challengers on the horizon to this language? Is C good enough or do you think a newer language could improve systems programming? Rago: C has sufficed for 40 years. I've worked at places that have used C++ as a "better" C because of the stronger type-checking it does, but the C++ language is so large and complex that using it is really a chore. I can write C programs without needing to constantly check some reference book to see how such-and-such a feature should be used; not so with C++. I prefer C because you can do both high-level and low-level things with one language, and the language specification is simple enough to keep in your head. Operating systems need to interact with hardware and provide features based on higher-level constructs, so C fits the bill nicely. And using the same language for systems programming that is used by the underling operating system makes life easier. I haven't had a chance to look at Go yet, but it's on my list of things to do, because it tries to address some of the software engineering problems with building large software projects in languages like C and C++.
これか。前の版も翻訳されてないよねえ。
Advanced Programming in the UNIX Environment (3rd Edition) (Addison-Wesley Professional Computing Series)
前の版は買ったけど読み切らなかったなあ(そして人にあげた)
Advanced Programming in the UNIX® Environment (Addison-Wesley Professional Computing Series)
Amazon に kindle版あるけど
Includes EPUB, MOBI, and PDF
だから電書ならこっちで買った方がよさげ。
Advanced Programming in the UNIX Environment, 3rd Edition | InformIT
GNU sed でなぜああしてるという決定打はみつからなかったんだけど。 editors.sed.user - What should the "p" command do? - msg#00031 - Recent Discussion OSDir.com
editors.sed.user - What should the "p" command do? - msg#00031 - Recent Discussion OSDir.com Folks, I have recently had a problem with sed's p command and I'd be glad to hear your thoughts about it. The sed faq, section 5.10, and my reading of various books says: Sed works like this: sed reads one line at a time, chops off the terminating newline, puts what is left into the pattern space where the sed script can address or change it, and when the pattern space -------------------------- is printed, appends a newline to stdout (or to a file). If the --------------------------------------- pattern space is entirely or partially deleted with 'd' or 'D', the newline is *not* added in such cases. I've underlined the part with which I have been having problems. If I do something like this: $ echo -e "abc\ndef\nghi" | sed -n p abc def ghi $ sed works as I expect and the last line of input is output from the pattern space followed by a newline (my prompt supplies a newline before the "$"). On my system the -e parameter to echo is required to enable escapes and echo automatically supplies a trailing newline. All well, or so I thought, but when I do: $ echo -e "abc\ndef\nghi\c" | sed -n p abc def ghi $ In this example the "\c" suppresses echo's trailing newline and sed _doesn't_ add a newline to the pattern space for the last line when it is output. $ sed --version GNU sed version 4.0.7 Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, to the extent permitted by law. $ This looks like a bug, or, at least, an inconsistency with the FAQ pages, to me insofar as sed appears to remember whether the last line of input was terminated by a newline and then use that information to decide whether or not to add one when outputting the pattern space for the last time, or am I way off beam? In some of the man pages on various UNIX systems I note that it says that the p command is defined as "Print. Copy the pattern space to the standard output." without mentioning the addition of a newline to the pattern space (Solaris and HP-UX both give this definition). GNU sed's man page says this for the p command: "Print the current pattern space." Issuing the second of my attempts above on Solaris results in: $ echo "abc\ndef\nghi\c" | sed -n p abc def sed: Missing newline at end of file standard input. ghi $ and on HP-UX : $ echo "abc\ndef\nghi\c" | sed -n p abc def $ So the /usr/xpg4/bin/sed, which is the one I used on Solaris, and the HP-UX /usr/bin/sed give different results when standard input isn't terminated by a newline: Solaris complains, but processes the line, and HP-UX simply ignores the last line! So much for Sun's and HP's claims that their systems are POSIX compliant (they aren't even consistent so how can they be compliant?) Interestingly, I notice that the Open Group's Base Specifications at: http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html says nothing about adding a newline to the pattern space as it is sent to standard output. Its definition of the p command says: "Write the pattern space to standard output." I can see a reason for sed remembering whether the last input line was terminated by a newline or not if it is to be used to copy one file to another, otherwise the copy will contain something that differs from the original, but then, who uses sed to make file copies anyway? You may ask why I'm so interested in which is the correct interpretation of how the p command works, well because I wrote some code that assumes that the p command _does_ add a newline to the pattern space when it prints it and it isn't working correctly on the platforms where I need it to work. It looks as if I'll have to write platform specific versions of the code (something that I am really loath to do) and just add a newline to the pattern space by hand for the last line where needed. Thanks for your thoughts, Peter
editors.sed.user - Re: What should the "p" command do? - msg#00032 - Recent Discussion OSDir.com > This looks like a bug, or, at least, an inconsistency with the FAQ > pages, to me insofar as sed appears to remember whether the last line > of input was terminated by a newline and then use that information to > decide whether or not to add one when outputting the pattern space for > the last time, or am I way off beam? I think this area is undefined. GNU sed's behavior is correct when you are saying for example sed -n '5,15!p' or sed -n '/---/p' But not for example when you are printing multiple copies of the same line with p, because then *no* newline is printed and you get defdef on the last line. :-( > I can see a reason for sed remembering whether the last input line was > terminated by a newline or not if it is to be used to copy one file to > another, otherwise the copy will contain something that differs from > the original, but then, who uses sed to make file copies anyway? People use sed to extract parts of a file, though. I found that a way to clear GNU sed's `suppress new line behavior' is sed '$G; $s/\n//' This would make the script portable between GNU sed and Solaris sed at least. Paolo
もうひとつ。
[PATCH] for review Re: Sed substitution bugs On Wed, Jun 04, 2003 at 04:55:34PM +0100, Tony Finch wrote: > Solaris: > $ echo -n foo | sed y/o/O/ > sed: Missing newline at end of file standard input. > fOO > $ > > GNU: > $ echo -n foo | sed y/o/O/ > fOO$ > > GNU is clearly the right implementation, and it's what the regression > test says sed should do. I think sed should be fixed. (I can't do it > right now because I'm going climbing.) Your input is malformed. Making sed not store the newlines made it easier to fix a whole bunch of bugs, but made it harder to deal with this kind of malformed input in the traditional (for BSD) way. See sed/process.c rev. 1.21 and the PR's it mentions. Warning about missing newlines like Solaris sed does is probably a good idea; I'll see if I can do that. But I don't consider following the traditional BSD behaviour of not adding missing newlines to be a high priority. Tim
結局 Your input is malformed.
これをどうするかという話なんだよねえ。
POSIX的には行末には必ず改行があるわけで、
元から無いものをつけて出力して良いの? と。
In an ideal world, I wouldn't be writing this post. There'd be no need for organizations like PyLadies or separate learning opportunities for women. Everyone would get along, without any assumptions about who can learn, share and use technical skills.
自動販売機。ついったで見かけたんですが、 お金を先に入れてから希望の商品のボタンを押すというやり方は 良くないのではないか。欲しいものを先に選択しておいてからそれに必要な 金額を投入するようにした方が良いのではないかという主張。 確かに一理あるし、SUICA なんかで買うときはこういうパターンになりますよね (自販機にもよるんだろうけど)。 んでまあ、先にお金を入れて~ってのは、マイコンの類がなくて それほど複雑でない(よく知らないので要確認)、 機械的な機構だけでやってたころの事情がそうさせていたのかなあと思ったり。 そういやあ入社してすぐの研修で自動販売機の 大まかな状態遷移図を描かされたような覚えがががががw
ガラケーからiPhoneの国へ。ドコモの参入で、日本は世界でも類を見ないiPhone独裁国になる
「iPhone独裁国」ってどういう意味で使ってンだろうかと思いつつ本文を読むと
他にもいくつか気になる記述が
かつては「ガラパゴス携帯」と言われるほどに諸外国とかけ離れた独自の携帯文化を築いてきた日本が、今度は世界でも類を見ないiPhone独占国家になろうとしています。
ここに日本トップのキャリアが参入するわけですから、下手をすると8割を超えるiPhone寡占市場が誕生することに。
以上の通り、日本はガラパゴス携帯の国から世界の中でも極端なiPhone寡占国家になることは間違いなさそうです。
…辞書をひいて、推敲した方が良くないっすかね。 どくさい【独裁】の意味 - 国語辞書 - goo辞書 どくせん【独占】の意味 - 国語辞書 - goo辞書 かせん【寡占】の意味 - 国語辞書 - goo辞書
シンボリックリンクなファイルに対して inplace-edit すると云々というやつ。
4.1.5 だとこうなってるのが
static void open_next_file(name, input) const char *name; struct input *input; { buffer.length = 0; if (name[0] == '-' && name[1] == '\0' && !in_place_extension) { clearerr(stdin); /* clear any stale EOF indication */ input->fp = stdin; } else if ( ! (input->fp = ck_fopen(name, "r", false)) ) { const char *ptr = strerror(errno); fprintf(stderr, _("%s: can't read %s: %s\n"), myname, name, ptr); input->read_fn = read_always_fail; /* a redundancy */ ++input->bad_count; return; } input->read_fn = read_file_line; if (in_place_extension) { int output_fd; char *tmpdir = ck_strdup(name), *p; struct stat st; /* get the base name */ if (p = strrchr(tmpdir, '/')) *(p + 1) = 0; else strcpy(tmpdir, "."); input->in_file_name = name; if (isatty (fileno (input->fp))) panic(_("couldn't edit %s: is a terminal"), input->in_file_name); fstat (fileno (input->fp), &st); if (!S_ISREG (st.st_mode)) panic(_("couldn't edit %s: not a regular file"), input->in_file_name); output_file.fp = ck_mkstemp (&input->out_file_name, tmpdir, "sed"); output_file.missing_newline = false; free (tmpdir); if (!output_file.fp) panic(_("couldn't open temporary file %s: %s"), input->out_file_name, strerror(errno)); output_fd = fileno (output_file.fp); #ifdef HAVE_FCHMOD fchmod (output_fd, st.st_mode); #endif #ifdef HAVE_FCHOWN if (fchown (output_fd, st.st_uid, st.st_gid) == -1) fchown (output_fd, -1, st.st_gid); #endif } else output_file.fp = stdout; }
4.2 ではこう。
って diff とったほうが良かったな
if (in_place_extension)
のちょっとあとに
if (follow_symlinks)
が増えてます。
static void open_next_file(name, input) const char *name; struct input *input; { buffer.length = 0; if (name[0] == '-' && name[1] == '\0' && !in_place_extension) { clearerr(stdin); /* clear any stale EOF indication */ input->fp = ck_fdopen (fileno (stdin), "stdin", read_mode, false); } else if ( ! (input->fp = ck_fopen(name, read_mode, false)) ) { const char *ptr = strerror(errno); fprintf(stderr, _("%s: can't read %s: %s\n"), myname, name, ptr); input->read_fn = read_always_fail; /* a redundancy */ ++input->bad_count; return; } input->read_fn = read_file_line; if (in_place_extension) { int input_fd, output_fd; char *tmpdir, *p; struct stat st; if (follow_symlinks) input->in_file_name = follow_symlink (name); else input->in_file_name = name; /* get the base name */ tmpdir = ck_strdup(input->in_file_name); if ((p = strrchr(tmpdir, '/'))) *(p + 1) = 0; else strcpy(tmpdir, "."); if (isatty (fileno (input->fp))) panic(_("couldn't edit %s: is a terminal"), input->in_file_name); input_fd = fileno (input->fp); fstat (input_fd, &st); if (!S_ISREG (st.st_mode)) panic(_("couldn't edit %s: not a regular file"), input->in_file_name); output_file.fp = ck_mkstemp (&input->out_file_name, tmpdir, "sed"); output_file.missing_newline = false; free (tmpdir); if (!output_file.fp) panic(_("couldn't open temporary file %s: %s"), input->out_file_name, strerror(errno)); output_fd = fileno (output_file.fp); #ifdef HAVE_FCHOWN if (fchown (output_fd, st.st_uid, st.st_gid) == -1) fchown (output_fd, -1, st.st_gid); #endif copy_acl (input->in_file_name, input_fd, input->out_file_name, output_fd, st.st_mode); } else output_file.fp = stdout; }
follow_link はこういう関数(utils.c)
/* Follow symlink and panic if something fails. Return the ultimate symlink target, stored in a temporary buffer that the caller should not free. */ const char * follow_symlink(const char *fname) { #ifdef ENABLE_FOLLOW_SYMLINKS static char *buf1, *buf2; static int buf_size; struct stat statbuf; const char *buf = fname, *c; int rc; if (buf_size == 0) { buf1 = ck_malloc (PATH_MAX + 1); buf2 = ck_malloc (PATH_MAX + 1); buf_size = PATH_MAX + 1; } while ((rc = lstat (buf, &statbuf)) == 0 && (statbuf.st_mode & S_IFLNK) == S_IFLNK) { if (buf == buf2) { strcpy (buf1, buf2); buf = buf1; } while ((rc = readlink (buf, buf2, buf_size)) == buf_size) { buf_size *= 2; buf1 = ck_realloc (buf1, buf_size); buf2 = ck_realloc (buf2, buf_size); } if (rc < 0) panic (_("couldn't follow symlink %s: %s"), buf, strerror(errno)); else buf2 [rc] = '\0'; if (buf2[0] != '/' && (c = strrchr (buf, '/')) != NULL) { /* Need to handle relative paths with care. Reallocate buf1 and buf2 to be big enough. */ int len = c - buf + 1; if (len + rc + 1 > buf_size) { buf_size = len + rc + 1; buf1 = ck_realloc (buf1, buf_size); buf2 = ck_realloc (buf2, buf_size); } /* Always store the new path in buf1. */ if (buf != buf1) memcpy (buf1, buf, len); /* Tack the relative symlink at the end of buf1. */ memcpy (buf1 + len, buf2, rc + 1); buf = buf1; } else { /* Use buf2 as the buffer, it saves a strcpy if it is not pointing to another link. It works for absolute symlinks, and as long as symlinks do not leave the current directory. */ buf = buf2; } } if (rc < 0) panic (_("cannot stat %s: %s"), buf, strerror(errno)); return buf; #else return fname; #endif /* ENABLE_FOLLOW_SYMLINKS */ }
これについては私の想像なので、どのようにピリオドやセミコロンが使われていたのか実際のところを知っている方がいれば情報を頂きたい。
これ面白かったです。 コードレビューについてはあと一つ二つ抱えているものがあったはずだけどどこ行った The Art of Reviewing Code
パラメトロン計算機: 微分解析機 バックラッシュ懐かしいw むかーしやってた仕事で モーターを動かして歯車まわして… という制御を行う部分があったのだけど、 あれも停止状態から順方向にちょっと動かす→逆方向にちょっと戻す→順方向に本格的に動かす。 みたいにやってたんだよな。 最初はメカの都合とか一切考えないで(というかそんな余裕なかったw)プログラム書いちゃったりして 色々苦労した覚えがw いやまあベースになるプログラムもちゃんとあったんですけどね (さすがにゼロから書かされることはなかった)。
かくたにさんとわださんのトークイベントはまだ申し込めるのかしらん
一つ前へ
2013年8月(上旬)
一つ後へ
2013年8月(下旬)
リンクはご自由にどうぞ
メールの宛先はこちら