ときどきの雑記帖 2012


一つ前へ 2012年5月(下旬)
一つ後へ 2012年6月(中旬)




touch の方をお出かけ時に持っていって、喫茶店でさて読むかと思ったら電源が入らない状態に。 これはまた交換かと覚悟しましたが、家に帰ってからフル充電状態にしたあとで ハードリセットしたら回復。あーびっくりした。

Blogger Review Program
Blogger Review Program - O'Reilly Media The O'Reilly Blogger Review Program is a great way for you to get first access to new ebooks and videos focused on leading-edge software, technology, and social media trends. What's more, you'll have your expert opinions heard as a reviewer. 日本じゃやらないだろうなあ。

■_ The Web Will Die When OOP Dies

Zed A. Shaw - The Web Will Die When OOP Dies : programming

600 オーバーしてた。 まとめている余裕がなっしんぐ。 というか元記事(?)の映像もまだ観てなかったり。

■_ VB6

しぶとく生き残り続ける VB6について Why Visual Basic 6 Still Thrives : programming

Don't Get Me Started - The Silent Majority: Why Visual Basic 6 Still Thrives

The Silent Majority: Why Visual Basic 6 Still Thrives

David Platt

Microsoft recently extended “It Just Works” compatibility for Visual Basic 6 applications
through the full lifetime of Windows 8 (see this month's Editor's Note, “Old Soldiers Never
Die”). Visual Basic 6 first shipped in 1998, so its apps will have at least 24 years of
supported lifetime. Contrast that with the Microsoft .NET Framework 1.0 (2002), which is
incompatible with Windows 7 (2009).

A student of mine named Eric once joked that Visual Basic 6 was “the un-killable cockroach”
in the Windows ecosystem. That analogy goes deeper than you might think. Cockroaches are
successful because they're simple. They do what they need to do for their ecological niche and
no more. Visual Basic 6 did what its creators intended for its market niche: enable very rapid
development of limited programs by programmers of lesser experience. It was never meant for
heavy-duty coders developing complex 




■_ Why Do Some Programming Languages Live and Others Die?


Why Do Some Programming Languages Live and Others Die? | Wired Enterprise | Wired.com

Google wants to change the way the world writes software. In recent years, the search giant has
unveiled two new programming languages that seek to improve on some of the most widely used
languages on the planet.

With a language called Go, it seeks to give the world a replacement for the venerable languages
C and C++, providing a more nimble means of building really big software platforms inside data
centers. And with Dart, it hopes to replace JavaScript, improving the way we build software
that's run in our web browsers.

尊ぶべき言語 (venerable languages) である C や C++ を置き換えることを目指した
Go と呼ばれる言語でもって、データセンターの内部に大規模なプラットフォームを
JavaScript の置き換えを狙った Dart でもってwebブラウザー上で動作するソフトウェアの構築を

But no matter how impressive these new languages are, you have to wonder how long it will take
them to really catch on — if they do at all. After all, new programming languages arrive all
the time. But few ever reach a wide audience.

しかしこれらの新言語がどれほど impressive であるかは重要ではなく、

At Princeton and the University of California at Berkeley, two researchers are trying to shed
some light on why some programming languages hit the big time but most others don't. In what
they call a “side project,” Leo Meyerovich and Ari Rabkin have polled tens of thousands of
programmers, and they're combing through over 300,000 computing projects at the popular code
repository SourceForge — all in an effort to determine why old languages still reign supreme.

なぜ一部のプログラミング言語は hit the big time するのに

“Why have we not been reliably able to improve on C?” Rabkin asks.
「なぜ我々は C を信頼できるようにする改良をしてこなかったのだろうか」
と Rabkin は訊ねた。


そして reddit での反応から

Why Do Some Programming Languages Live and Others Die? : programming

That's bullshit. Everyone knows it is determined by the facial hair of the language creator.

It's the platform that matters.

C is merged at the hip with unix. Same for perl. Objectve C has the mac.

Java is it's own platform. So is C#. Javascript has the browser.

You'd want to build usable software on platforms people use. Languages tied to to a widely
used platform keeps being used as long as the platform is used and vice versa. But the
platform also cripples and limits language development just as the language limits and
cripples platform development.

I agree with C, its future is simply assured by *nix. I wouldn't say the same of Perl which
could easily be displaced by one of the other interpreted languages, perhaps Python. My guess
is '97-'04 was probably its high water mark. Perl 6 seems to have a lot of aims, chief among
them a decent OO system, but promising a newer better Perl for 12 years hasn't helped Perl 5.

But yes, the medium is the message, the platform niche is vital.

    “Why have we not been reliably able to improve on C?” Rabkin asks. In the thirty-five
     years since C was popularized, there have been enormous leaps in the design of software
     and operating systems, he says. But although C has been beefed up and other new languages
     have been very successful during that time, C is still a mainstay.

A mainstay instead of the mainstay? That's a little bit weasely. Of course any language that
had that much traction will be a mainstay because of the amount of legacy code. It's hard to
believe, though, plain-wrap C is the language a plurality of professional programmers are using
these days, especially for brand new projects.

There are a lot of great languages out there that will never be popular because companies don't
want to deal with the risk and disruption switching tool sets entails. Companies are interested
in what makes the most economic sense, not what makes the most technical sense. They're
perfectly willing to stick with the old and boring if it mitigates risk to the schedule.


■_ デザパタ

InfoQ: A Look At Elemental Design Patterns Elemental Design Patterns | InformIT

InfoQ のインタビュー記事はさておき

