前の月 / 次の月 / 最新

01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

2007-07-28 Sat

自前で解析 SSI

自前で SSI を解析すると Last-Modified を出力できるかも。

自家製 SSI 解析フィルタを作るとよさそう。
でも作るのが大変そうなので、
Action で代用してみよう。

Action で SSI 解析 CGI を指定するとよい。

2007-07-25 Wed

SSI と Last-Modified

Apache で SSI を使うと Last-Modified が出力されない。

XBitHack を使うと Last-Modified が出力される。

XBitHack を使わないで出力したいな。
Header が使えそうだ。
拡張子が shtml のとき出力するように。

最終更新日の取得方法は?
最終更新日の取得して環境変数にセットできないかな?

2007-07-22 Sun

Quote of the Day Protocol [QUOTE]

RFC 865 Quote of the Day Protocol と言うのがある。
これは、17番ポートを監視し今日の一言を送信する。

カテゴリ QUOTE で、ふと思いついた一言を載せる。

どこかで見聞きしたフレーズが載るかもしれない。
どこかで見聞きしたフレーズと似ているかもしれない。
どこかで見聞きしたフレーズの組み合わせかもしれない。

駄洒落かもしれない。
意味がないも知れない。

ふと思いついたことをただ載せる。

const メンバ関数がオーバーロードできない [D言語]

D言語(dmd2.002)で const メンバ関数がオーバーロードできない。
関数の衝突が起こる。

class Foo
{
    int func(){return 1;}
    const int func(){return 2;} //関数の衝突
}

仕様だろうか?

文字列演算子 [Perl]

. で文字列の連結

ファイル [Perl]

<ファイルハンドル> で1行読み込む

改行文字を削除して読み込む

chop($str = <STDIN>); #$strから改行を取り除く

配列 [Perl]

普通の配列

@list = ("a", "b", "c"); #3要素の配列
print $list[1]; #2番目の要素を表示 []で参照する

連想配列
Perl ではハッシュと呼ぶ

%hash = ("key1" => "value1",
        "key2" => "value2",
        "key3" => "value3"); #3要素のハッシュ
print $hash{"key2"} # key2の値value2を表示 {}で参照する

多次元配列
配列

@list = (["a", "b", "c"], 
         ["d", "e", "f"]);
print $list[1][1]; #eをを表示

クォートの種類 [Perl]

シングルクォート 変数展開しない
ダブルクォート 変数展開する
バッククォート 外部プログラムの出力

hello.pl

$str = `world.pl`; #wold.pl の実行結果 "world" が入る
print "hello $str!!"; #変数展開する

world.pl

$str = 'world'; #変数展開しない
print $str;

実行結果
hello world!!

変数の種類 [Perl]

スカラー 値
配列 値の配列
ハッシュ 連想配列
サブルーチン
型グロブ

2007-07-16 Mon

数学ガール

数学ガールを買いました。

第1章まで読んだ。

「僕」ってメガネをかけていたのか。

4乗数ってのがわからなかった。

2007-07-11 Wed

セルフスタンド

エクソンモービルのセルフスタンドでiD/QUICPay/VISA TOUCHが利用可能に

iD が使えるようになったのか
近所のスタンドは iD 対応の読み取りきが設置されてるかな?

財布

財布って自作できそう。

厚紙と布とチャックを用意して
接着剤で貼り付ければよさそうな気がする。

2007-07-08 Sun

template toolkit メモ [Perl]

マニュアル
[% %] が標準のタグ

自分でタグを指定できる
PHP のタグにあわせると共用できたりするかも

サンプル

use strict;
use Template;

my $tmpl = 'hoge [% mesg %] piyo';

my $tt = Template->new()  || die $Template::ERROR, "\n";

$tt->process(\$tmpl, {mesg => 'fuga'}) || die $tt->error(); #出力先は標準出力

perl メモ [Perl]

変数の宣言 $ をつける
変数の参照 \ をつける

定数
use Readonly;
Readonly my $foo => 1;

本を買おう。

ログフォーマットを変更した

        combines ログ書式を
LogFormat "%h %l %u %t \"%m %U %H\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
に変えた。

これはコンテントネゴシエーションに対応したことにより
実際に送信しているファイルがわからなくなったため。

これにより従来と同じ拡張子つきで記録される。

2007-07-07 Sat

chalow のコンテントネゴシエーション対応

chalow が生成するリンクから拡張子を取り除いた。

datestr2url の部分を改造

sub datestr2anchor {
    my ($d) = @_;
    if ($page_mode == 2) {	# アイテムモード
	$d =~ s!\[(\d{4}-\d\d-\d\d(-\d+)?)\]!<a href="$1">[$1]</a>!g;
    } elsif ($day_page_mode or $page_mode == 1) { # 日モード
	$d =~ s!\[((\d{4}-\d\d-\d\d)(-\d+)?)\]!<a href="$2#$1">[$1]</a>!g;
    } else {			# 月モード
	$d =~ s!\[((\d{4}-\d\d)-\d\d(-\d+)?)\]!<a href="$2#$1">[$1]</a>!g;
    }
    return $d;
}

