DDSKK をインストールしようとしたら Openlab.jp につながらなくて困った件

取り急ぎで解決したので共有します。

ddskk 15.2 · GitHub等での対応に見られるように Ring サーバのアーカイブにはアクセスできるようなので、それぞれ

から取ってくればよいかと。

Oracle 10g Server / 11g Server で環境変数 PERL5LIB の使われ方が微妙に変わった?

ちょっと前に会社で新しいお仕事 PC(残念ながら Windows...)買ってもらいまして、そのときに Oracle Server と Perl5(Strawberry Perl)を構築し直したときの話。ちなみに Linux / OSX ではどうなのか知りません。

あんまり深追いしてませんが、Oracle Server をインストールすると

  • 10g: PERL5LIB に Oracle 用の設定がワラワラ入る
  • 11g: PERL5LIB が定義されるが値は空

となるので、10g Server 使ってたときは Strawberry Perl の起動バッチファイルを改造して PERL5LIB をリセットしてました。11g Server からは必要なくなりましたね、とそういう話です。

Oracle Server 内で使ってる同梱の Active Perl が新しくなったんですかね?
# 10g のときは 5.8 だった気がする...

いまさらGo言語に手つけてみた: The Go Program Language - Course Notes

Documentation - The Go Programming Language

Course Notes

Slides from a 3-day course about the Go programming language. A more thorough introduction than the tutorial.

先週の平日、ふと思い立って、夜な夜なGo言語の環境構築してA Tour of Goをざっとやってみたんですが、3連休は3-Dayコースを消化してみよう、とそういう話です。

この際、超訳とかするのもありなんですが、めんどgolang.jp - プログラミング言語Goの情報サイトにありそーな気がするのでやりません。

ということで、以下は個人メモ追記していきます。

資料はRob Pikeが作成

  • メアドがr@google.comって一文字かいw

Go Course Day 1

Exercise:

You all know what the Fibonacci series is. Write a package to implement it. There should be a function to get the next value. (You don't have structs yet; can you find a way to save state without globals?) But instead of addition, make the operation settable by a function provided by the user. Integers? Floats? Strings? Up to you.

とりあえずはこんなんでOKかな??

func NextFibonacci() func() int {
        x := 0
        y := 0
        return func() (ret int) {
                if x+y == 0 {
                        ret = 1
                } else {
                        ret = x + y
                }
                x, y = y, ret
                return ret
        }
}

Go Course Day 2

Anonymous fields:

Inside a struct, you can declare fields, such as another struct, without giving a name for the field. These are called anonymous fields and they act as if the inner struct is simply inserted or "embedded" into the outer.

これ、Go言語における構造体をネストしてない構造体

type Foo struct {
        x, y int
}

f := Foo{1, 2}

C言語よろしくf.x、f.yでフィールドを参照するんですが、ネストしたものは

type Bar struct {
        Foo
        z int
}

b := Bar{Foo{1, 2}, 3}

のように記述してb.x、b.y、b.zと参照できます。"Anonymous"ってネーミングからだけだといまいちピンと来ないんだけど、こーゆーことらしいです。このAnonymous fields、単なる糖衣構文かと思いきや非常におもしろいのが、Go言語における型の派生を担う文法となってるところ。

Dancer-1.3060のテストがこける


さっきおもむろにコード読もうと思ってcpanmしたところ、当方の環境だとテストがこけます。該当箇所だけ抜き出すと...

[~/.cpanm/latest-build/Dancer-1.3060]% prove -b ./t/11_logger/05_format.t
./t/11_logger/05_format.t .. 1/9
#   Failed test at ./t/11_logger/05_format.t line 35.
#                   '- 16/ 6/2011 01:22:37 2011-06-16 01:22:37
# '
#     doesn't match '(?^ix:- \s
#               \d+/[a-z]+/\d+ \s \d+:\d+:\d+ \s
#               \d+-\d+-\d+ \s \d+:\d+:\d+ )'
# Looks like you failed 1 test of 9.
./t/11_logger/05_format.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/9 subtests 

Test Summary Report
-------------------
./t/11_logger/05_format.t (Wstat: 256 Tests: 9 Failed: 1)
  Failed test:  7
  Non-zero exit status: 1
Files=1, Tests=9,  0 wallclock secs ( 0.03 usr  0.01 sys +  0.16 cusr  0.02 csys =  0.22 CPU)
Result: FAIL

です。

原因は

# t/11_logger/05_format.t (L33-37)
setting charset => 'UTF-8', logger_format => '%h %t %T';
$str = $l->format_message('debug', 'this is debug');
like $str, qr{- \s
                   \d+/[a-z]+/\d+ \s \d+:\d+:\d+ \s
                   \d+-\d+-\d+ \s \d+:\d+:\d+ }xi;

# lib/Dancer/Logger/Abstract.pm (L93-94)
t => sub { Encode::decode(setting('charset'),
                                          POSIX::strftime( "%d/%b/%Y %H:%M:%S", localtime )) },

からわかるように、POSIX::strftime("%b", localtime)がJunなどの英語表記月名を返すことをテストコードは期待している(正規表現[a-z]+のところ)のですが、ここは一般的にポータブルじゃありません。

# perldoc POSIXから抜粋
strftime
               Convert date and time information to string.  Returns the
               string.

               Synopsis:

                       strftime(fmt, sec, min, hour, mday, mon, year, wday = −1, yday = −1, isdst = −1)

(snip.)
               If you want your code to be portable, your format ("fmt")
               argument should use only the conversion specifiers defined by
               the ANSI C standard (C89, to play safe).  These are
               "aAbBcdHIjmMpSUwWxXyYZ%".  But even then, the results of some
               of the conversion specifiers are non‐portable.  For example,
               the specifiers "aAbBcpZ" change according to the locale
               settings of the user, and both how to set locales (the locale
               names) and what output to expect are non‐standard.  The
               specifier "c" changes according to the timezone settings of the
               user and the timezone computation rules of the operating
               system.  The "Z" specifier is notoriously unportable since the
               names of timezones are non‐standard. Sticking to the numeric
               specifiers is the safest route.

とりまLANG=Cを与えれば

[~]% LANG=C cpanm Dancer
# => ok

テスト通ります。


ちなみに、ざっとgithubを追ってみたところ

  • こけるテストは、Dancer-1.3059_03以降に入った比較的新しいもの
  • 短期間中にFixされたりしてる

な感じなので、ちょっと放っておけば対応が入るかもしれませんね。

ターミナルエミュレータでどうも上手く効いてないキーがあるときの対処法


今日、いまさらiTerm上のEmacsにてCtrl+が上手く効いていないことが発覚して発狂しそうになった、という話です。

とりあえずググってたら、WindowsのTera Termに関する記事なんですが

の内容がほぼドンピシャだったのでご紹介しておきます。

iTermでも、Preferences>Profiles>KeysのProfiles Shortcut Keysに、Action:Send Escape SequenceとしてCtrl+を追加すれば万事OKでした。