ETC 割引備忘録

A memo of the ETC (Electronic Toll Collection), the automatic toll collection system of Japanese highways.
割引スキームが多すぎるのでメモ(横浜町田IC or 相模湖IC用)。

名称 時間帯(付帯制限) 回数制限 距離制限 出入口制限 割引適用区間 割引率(%) 備考
通勤割引(夕) 17-20 1 100km以内 - 大都市近郊区間除く 50
深夜割引 22-23(出口) - - 裾野-東京 - 20 東名社会実験
深夜割引 23-24(出口) - - 裾野-東京 - 30 東名社会実験
深夜割引 0-4 - - - - 30
早朝夜間割引 22-6 - 100km以内 大都市近郊区間区間以上 - 50
通勤割引(朝) 6-9 1 100km以内 - 大都市近郊区間除く 50
渋滞回避割引 20-22(土日祝のみ) - - (備考参照) - 50 入口(静岡-厚木 or 諏訪-相模湖)/出口(町田-東京 or 八王子-高井戸)

100km を超えない最長区間一覧

路線 区間 区間
東名 横浜町田 沼津
中央 相模湖 長坂
中央 八王子 韮崎
中央 勝沼 岡谷

The backup strategy for subversion repositories

(English version is under construction)

そこら中に資料はあっても具体的運用方法に関する記述が少ないように感じたので、subversionリポジトリのバックアップストラテジーを考えてみました。以下のような方法です。

提案

  • subversion ツール群についての知識がある場合は、svnadmin dump と hot-backup.py を組み合わせて使う。前者はフックスクリプトとして利用し、コミット毎のダンプを取得する。後者は週次ミラーリングに利用する。
  • 簡易な方法として、rsync を使う方法。シングルユーザで利用していたり、更新頻度がそれほどでもないレポジトリであれば有効。
  • まったくわからない場合は手出ししないで、製品を買う。

設定方法

post-commit フックスクリプトを記述する

レポジトリ生成直後には、hookディレクトリにいくつかのサンプルが置かれている。

tmishina-macmini:/data/svn tmishina$ svnadmin create sample
tmishina-macmini:/data/svn tmishina$ ls sample/
total 16
-rw-r--r--    1 tmishina  admin  379  5  6 11:57 README.txt
drwxr-xr-x    4 tmishina  admin  136  5  6 11:57 conf
drwxr-xr-x    2 tmishina  admin   68  5  6 11:57 dav
drwxr-sr-x   10 tmishina  admin  340  5  6 11:57 db
-r--r--r--    1 tmishina  admin    2  5  6 11:57 format
drwxr-xr-x   11 tmishina  admin  374  5  6 11:57 hooks
drwxr-xr-x    4 tmishina  admin  136  5  6 11:57 locks
tmishina-macmini:/data/svn tmishina$ ls sample/hooks/
total 72
-rw-r--r--   1 tmishina  admin  2014  5  6 11:57 post-commit.tmpl
-rw-r--r--   1 tmishina  admin  1615  5  6 11:57 post-lock.tmpl
-rw-r--r--   1 tmishina  admin  2254  5  6 11:57 post-revprop-change.tmpl
-rw-r--r--   1 tmishina  admin  1542  5  6 11:57 post-unlock.tmpl
-rw-r--r--   1 tmishina  admin  2932  5  6 11:57 pre-commit.tmpl
-rw-r--r--   1 tmishina  admin  2016  5  6 11:57 pre-lock.tmpl
-rw-r--r--   1 tmishina  admin  2763  5  6 11:57 pre-revprop-change.tmpl
-rw-r--r--   1 tmishina  admin  1987  5  6 11:57 pre-unlock.tmpl
-rw-r--r--   1 tmishina  admin  2136  5  6 11:57 start-commit.tmpl

まず post-commit.tmpl を post-commit に名称変更し、例えば以下のように記述する。

#!/bin/sh