2007-07-06 Fri

type-map ファイルを Multivews の対象にする方法。

2種類ある。

1. type-map に MIME タイプを割り当てる AddType application/x-type-map var

2. Multivews の検索対象を変える MultiviewsMatch Handlers

コンテントネゴシエーションの設定

type-map ファイル
type-map ファイルにアクセスすると任意のリソースを取得できる。
type-mapの中から選択される。

AddHandler type-map var

これで拡張子が var の物は type-map として扱われる。

Multiviews
任意のリソースの拡張子から選択される
任意のリソースは MIME タイプが指定されているものから

2007-07-05 Thu

type-map と Multiviews

現在の設定では混在している。

比較しているところを探してみよう。

なるほど

それでも mod_negotiation を使いたいのならば
sitemap.var が sitemap という名前なら期待した動作をするのか。

コンテントネゴシエーションがうまくいかなかった

/sitemap.html を /sitemap でアクセスしたい。
現在 sitemap.html と sitemap.xml が存在している。

AddHandler type-map .var 

を指定した。

sitemap.var を作成した。

URI: sitemap

URI: sitemap.html
Content-Type: text/html;

URI: sitemap.xml
Content-Type: application/xml; qs=0.0

/sitemap.var にアクセスすると /sitemap.html が表示される。
これは期待した動作。

/sitemap にアクセスすると 404 Not Found

Multiviews をつけて /sitemap にアクセスすると sitemap.xml が表示された。

sitemap.html が表示されてほしい。

MultiviewsMatch Handlers

をつけると期待した結果が出た。

MIME の設定が原因だろうか?

2007-07-01 Sun

アクセス解析を入れてみた

awstats をいれた。
AWStats 6.6完全日本語版のページを参照した。

ログ解析スクリプトAWStats 6.0ドキュメントこのページにある

perl awstats.pl -config=myvirtualhostname -output=alldomains -staticlinks > awstats.myvirtualhostname.allhosts.html
perl awstats.pl -config=myvirtualhostname -output=allhosts -staticlinks > awstats.myvirtualhostname.allhosts.html
perl awstats.pl -config=myvirtualhostname -output=lasthosts -staticlinks > awstats.myvirtualhostname.lasthosts.html
perl awstats.pl -config=myvirtualhostname -output=unknownip -staticlinks > awstats.myvirtualhostname.unknownip.html
perl awstats.pl -config=myvirtualhostname -output=alllogins -staticlinks > awstats.myvirtualhostname.alllogins.html
perl awstats.pl -config=myvirtualhostname -output=lastlogins -staticlinks > awstats.myvirtualhostname.lastlogins.html
perl awstats.pl -config=myvirtualhostname -output=allrobots -staticlinks > awstats.myvirtualhostname.allrobots.html
perl awstats.pl -config=myvirtualhostname -output=lastrobots -staticlinks > awstats.myvirtualhostname.lastrobots.html
perl awstats.pl -config=myvirtualhostname -output=urldetail -staticlinks > awstats.myvirtualhostname.urldetail.html
perl awstats.pl -config=myvirtualhostname -output=urlentry -staticlinks > awstats.myvirtualhostname.urlentry.html
perl awstats.pl -config=myvirtualhostname -output=urlexit -staticlinks > awstats.myvirtualhostname.urlexit.html
perl awstats.pl -config=myvirtualhostname -output=browserdetail -staticlinks > awstats.myvirtualhostname.browserdetail.html
perl awstats.pl -config=myvirtualhostname -output=osdetail -staticlinks > awstats.myvirtualhostname.osdetail.html
perl awstats.pl -config=myvirtualhostname -output=unknownbrowsers -staticlinks > awstats.myvirtualhostname.unknownbrowsers.html
perl awstats.pl -config=myvirtualhostname -output=unknownos -staticlinks > awstats.myvirtualhostname.unknownos.html
perl awstats.pl -config=myvirtualhostname -output=refererse -staticlinks > awstats.myvirtualhostname.refererse.html
perl awstats.pl -config=myvirtualhostname -output=refererpages -staticlinks > awstats.myvirtualhostname.refererpages.html
perl awstats.pl -config=myvirtualhostname -output=keyphrases -staticlinks > awstats.myvirtualhostname.keyphrases.html
perl awstats.pl -config=myvirtualhostname -output=keywords -staticlinks > awstats.myvirtualhostname.keywords.html
perl awstats.pl -config=myvirtualhostname -output=errors404 -staticlinks > awstats.myvirtualhostname.errors404.html

の1行目と14行目は、

perl awstats.pl -config=myvirtualhostname -output=alldomains -staticlinks > awstats.myvirtualhostname.alldomains.html

perl awstats.pl -config=myvirtualhostname -output=unknownbrowser -staticlinks > awstats.myvirtualhostname.unknownbrowser.html

が正しいようだ。

過去ログ

2011 : 01 02 03 04 05 06 07 08 09 10 11 12
2010 : 01 02 03 04 05 06 07 08 09 10 11 12
2009 : 01 02 03 04 05 06 07 08 09 10 11 12
2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12