try wp-gopher.py



Gopher プロトコルでこのサイトにアクセスできるようにしたかったので、Wordpress の投稿内容を表示するpython で書かれたスクリプトを試してみる。gopher://odorikani.net でブラウザが対応していれば画像のようになるはず。

まず、https://github.com/LawnGnome/wp-gopher からソースを入手して展開する。場所は何処でも良いけど、とりあえず/usr/loca/src とかにする。


# pwd
/usr/local/src/wp-gopher/

# apt-get install xinetd
# apt-get install python-mysqldb

# vi /etc/xinetd.conf

service gopher
{
disable = no
id = gopher
socket_type = stream
port = 70
protocol = tcp
user = nobody
wait = no
server = /usr/local/sbin/wp-gopher.py
}

# cp wp-gopher.ini.dist /etc/wp-gopher.ini
# vi /etc/wp-gopher.ini

//適切に自分の環境に合わせて設定

# cp wp-gopher.py /usr/local/sbin/
# service xinetd stop
# service xinetd start
# tail -f /var/log/syslog

xinetd Version started with libwrap loadavg options compiled in.
Started working: 1 available service


で、ルータのport forwarding などを設定すれば動くはず。一応gopher でアクセスできるようになってるんだが、どうもpython のスクリプトが問題なのか解らないがうまく動いてない。エラーログとかapache じゃないし解らんなぁ。もしかするとUTF-8 で日本語だからかも。一応スクリプト書いた人はUTF-8 でいけるはずって書いてあるんだけど、その場合は無理かも。


I wanted the server is able to access via gopher protocol and show wordpress contents, so that I tried a script written in python. If your browser can handle gopher protocol, then you can see as the image above: gopher://odorikani.net.

First, get a source from https://github.com/LawnGnome/wp-gopher and extract it. The location can be anything, but I just put it at /usr/loca/src .


# pwd
/usr/local/src/wp-gopher/

# apt-get install xinetd
# apt-get install python-mysqldb

# vi /etc/xinetd.conf

service gopher
{
disable = no
id = gopher
socket_type = stream
port = 70
protocol = tcp
user = nobody
wait = no
server = /usr/local/sbin/wp-gopher.py
}

# cp wp-gopher.ini.dist /etc/wp-gopher.ini
# vi /etc/wp-gopher.ini

//set your environment

# cp wp-gopher.py /usr/local/sbin/
# service xinetd stop
# service xinetd start
# tail -f /var/log/syslog

xinetd Version started with libwrap loadavg options compiled in.
Started working: 1 available service


Then, check router(s) of port forwarding, and it should work. At least gopher protocol is working, but the script does not show logs somehow, though seemingly the script does not look at the database. I cannot figure out the problem because there is no clue where the logs are. The problem would be UTF-8 Japanese though the author mentioned using UTF-8, so I suppose it should work. Anyway, in that case, there is hopeless.

Avoid Command + Q on Mac OS Snow Leopard

Mac OS のキーボードショートカットの変更は微妙に説明不足で解りづらい。Command + q を別のキー操作に置き換えたかったんだが、存在しないキーショートカットだと無視される。なので既存のショートカットキーをそのまま当てはめた。Application Shortcuts のShow Help Menu をCommand + q に変更した。


Most of web page doesn’t explain so much about how to change key board shortcuts. I just wanted to avoid the function of Command +q because I often mis-operate Command +w instead of q, and quit a software completely. Then I was trying to change the keyboard shortcut, but it doesn’t work at all. The reason was actually very simply: MacOS ignore shortcuts if functions do not exist, which means a function does not work if I assign N/A or blank or whatever for Command + q. Therefore, I simply re-assigned Show Help Menu in Application Shortcuts as Command + q.

New HDD WD20EARX

サーバのHDD が不良セクタ吐いているのでWD20EARX を新しく購入。2TB のもの。mycom.nl で108Euro だった。日本円だと12000円くらいか、現在同じモデルをkakaku.com で調べると9000円くらいなので、3000円ほど高いが仕方ない。

どうもWD20EARX は余り評判が良くないようだ。突然死が少ないながらもあるらしい。



I bought a new HDD, WD20EARX, 2TB SATA because one of the server’s HDD has kept having bad sectors. The cost is 108EUR at mycom.nl, means approximately 12000JPY. Now the same model can be found 9000JPY at kakaku.com, but I have no choice.

I have heard a rumor that WD20EARX would has lost its reputation because of sudden death, the case is rare though.

Restore WordPress Data

スクリプトによるバックアップ ( 詳しくはここ) からのリストアはとても簡単。スクリプトは2つのファイル、SQLdata.sql.bz2 とbackupOfWholeSite.tar.bz2 を生成する。Write permission や Owner などの心配など必要なく、そのまま移動させれば良いだけだ。

# bzip2 -d SQLdata.sql.bz2
# mysql -h mysqlhostserver -u mysqlusername
-p databasename < SQLdata.sql

Enter password: (enter your mysql password)

# tar jxvf backupOfWholeSite.tar.bz2
# mv backupOfWholeSite/ /yourWebbyLocation/backupOfWholeSite/



After using scripts ( article here ), restoring WordPress data is very easy. The scripts generate 2 files: SQLdata.sql.bz2 and backupOfWholeSite.tar.bz2. You do't need to worry write permission or owner, means just move the site entirely.

# bzip2 -d SQLdata.sql.bz2
# mysql -h mysqlhostserver -u mysqlusername
-p databasename < SQLdata.sql

Enter password: (enter your mysql password)

# tar jxvf backupOfWholeSite.tar.bz2
# mv backupOfWholeSite/ /yourWebbyLocation/backupOfWholeSite/

Windows XP SP3 does not update

Windows XP SP 2 を新規でインストールしたところ、何度やってもWindows Update が行われず、KB2497281 が表示される。これを解決するには、

1. Windows Update エージェントの最新バージョンを入手する方法に関する。現在、WindowsUpdateAgent3.0 が最新なのでそのパッケージをダウンロードする。

2. IEを終わらせて、ダウンロードしたパッケージを当てる。

3. リブートしてWindowsUpdateを実行。

これだけなんだが、辿り着くのに何故か時間がかかった。


Right after installing Windows XP SP2 as completely new install, I could not update the OS to XP3 even though I tried few times and got a same error KB2497281. Here is the way how to solve the error:

1. Get the newest version of Windows Update Agent, which is currently 3.0, from here.

2. Quit IE, and install the package which you get.

3. Reboot the computer and try Windows Update again.

That’s it, so simple. Though it took time somehow.