REPOS="$1"
REV="$2"
SVNADMIN=/sw/bin/svnadmin
DUMPDIR=/data/backup/dump
ZIP=/usr/bin/zip

"$SVNADMIN" dump "$REPOS" -r "$REV" --incremental > "$DUMPDIR"/"$REV" 
$ZIP ${DUMPDIR}/${REV}.zip ${DUMPDIR}/${REV}
rm ${DUMPDIR}/${REV}

このコードでは、コミットされたばかりのrevisionをダンプしてzipアーカイブに保存する(SVNADMIN, DUMPDIR, and ZIP は対象環境に合致するよう変更する)。DUMPDIRはレポジトリと物理的に異なるディスクにおいておくのがよい。

編集後、post-commitのパーミッションを755(実行属性付き)に変更しておく。

hot-backup.pyを設定する

hot-backup.pyはsubversion付属のホットバックアップツール(ホットバックアップでは、リポジトリが変更されている最中でもバックアップを取ることができる)。初期設定では64個のバージョンを保存することになっているが、実際には最新の1個さえあればよい(その1個は最新状態の完全なミラーになっている)ので、これを書き換える。hot-backup.py から以下の記述を見つけて、"64" を "1" に変える。

# Number of backups to keep around (0 for "keep them all")
num_backups = 64

初期バックアップを作成する

コミットが発生する前に、hot-backup.py を使って初期バックアップ(ミラー)を作成しておく。例えば/data/svn/sampleというレポジトリを/data/backup/以下にミラーした場合は、以下のようにコマンドを実行する。

% hot-backup.py /data/svn/sample /data/backup

hot-backup.py は /data/backup/sample-1 というディレクトリを生成する。中身は /data/svn/sample と全く同じになっているはず。ここで「1」はバックアップ取得時点における最新リビジョン番号なので、環境によっては1ではないこともある。

スケジュールの作成

hot-backup.py によるミラーリングをスケジュールに載せる。スケジュールで実行する作業は以下の二つ。

  1. ミラー作成
  2. ダンプ削除

前述の通り、ミラーは完全なバックアップになっているので、その時点までのダンプファイルは必要なくなる。ゆえにダンプファイルはこの時点で削除してよい。

スケジューリングの方法はOSによって異なる。例えば OpenSUSE 10 であれば、以下のようなスクリプトを /etc/cron.daily/ にコピーして、実行属性をセットしておく。

#! /bin/sh
REPOS=/data/svn/sample
BACKUPDIR=/data/backup
DUMPDIRNAME=dump
HOTBACKUP=/sw/share/svn/tools/hot-backup.py