Elemental Design Patterns | InformIT

Even experienced software professionals find it difficult to apply patterns in ways that
deliver substantial value to their organizations. In Elemental Design Patterns, Jason McC.
Smith addresses this problem head-on, helping developers harness the true power of patterns,
map them to real software implementations more cleanly and directly, and achieve far better
results. Part tutorial, part example-rich cookbook, this resource will help developers,
designers, architects, and analysts successfully use patterns with a wide variety of languages,
environments, and problem domains. Every bit as important, it will give them a deeper
appreciation for the work they've chosen to pursue.


If you're new to patterns, this example-rich approach will help you master them piece by piece,
logically and intuitively. If you're an experienced patterns practitioner, Smith follows the
Gang of Four format you're already familiar with, explains how his elemental patterns can be
composed into conventional design patterns, and introduces highly productive new ways to apply
ideas you've already encountered. No matter what your level of experience, this infinitely
practical book will help you transform abstract patterns into high-value solutions.

ちょっと興味をひかれた。 最近肩身が狭い気がするけどそれはさておき >デザインパターン



二週間ほど前から放置しているネタがあるのだけどまとめる時間が (紙に印刷されているプログラムを打ち込まないといけなかったりで) ないのでででで



Zed がまた Zed A. Shaw - The Web Will Die When OOP Dies : programmingZed A. Shaw - The Web Will Die When OOP Dies on Vimeo

蝕の状態も再現!?「ベルセルク」ベヘリット目覚ましアプリ | ホビー | マイナビニュース

■_ ませまちか

なんだって日本ではああも高くなっているのかと。 あんまり代理店だけを悪者にするようなことはしたくないけどなにがどうなってんですかねえ。

そいや、オライリーの mathematica クックブックが出版されたときに ブックタワーで開かれたイベントで、 スピーカーだった高校の先生だかの発言にも えらく鼻白むものがあったなあ(以下省略されました)

〓 Mathematica 伍 〓

210 132人目の素数さん [sage] 2012/05/21(月) 22:55:19.62 ID: Be:


211 132人目の素数さん [sage] 2012/05/21(月) 23:05:52.60 ID: Be:

212 132人目の素数さん [sage] 2012/05/21(月) 23:10:08.93 ID: Be:


213 132人目の素数さん [sage] 2012/05/22(火) 09:37:57.41 ID: Be:


214 132人目の素数さん [sage] 2012/05/22(火) 23:11:38.39 ID: Be:

215 132人目の素数さん [sage] 2012/05/23(水) 09:56:18.68 ID: Be:

216 132人目の素数さん [sage] 2012/05/23(水) 11:07:49.08 ID: Be:



217 132人目の素数さん [sage] 2012/05/23(水) 12:11:10.17 ID: Be:

218 132人目の素数さん [sage] 2012/05/23(水) 12:16:44.47 ID: Be:


219 132人目の素数さん [sage] 2012/05/23(水) 12:46:40.51 ID: Be:

220 132人目の素数さん [sage] 2012/05/23(水) 13:27:21.19 ID: Be:


221 132人目の素数さん [sage] 2012/05/23(水) 13:40:24.14 ID: Be:

222 132人目の素数さん [sage] 2012/05/23(水) 14:47:11.17 ID: Be:

223 132人目の素数さん [sage] 2012/05/23(水) 15:05:37.79 ID: Be:


224 132人目の素数さん [sage] 2012/05/23(水) 18:38:06.86 ID: Be:

225 132人目の素数さん [sage] 2012/05/23(水) 18:58:27.08 ID: Be:



251 132人目の素数さん [sage] 2012/06/07(木) 15:59:05.62 ID: Be:


255 222 [sage] 2012/06/08(金) 01:56:09.98 ID: Be:
    >> 251