${HOTBACKUP} ${REPOS} ${BACKUPDIR} && rm ${BACKUPDIR}/${DUMP}/*.zip

Emacs Muse (2)

en

Today's topic is the settings for Japanese.

ja

基本的な設定を行うために、まずは参考文献に挙げた各ページを見つつ、muse関係の設定を.emacsに記入します。

掛けるフックは以下のように設定しました。outline, auto-fill, flyspell の各マイナーモードを起動します。

(setq muse-mode-hook
 '(lambda ()
    (setq outline-regexp "*+")
    (setq outline-minor-mode t)
    (setq auto-fill-mode t)
    (setq flyspell-mode t)
))

更にここから「あるプロジェクトではエンコーディング Shift_JIS にして、別のプロジェクトでは ISO-8859-1 とする」ということもやってみようと思いましたが、あえなく失敗。以下のようにセットしても、結局反映されませんでした(全プロジェクトがISO-8859-1になる)。何か間違っているんでしょう…。またの機会に試してみることにします。

(add-to-list 'muse-project-alist
      '("myProject"
         ("~/muse/myproj/src" :default "index")
         (:base "html" :path "~/muse/myproj/html"
          :muse-html-encoding-default 'shift-jis-japanese-dos
          :muse-html-meta-http-equiv "Content-Type"
          :muse-html-meta-content-type "text/html"
          :muse-html-meta-content-encoding "Shift_JIS"
          :muse-html-charset-default "Shift_JIS"
          )
         (:base "pdf" :path "~/muse/myproj/tex")))
(add-to-list 'muse-project-alist
      '("public-en"
         ("~/muse/pub-en/src" :default "index")
         (:base "html" :path "~/muse/pub-en/html"
muse/pub-en/src/muse/pub-en/src/muse/pub-en/src/)
         (:base "pdf" :path "~/muse/pub-en/tex")))

参考文献

本日の作業メモ(in Japanese Only)

個人的な作業メモです。

  • 管理下のデータをsubversionレポジトリに移行
    • 結局、ほとんどのデータはシンクロの手間を省くためにsubversion管理にするのがよい
  • RapidSVNの試用
  • バックアップストラテジー
    • Documents and Settings はバックアップ、あと ls-R を取っておく

Emacs Muse (1)

en

"Emacs Muse" is a publishing environment for Emacs, and I thought that I could replace personal wiki pages.

I've used PukiWiki, one of the good solutions to manage personal memo and bookmarks. However, wiki clones such as PukiWiki require a web server such as apache. The maintainance of web servers costs; the web servers should be installed in the all computers which I want to use the PukiWiki, furthermore security patches should be applied immediately.

The Emacs Muse does not suffer from the web server-related troublesome problems.
Today I've got the code, and began to use the Emacs Muse. My first impression is good; some further trials are needed, but I think the combination of the Emacs Muse and some web-based bookmark service can substitute the combination of PukiWiki and Apache.

ja

(英語の前置詞難しい…)

Emacs Muse という、Emacs用のpublishingシステムがある。これで個人的に使っているwikiを代替できるかも、と思った。

以前からPukiWikiを使ってメモやリンクを管理していて、いい方法だと思っていた。しかしwikiには「webサーバを立ち上げておかなければならない」という欠点がある。メモを取りたい全てのマシンにapacheを入れ、セキュリティパッチを常に適用し続ける、といった管理は結構高く付く。

Emacs Museの場合はそんな心配はない。今日試してみたところでは、なかなかいい感じだった。いくつか試した方がいいことはあるが、Emacs Museはてなブックマークを組み合わせれば、PukiWiki+Apacheの環境を代替できそう。

Comparison: RefTeX v.s. YaTex as a \ref and \label managing / どっちが \ref と \label をうまく操作できるか

item RefTeX YaTeX
on-demand label generation N/A OK
completion list good moderate

English

YaTeX supports on-demand \label generation (when user types "C-c s SPC ref" YaTeX inserts a \label automatically if the target section or figure does not have a label), but the completion list of YaTeX does not satisfy user's requirement. For example, all of \item are shown in the list, but most of the entries makes user be difficult to find the entry user want to refer. Another is that the list often excludes some \subsection and \subsubsection headings.


RefTeX has an capability to show good completion list with useful keyboard accelerators and selective list (if type "s" RefTeX shows sections only). However RefTeX does not have a function that supports on-demand label generation.


I wish RefTex could generate \label automatically...

日本語

YaTeX で C-c s SPC ref とたたいて \ref の挿入をするとき、もしも対象となるセクション(とか図とか式とか)に \label がない場合、自動的に label を生成してくれる機能がある(ユーザにラベルを入力するよう尋ねてくる)。が、そのとき出てくる補完リストがいけてない。\item も全部出てくるので、取り込みたい \section を見つけるのに苦労する。そのうえなぜか時々 \subsection とかが出てこなくなる。バグか私の設定ミスか…


RefTeX の場合、一覧はとても見やすい上に、キーボードショートカットも使いやすい(セクションだけをリストする、とかができる)。
しかし残念なことに、その場で label を自動生成してくれはしない…


RefTeX が自動生成してくれればいいんだけど。