256 132人目の素数さん [sage] 2012/06/08(金) 08:10:19.94 ID: Be:
        ( ⌒)     ∩_ _
       /,. ノ      i .,,E)
      ./ /"      / /"
      ./ / _、_   / ノ'
     / / ,_ノ` )/ /
    (       /  good job!
     ヽ     |
      \    \ 

260 132人目の素数さん [sage] 2012/06/08(金) 23:20:06.46 ID: Be:

261 132人目の素数さん [sage] 2012/06/08(金) 23:22:24.23 ID: Be:

■_ 信頼度成長曲線

dis りたい ああ dis りたい dis りたい


■_ 「チューリングを読む」


チューリングを読む コンピュータサイエンスの金字塔を楽しもう


今日もまた wishlist からお届けものが。ありがとうございます。

Amazon.co.jp: 木村浩一: Wishlist



近刊で O'Reilly Japan - Books :: New and Upcoming 感じて理解する数学入門 978-4-87311-564-1 \1,575 2012年06月 というのを見かけ、何ぞこの本はと Science & Math - Books & Videos - O'Reilly Media で探してみても原著っぽいのは見当たらず。 んで、その後聞いた話では日本オリジナルの本みたいです。



The Bane Of Programming

The Bane Of Programming

      To see a world in a grain of sand,
      And a heaven in a wild flower,
      Hold infinity in the palm of your hand,
      And eternity in an hour.

                        -William Blake

Machine Language is beautiful. Not assembly, machine language. The language of binaries, the
language of the machine. A language of voltages. 1's and 0's. Ask an electrical engineer, or a
good computer engineer. He will tell you that commonly a state of 1 represents a voltage of
+5volts but not necessarily that. It can be close to +5volts and still be called a 1. in fact
anything in the ballpark of 3.5-6.5 volts would be called a 1. All of it. This is how analog
voltages are broken into digital binary states.

A language of voltages. 1's and 0's.
通常 1 という状態は +5ボルトの電圧を表すがそうでなければならない必要はないと教えてくれるだろう。
+5ボルトに近いものであれば 1 とみなされるのだ。
実際のところ、3.5ボルトから6.5ボルトの範囲にあれば 1 とみなされるだろう。

It is a language. Of efficiency. A language of logic. With it, it brings all the fallacies of
logic, the attempt to break everything into true or false. That is a flaw. Yet, by making this
abstraction we have created one of the most powerful tools known to man. Because innately we
are flawed. We need logic, our structured world works on logic and certainty.

Assembly language is an abstraction on machine language. A very strong abstraction, 
considering it converts strings of states, memory and flags into human understandable 
functions. Not very intelligent or exhaustive functions i might add. It does this by 
defining what flow of voltages will result in what action. Still, it is not that far 
from machine language. In fact, some might say that it adds structure to machine 

Not very intelligent or exhaustive functions i might add.
It does this by defining what flow of voltages will result in what action.

Every language after this adds further abstractions and simultaneously, creates further
restrictions. By requiring more layers of interpretation, more redundant code. More and more
junk, piled higher and deeper. There are programmers who use libraries for every task, and
there are those that write code for tasks because they feel the need for removing the layers of
redundant code. Ask the ones who do not use libraries, they will tell you it is awesome, fast.
Ask the ones who do, and they will tell you, someone smarter has already invented the wheel. It
is an argument for the ages.

More and more junk, piled higher and deeper.
It is an argument for the ages.

Yet, things work. They progress. Because forming high level structures always shows intelligence.
Like how neurons interact to make thoughts or allow a person to effortlessly translate them into
key strokes on a keyboard without a glance at the keys. The sheer magnitude of how this happens
destroys the human, he has no idea, no answer. His world of logic collapses. He needs simple
things to deal with, and put together. Therefore he thinks. Therefore the neurons are abstracted.

The human, ladies and gentlemen, is the bane of programming. The idea, that things must be made
simple to allow his intelligence to take shape. That is the bane of programming. If machines wrote
code, the world would be a different place. Their world is one of low-level ideas. We have to
break down, our high level ideas, to suit their needs.

But how do machines write code? How do they figure out intelligence? The answer has to be machine
learning. In machine learning we will find our salvation, because in machine learning machines
work outside of human methods.

Copyright 2012 Glitterbug Technologies Pvt. Ltd.

ダメだ面倒すぎ ○| ̄|_





■_ J

J のはなしふたたび

Another Programming Idiom You've Never Heard Of

Another Programming Idiom You've Never Heard Of

Even new programmers quickly pick-up how array indexing works. You fetch an element like this:
array[3]. (More experienced folks can amuse themselves with the equally valid 3[array] in C.) Now
here's a thought: what if you could fetch multiple values at the same time and the result was a
new array?

ある要素をフェッチするには array[3] のようにする
(もっと経験をつんだあなたならば C では 3[array] のように書いて楽しむこともできるだろう)。

Let's say the initial array is this:

  10 5 9 6 20 17 1

Fetching the values at indices 0, 1, 3, and 6, gives:

  10 5 6 1

In the J language you can actually do this, though the syntax likely isn't familiar:
J という言語では見慣れない構文を使って、これを次のように書ける

  0 1 3 6 { 10 5 9 6 20 17 1

The list of indices is on the left, and the original array on the right. That awkwardly unmatched
brace is the index operator. (You can also achieve the same end in the R language, if you prefer.)

この awkwardly に unmatch なブレースは添え字演算子である

This may seem like a frivolous extension to something you already knew how to do, but all of a
sudden things have gotten interesting. Now indexing can be used for more than just indexing. For
example, you can delete elements by omitting indices. This drops the first two elements:


  2 3 4 5 6 { 10 5 9 6 20 17 1

Or how about reversing an array without needing a special primitive:

  6 5 4 3 2 1 0 { 10 5 9 6 20 17 1

This last case is particularly significant, because the indices specify a permutation of the
original array. Arrange the indices however you want, and you can transform an array to that order.

In J, there's an operator that's like a sort, except the result specifies a permutation: a list of
where each element should go. Using the same "10 5 9..." array, that first element
should be in position 4, the value 5 should be in position 1, and so on. Here's the whole array of
permuted indices.

J にはソートに似ているけれどもその結果が、各要素が置かれるべき位置を示す順列である点が異なる演算子がある。
これまでと同じ 10 5 9 … という配列を使って、
最初の要素は位置 4 にあるべきで、5 という値の要素は位置 1 にあるべきで…とすると

  6 1 3 2 0 5 4

What good is that? If you use that list of indices on the left side of the "{" operator with
the original array on the right, you sort the array:

"{" 演算子の左側に添え字リストを置き、右に配列を置いたとすると

  6 1 3 2 0 5 4 { 10 5 9 6 20 17 1

Now imagine you've got two other parallel arrays that you want to keep in sync with the sorted one.
All you do is use that same "sorted permutation" array to index into each of the other
arrays, and you're done.

ここで、あなたの手元に二つの parallel array があって
あなたのすることは同一の "sorted permutation" 配列を




チューリングを読む コンピュータサイエンスの金字塔を楽しもう を買ったので日記よりこっち優先:)

The Annotated Turing: A Guided Tour Through Alan Turing's Historic Paper on Computability and the Turing Machine
の翻訳だそうで(買ってから知った)、原著を買ったもののほぼ放置状態だったのでありがたいw こっちの訳かと思ったのだけど勘違いだった Man Who Knew Too Much: Alan Turing And the Invention of the Computer (Great Discoveries)

そして2012年発売(予定含む)のチューリング本がたくさん。生誕100周年効果? Time Traveller Danny Meets Alan Turing (Time Traveller Kids)
Time Traveller Danny Meets Alan Turing (Time Traveller Kids) Turing's Cathedral: The Origins of the Digital Universe (Vintage)
Turing's Cathedral: The Origins of the Digital Universe (Vintage) Alan M. Turing: Centenary Edition The Universal Computer: The Road from Leibniz to Turing Alan Turing: The Enigma: The Centenary Edition Alan Turing's Electronic Brain: The Struggle to Build the Ace, the World's Fastest Computer Alan Turing: His Work and Impact Turing's Cathedral: The Origins of the Digital Universe


この話、 ソ連の宇宙開発で使われていたプログラミング言語は? « A-Listers history - What software programming languages were used by the Soviet Union's space program? - Programmers reddit に興味深い発言が What software programming languages were used by the Soviet Union's space program? : programming

history - What software programming languages were used by the Soviet Union's space program? - Programmers

I came across this article in ACM quote quad a few years ago, "A History of APL in the USSR".
It was written by Andrei Kondrashev (Computing Center of the Russian Academy of Sciences) and Oleg
Luksha (The Obninsk Educational Center).

An interesting quote from the article:

    It may be of interest that APL was directly related to the design of the Soviet space shuttle
    "Buran." Heat protection is one of the major elements in the construction of
    apparatus of that type. It is made out of composition materials. Mathematical models of the
    process of drying and roasting of plates covering the hull were made with the help of APL. As
    a result, the percentage of defects during the production of the cover plates was reduced,
    saving a lot of money and effort.

A history of APL in the USSR 読んでみたい…がロシア語で書かれてたりするんだろうか?




『銀輪の巨人』 新刊超速レビュー - HONZ ←この本、ふらっと入った(初めて行ったところではないけれども年単位で行ってなかった) 書店で偶然見かけて(コンピュータ関連書籍のすぐそばにあった) 買ってしまったんですがなかなか面白そう。 というかかなりキツイ内容ではあるんですが。 日本の自転車メーカーの状態知らんかったわ…

勢いよくオススメした手前、ちょっと気になる。 まあプログラムやロジックの説明は細かく追いかけなかったんですよね。 ってみんな良く見つけるなー ハッシュタグ「アルゴリズムを学ぼう」 - Togetter

■_ 15個の

15 Things for a Ruby Beginner

Jasim A Basheer
Blog Projects About Me

15 Things for a Ruby Beginner

Posted on May 30, 2012 | Posted in ruby

The following is a post I had recently sent the Bangalore Ruby User Group. It has been slightly
modified to address a larger audience.

There were many Ruby beginners in last week's meetup, and the common question we heard was 'after
the very basics, what next?'

The best way to learn Ruby best practices is to pair with an experienced dev; the way I learned
was by inheriting a reasonably small, but well-written codebase from an amazing colleague. In the
absence of either, here is a checklist of 15 things (since 'N things that you need to know about
X' is the in-thing these days!) that I'd recommend a Ruby beginner to consider:


  1. The very basics
  2. The ecosystem - RVM/rbenv, RubyGems, Bundler, Git and Github
  3. Editor
  4. Ditch 'while', 'for' and array accumulation
  5. Hash
  6. JSON and YAML
  7. Understand Immutability and how Ruby passes object references around
  8. Ruby's Object Hierarchy
  9. Creating your own Objects
  10. Ruby is interpreted. It is malleable. Use that to your advantage.
  11. Metaprogramming
  12. Closures (Blocks, Lambdas et al.)
  13. Styleguides
  14. Simplicity is virtue
  15. None of this matters
And remember to have fun! In Matz's own words:

    "For me the purpose of life is partly to have joy. Programmers often feel joy when they can
    concentrate on the creative side of programming, So Ruby is designed to make programmers happy." 

Happy hacking!






最近、の傾向なのかわりと薄め(100ページいかないのとか)の本を 結構出しているような>おらいり

んー パナソニックがLet's note新機種発表:ニュース:PC Online



Haskell でお仕事

Haskell Employment Prospects in the future : haskell

I'm primarily a C++ developer, which I enjoy well enough. For the past year our so I have been
really enjoying Haskell development. I know there are niche areas where Haskell thrives. It's
a pretty damn good general programming language that I would like to utilize for a living. That
last part is where I get stuck. I wonder if diving in and hoping for the best is a sound idea.
Would gaining such skills in anticipation of future demand be a good idea... Getting to it;
will there be future demand say on the level of a ruby or python developer? Any other thoughts
you would like to throw at this would be appreciated. (edit: typo)

It's important to mention that it's not hard to hire people who know Haskell these days. And
it's still true that the overall quality of programmers who know Haskell tends to be far higher
than the average.

My company allowed me to choose Haskell for a major project, and at the same time brought
another programmer on board who knows Haskell. Since then, the company is thriving, both with
the projects we are now doing in Haskell and the majority for which we are still using other
languages. Management is well aware of how the presence of Haskell and Haskellers is a major
factor in this success - even though we are still a small minority of the team of developers.

I am a co-founder of a startup that uses haskell, well primarily haskell. It was chosen for
technical and economic reasons. We wanted a language like F# (so a functional language) that
ran on linux (Azure was going nowhere) and after an extensive survey of functional languages
chose haskell.

We care a lot less about domain expertise for our business than the haskell and engineering
skills a developer can bring. We do believe that the general pool of haskell developers is
generally much better than the pool of engineers at large. We have received a lot of interest
despite the fact that we are not actively hiring, but will hire if we happen to find someone
who will make an awesome addition to our small team.

When looking at a prospective employee we do look at any code they have written and pay
particular attention to seeing if they have good habits in code, such as applying strictness.
We do believe that there is a gap between people that would make good engineers and people who
(in our opinion) would be more successful in research. We don't have the resources to help
people learn how to write shippable code right now.

For a C++ developer we would pay particular attention to the ability to build high performance
code. Think things like SSE intrinsics, data structures optimized for current generation intel
architecture, etc... While we do spend much of time writing haskell there are pieces that are
written in c/c++ for performance and other reasons.

I would encourage you to reach out to organizations that are using haskell. If it is a large
one you will probably need to find someone in the group that uses haskell rather then just
submitting it to a website and hoping that one group sees it. While many organizations such as
ours does not actively solicit employees most organizations would not at least talk to someone
who could not add a lot of value to their team.

ふーむ it's not hard to hire people who know Haskell these days.





wishlist からのお届けもの到着。 ありがとうございます。

■_ これはひどい

なんか最近同じような話をついったで見たような覚えが (英語のツイートじゃなかったけど) Help: Change Password

Help: Change Password

Help: Change Password

Because you have logged in successfully, you can change your password here by entering your
password in the Current Password field, entering the new password in the New Password field,
and confirming the new password by entering it again in the Confirm New Password field. Then
click Submit.

Remember that the new password must fulfill these requirements:

    The password must be exactly 8 characters long.

    It must contain at least one letter, one number, and one special character.

    The only special characters allowed are: @ # $
       (許されている特殊文字は @ # $ のみ)

    A special character must not be located in the first or last position.

    Two of the same characters sitting next to each other are considered to be a “set.” No “sets” are allowed.

    Avoid using names, such as your name, user ID, or the name of your company or employer.

    Other words that cannot be used are Texas, child, and the months of the year.

    A new password cannot be too similar to the previous password.
        Example: previous password - abc#1234, acceptable new password - acb$1243
        Characters in the first, second, and third positions cannot be identical. (abc*****)
        Characters in the second, third, and fourth positions cannot be identical. (*bc#****)
        Characters in the sixth, seventh, and eighth positions cannot be identical. (*****234)

    A password can be changed voluntarily (no Help Desk assistance needed) once in a 15-day
    period. If needed, the Help Desk can reset the password at any time.

    The previous 8 passwords cannot be reused.
       (直前 8個のパスワードを再利用することはできない)

Password Rules : programming


c++ - Locale specific behavior in the regex library? - Stack Overflow

When I imbue a regex object with a particular locale, how does it affect the matching behavior?
Does it affect collation, or anything else? I can't seem to find an explanation anywhere.

It affects at least the following: Collation: the regex [a-f] imbued with a French locale should match the character é. torti[^x]a in a Spanish locale should match "tortilla", as the double-l is counted as a single character. Similarly, \w in a Finnish locale should match the character ä (but [a-z] should not, as å, ä and ö collate after z in Finnish. In a Unicode compatible locale, the Unicode equivalence algorithm should be used, so that composed forms of a character match a decomposed form and vice versa. With a POSIX-compatible regex flavor (basic, extended, awk, grep, and egrep), the POSIX character classes should be locale-aware: [=e=] should match é in a French locale but not in an English locale.


Last week I learnt regex behaves differently depending on what your locale is set to. My colleague who came across this has been programming for 30 years and had never come across this before. Wanted to share. Link is the best site I can find to explain it, not much out there. : programming

For anyone interested in how we came across this:

A-C matched ab as well as ABC for a grep. This is because the locale which was set in the OS
ordered characters AaBbCc... not ABC...Zabc...z

There's a lot of info at http://www.regular-expressions.info/posixbrackets.html that 
you and your coworkers might like

Ah brilliant thanks! My google-foo wasn't working so well tonight

You might like this one too. Best tutorial I've read: http://perldoc.perl.org/perlretut.html

Ah great, thanks!

There's actually a lot out there, though perhaps not on the surface.

man locale is a decent start for Linux systems. Protip: To enforce no locale in your 
shell scripts (which usually means US-ASCII but doesn't have to!) you can set LC_ALL=C.

However with modern Linux you want to set your locale to a UTF-8 locale. I use 
LANG=en_US.UTF-8 with no LC_ALL override.

To get some way gory-in-the-weeds information you can look at the Perl locale 
documentation, although nowadays Perl types recommend avoiding POSIX locale as much as 
possible and just using Unicode + UTF-8 everywhere (although this is itself full of 
traps for the unwary...)

Another warning is that if you are ever trying to "scrape" the output of a 
program from a different program, you should make sure it's running in the right 
language! I have a program which has to do this on end-user systems and not setting 
LC_ALL=C has caused a few bugs. :-/


That's how you do it. CTYPE is real magic.

■_ かれんだー

仕事をしているとですね、今の月とその前後の月の三か月分のカレンダーを 見たいなーということがままあったりします。 んが、どうもいいのがなかったので自分で作ろうと決心。 JavaScript でつくるか PowerShell かと悩みましたが(前者はブラウザで表示させる) おべんきょーを兼ねてまずは PowerShell で。


Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Users\xxxx>
PS C:\Users\xxxx> foreach ($i in 1..30) {$d = (get-date -Year 2012 -Month 6 -Day $i); write-host -nonewline "" $d.day.tostring().padleft(3); if ($d.dayofweek -eq  6) {write-host ""}}
   1   2
   3   4   5   6   7   8   9
  10  11  12  13  14  15  16
  17  18  19  20  21  22  23
  24  25  26  27  28  29  30



function cal2($offset)
    $today = get-date
    $ld = (get-date -Year $today.year -Month ($today.month + $offset) -Day 1).addmonths(1).adddays(-1).day
    write-host $today.addmonths($offset).month.tostring().padleft(11) "`n"
    $t = get-date -Year $today.year -Month ($today.month + $offset) -Day 1
    $dow = $t.dayofweek.value__
    write-host -nonewline $t.day.tostring().padleft(3+3*$dow)

    foreach ($i in 2..$ld) {
        $t = get-date -Year $today.year -Month ($today.month + $offset) -Day $i
        write-host -nonewline $t.day.tostring().padleft(3)
        if ($t.dayofweek -eq 6) { write-host ""}
    write-host ""

foreach ($i in @(-1, 0, 1)) {


function cal2($offset)
    $today = get-date
    $year = $today.year
    $mon = $today.month + $offset
    if ($mon -eq 0) {
        $mon = 12
        $year -= 1
    } elseif ($mon -eq 13) {
        $mon = 1
        $year += 1
    $first = get-date -Year $year -Month $mon -Day 1
    $last = $first.addmonths(1).adddays(-1).day
    $r = write-output ($first.month.tostring().padleft(11) + "`n")
    $dow = [Int32]$first.dayofweek
    $r += write-output (" " * (3 * $dow))

    foreach ($i in 1..$last) {
        $r += write-output $i.tostring().padleft(3)
        $dow = ($dow + 1) % 7
        if ($dow -eq 0 -and ($i -ne $last)) {$r += write-output "`n"}
    #$r += write-output "`n"

function cal {
    foreach ($i in @(-1, 0, 1)) {
        $out = cal2($i)
        write-output $out


とりあえずの一歩目にはこんなものかなと。 んが、その直後とんでもないものを発見

Type "help", "copyright", "credits" or "license" for more information.
>>> import calendar
>>> cal=calendar.TextCalendar().prmonth(2012,6)
     June 2012
Mo Tu We Th Fr Sa Su
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
>>> for i in (5,6,7): cal=calendar.TextCalendar().prmonth(2012,6)
     June 2012
Mo Tu We Th Fr Sa Su
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
      June 2012
Mo Tu We Th Fr Sa Su
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
      June 2012
Mo Tu We Th Fr Sa Su
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30

なんでこんなの標準で持ってるんだ Python ○| ̄|_

HTML で出力するクラスもあります。


Embedded in Academia : A Quiz About Integers in C

Embedded in Academia : A Quiz About Integers in C

A Quiz About Integers in C

The C language's rules for integer operations have some quirks that can make even small programs
behave in confusing ways. This post is a review of these rules in the form of a quiz containing
20 questions. I recommend going through the questions in order. If you are abeginning C
programmer, you should consult a C book as you go through these questions since there are a lot
of little things (such as what "1U" means) that I have not bothered to explain. If
you are a serious C programmer, I expect you'll do well -- this quiz is not intended to be
extremely difficult. You should assume C99. Also assume that x86 or x86-64 is the target. In
other words, please answer each question in the context of a C compiler whose
implementation-defined characteristics include two's complement signed integers, 8-bit chars,
16-bit shorts, and 32-bit ints. The long type is 32 bits on x86, but 64 bits on x86-64 (this is
LP64, for those who care about such things).

ぜひ挑戦を :)




読売新聞社会面で興味深い記事があったんだけど、 電子版には見当たらない…?

NHK のアレ
本物の時計になってたのかw 腕時計はすでに売り切れちゃってるみたいだけど、置時計…もうちょい安ければなあ NHK時計 木目版| NHKスペシャル・ドラマ等のDVD・グッズ通販 NHKエンタープライズ NHK時計 青版| NHKスペシャル・ドラマ等のDVD・グッズ通販 NHKエンタープライズ NHK時計 腕時計タイプ(青)| NHKスペシャル・ドラマ等のDVD・グッズ通販 NHKエンタープライズ NHK時計 腕時計タイプ(木目)| NHKスペシャル・ドラマ等のDVD・グッズ通販 NHKエンタープライズ

製品情報 - matico | 株式会社サンジェルマン・matico(マティコ)ブランドの公式ホームページ とあるところでこのメーカーの文房具を見かけて いくつか面白そうなものがあったのでアマゾンでも扱ってれば wishlist に載せてやれと 思ったが扱ってなかった ○| ̄|_ Amazon.co.jp: 木村浩一: Wishlist

■_ PowerShell

単位つき? の数が扱えるようで。

Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> 1kb
PS C:\Windows\system32> 1mb
PS C:\Windows\system32> 1gb
PS C:\Windows\system32> 1tb
PS C:\Windows\system32> 1pb
PS C:\Windows\system32> 1eb
数値定数 1e が正しくありません。
発生場所 行:1 文字:3
+ 1e <<<< b
    + CategoryInfo          : ParserError: (1e:String) []、ParentContainsErrorR
    + FullyQualifiedErrorId : BadNumericConstant

PS C:\Windows\system32> 1zb
数値定数 1 が正しくありません。
発生場所 行:1 文字:2
+ 1 <<<< zb
    + CategoryInfo          : ParserError: (1:String) []、ParentContainsErrorRe
    + FullyQualifiedErrorId : BadNumericConstant

PS C:\Windows\system32>

ペタバイトまでのようです。 出力で K M G…を使った表示をさせるにはなんか format 指定をする必要がありそう

というか、k やら m だけでも受け付けてくれりゃあいいのに

■_ ガーベジコレクター

New Garbage Collector

New Garbage Collector


The following design document describes the the new garbage collector (GC) to be introduced
with LuaJIT 2.1. This document is very much a work in progress right now. Anything may change
for the actual implementation. No code is available, yet.

The purpose of this document is to gather early feedback on all design aspects and to present
the planned work to sponsors.

Note to potential sponsors: This feature is in need of sponsorship! Work on LuaJIT 2.1 probably
won't start until I'm able to get full covenants for this and other planned new features.
Please refer to the LuaJIT Sponsorship Page. Thank you!

You probably need to have at least some background knowledge on garbage collection algorithms
to fully enjoy the following document. There are plenty of books, research papers and other
freely available online resources for this. A good start would be the Wikipedia article on
Garbage Collection.


nari3 さんによる解説きぼー



JSX のアレな所 - 予定は未定Blog版


みなとRuby会議01 で「怠惰なRubyistへの道」という発表をしました - PB memo



面白かった。 というか読んであまり印象に残ったのは取り上げたりしないんだけどw 「これからの正義の話をしよう」のともそうだったと思うのですが、 何かに対する明解な回答なり処方箋があるわけではないのですよね。 でまあ今回も様々な事例が取り上げられたわけなんですが、 自分が一番興味を持ったのが第5章。 メジャーリーグに関する話でいろいろ。なのですが、たとえば 「マネーボール」にあるように「経済学的手法」を活用して オークランドアスレチックスというチームが躍進しました。 が、つい最近を見るとそれほど成績が振るってはいない。 なぜか? 資金豊富なチームも同様の手法を使うようになったから。 そしてゲームはどうなったかというと、 「マネーボール」の手法で高く評価されたものが目立つようになる。 つまり、フォアボール狙いの待球、盗塁などの「見合わない」プレーをしない… でも、そんなゲームを観たい? と。 まあゲームの内容云々は別に資料を当たってみたいところだけど ありそうな展開ではありますよね。 最後の最後の二行がとっても印象的でした。

ついったーでもかなり目にするので(観測範囲偏ってる?w) 知っている人も結構いると思いますが、 表紙で判断せずに読んでみるのをオススメ。 入門書的な雰囲気の本なのですが、解説している題材が良いです。

第1講 アルゴリズムと計算量
第2講 データ構造 初級編
第3講 ソート
第4講 グラフと探索
  A* 探索
第5講 データ構造 上級編
第6講 最短経路問題
第7講 グラフの上級アルゴリズム
第8講 NP完全問題
第9講 暗号(前編)
第10講 暗号(後編)

ま、抜けもありますがその辺はご勘弁。 翻訳書でないものでこの本の後半で取り上げられているような アルゴリズムをきちんと書いているものはほとんどないと思いますし 常々それを不満に感じていました。 アレがないコレがないと言えば切りがないのは確定なので きっちりこれだけのものをまとめたのはすばらしいと思います。

サンプルプログラムの記述は Java を使っています。 これについて一言二言言いたい人もいるでしょうが悪い選択ではないと思います。

自分が一番ショックを受けたもの p251 の楕円曲線のグラフ。 えええ、「楕円曲線」のグラフってこんなんなの~?! とこれだけでも買った分の価値はあったかもしれない :)

もうでているっぽい Safe C++ - O'Reilly Media

Released: May 2012
Pages: 142

Pre-Order Print: $24.99
June 2012 (est.)

Ebook: $19.99
Formats: ePub, Mobi, PDF

紙の本も注文しとくかねえと思ったものの、 電書とのセットが Print & Ebook: $27.49 なんだけど、 International Express Arrives within 2-5 business days. Ships via DHL International Express ($22.50) 送料が…○| ̄|_ ジュンク堂…は無理そうだけど(洋書棚の面積が…)、 新宿のブックファーストには入りそうな気がするので そこで見かけたら買うか、Amazonさん待ちかなあ。

Safe C++ - O'Reilly Media

It's easy to make lots of programming mistakes in C++—in fact, any program over a few hundred
lines is likely to contain bugs. With this book, you'll learn about many common coding errors
that C++ programmers produce, along with rules and strategies you can use to avoid them.

Author Vladimir Kushnir shows you how to use his Safe C++ library, based in part on programming
practices developed by the C++ community. You'll not only find recipes for identifying errors
during your program's compilation, runtime, and testing phases, you'll learn a comprehensive
approach for making your C++ code safe and bug-free.

    Get recipes for handling ten different error types, including memory leaks and uninitialized variables
    Discover problems C++ inherited from C, like pointer arithmetic
    Insert temporary and permanent sanity checks to catch errors at runtime
    Apply bug prevention techniques, such as using separate classes for each data type
    Pursue a testing strategy to hunt and fix one bug at a time—before your code goes into production

オライリーさん色々出すねえ Playful Design - O'Reilly Media

■_ どんな稽古だろう


よくphpは下降稽古だよぉ(^.^)と、言われてますが - Yahoo!知恵袋



■_ Signs that you're a good programmer


Signs that you're a good programmer - Software Engineering Tips

Signs that you're a good programmer

The most frequently viewed page on this site is Signs you're a bad programmer, which has also
now been published on dead trees by Hacker Monthly, and I think that behoves me to write its
antithesis. "Bad programmer" is also considered inflammatory by some who think I'm
speaking down to them. Not so; it was personal catharsis from an author who exhibited many of
those problems himself. And what I think made the article popular was the "remedies"--I
didn't want someone to get depressed when they recognized themselves, I wanted to be constructive.

Therefore if you think you're missing any of the qualities below, don't be offended. I didn't
pick these up for a while, either, and many of them came from watching other programmers or
reading their code.

1. The instinct to experiment first

The compiler and runtime can often answer a question faster than a human can. Rather than seek
out a senior programmer and ask them "will it work if I do this?", a good programmer
will just try it and see if it works before bringing their problem to someone else.

良いプログラマーは seinior プログラマーを探して「これをやったらうまくいきますか?」


    Side projects

    Dabbling in other programming languages, especially ones from a different "family" (procedural, stack-based, concurrent, etc.)
    Knows what you're talking about when you mention "Arduino"

    Old, uncommitted code that duplicates other code's functionality but isn't referenced elsewhere in the project

    A tendency to suggest wacky and unrealistic solutions in meetings

    A cubicle or desk populated with toys that came from ThinkGeek

How to acquire this trait

Are you excessively cautious? Are you only comfortable when you have permission? Has anyone
ever said that you were passive aggressive? You might consider inviting some friends to visit
the local Six Flags or some other roller-coaster park. If you want baptism by fire, then make
your first ride the scariest (for me, it was the "Drop Zone" at King's Dominion, with
some reinforcement a few years later on the Kingda Ka at Six Flags). If you consider yourself
ready to get off the kiddie rides you might try your hand at hang gliding and windsurfing,
which have the benefit of teaching you what you can and cannot control.

Much of what makes people timid to experiment is chemical--your brain has a small number of
adrenergic receptors, so a little bit of adrenaline excites your fight-or-flight reflexes too
much. But consider why people grow tolerant to coffee: the caffeine's byproducts force their
brain to grow more adenosine receptors. So if you force your brain to grow more adrenaline
receptors then the same amount of "fear juice" will trigger a lower percentage of
them. Find some experience that scares the shit out of you, do it a few times, and you will
lose your fear of venture on a physical level.

Note: A programmer who "suggests wacky and unrealistic solutions" is not 
always a bad programmer. It can be a sign of creative thinking from someone who 
assumes confirmation or correction will come from somewhere else down the line. 

2. Emotional detachment from code and design


google-blockly - A visual programming language - Google Project Hosting Blockly is a web-based, graphical programming language. Users can drag blocks together to build an application. No typing required.






電書でもでるとは(しかもすぐに) 『アルゴリズムを学ぼう』販売開始しました! - 達人出版会日記アルゴリズムを学ぼう - 達人出版会

アドレス渡し - Google 検索
call by reference と同じものを指す pass by address とも違うような気がすんだけど


■_ The Ruby standard library is a disgrace

他の言語と比較すると、この手の話題で取り上げられることが多いような気がしないでもない >Ruby

disgrace → 不名誉、不真面目

Architectural Atrocities — The Ruby standard library is a disgrace

    24 May 2012

The Ruby standard library is a disgrace

I had a really bad experience of the Ruby standard library today. I sat down with a colleague
to look at the performance of a small piece of code that happened to be in a hot spot of our
code base. We set up a simple benchmark, saw that it was less than ideal performance, reasoned
a bit about the code and decided that perhaps it would be better to replace the use of
SortedSet with just #sort! for this particular case. So just to be sure we ran perftools.rb to
see what was going on. This is what we saw:

あるRuby を使ったプロジェクトでベンチマークをしてみるとどうも成績がよろしくない。
調べてみると、特定のケースで SortedSet を #sort! で置き換えると改善されるようだ。
何が起きているのかを確かめるために perftools.rb を実行してみると

SortedSet isn't

Right. Perhaps #sort! wouldn't be such a good idea after all. And what is SortedSet doing? Why
is is even calling #sort!? How is it a sorted set if it needs to call #sort!?

SortedSet がどうもよろしくない。
この SortedSet いったい何をやっているんだろうか?
なぜ #sort! を呼び出してるのか?
sorted set に何の必要があって #sort! を呼んでいるのか?

Turns out that SortedSet isn't.

The first the class does is to try to load rbtree. Yes, the standard library class SortedSet is
implemented in terms of the gem rbtree. If it can't load rbtree it creates (via module_eval and
a huge string containing the code, of course) a completely retarded implementation instead.

SortedSet は無実だった。
SortedSet は最初に rbtree を load しようとする。
この、標準ライブラリクラスである SortedSet は gem の rbtree を使って実装されていたのだ。
rbtree が load できなかった場合には completely retarded な実装を代わりに
(module_eval やらを使って)作り出す。

What. The. Fuck.

The Ruby standard library has gotten some (rightful!) flak over the years, but for me this
really takes the biscuit. The Ruby standard library is a disgrace. The Ruby community should
have thrown it out a long time ago. It's full of awful code — some of the worst Ruby code I
have ever seen is in the standard library. Many of the APIs are horrible, and much of it was
written almost as to be as slow as possible.

I think it puts the Ruby community in a bad light. We should be ashamed of it.

If you've somehow escaped noticing the issues with the standard library, here's a smalll gallery of horrors.



6月は誕生月ということで貼っておこう Amazon.co.jp: 木村浩一: Wishlist

一つ前へ 2012年5月(下旬)
一つ後へ 2012年6月(中旬)



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