Eclipseでsshextを使ってCVSに接続しているアナタ達へ

MACとかLinux上で簡単にコマンドラインからCVSに接続することができます。
まずは~/.bashrcに以下の情報を入力

export CVS_RSH="ssh"
export CVSROOT=":ext:<username>@<cvsserverアドレス>:/path/to/cvsroot"

alias cvsstatus = "cvs status | grep Status | grep -v Up"
alias cvsupdate = "cvs update -P -C -d"

でこれを適用後、CVSチェックアウトしたら完了です。

cvs -d $CVSROOT checkout プロジェクト名

参照:http://hurring.com/scott/cvs_ssh
通常検索する場合、grep -H "検索言葉" ***.txt 又は grep -H "検索言葉" *
だけど、grepだと時間が掛かる。ファイル数が多い場合はかなり時間が掛かる。

その場合は↓ 高速検索だ
for i in `find ./`; do grep -H "検索言葉" $i; done

ImageMagick : http://www.imagemagick.org/script/index.php
PerlMagick : http://www.imagemagick.org/script/perl-magick.php
PerlMagick cpan : http://search.cpan.org/~jcristy/PerlMagick/

ImageMagickのインストール

tar xvfz ImageMagick.tar.gz
cd ImageMagick-6.5.8
./configure
make
sudo make install
make check
make checkでエラーが出なかったらOK
Ubuntuの方は ~/.bashrc に export LD_LIBRARY_PATH=/usr/local/lib を追加する

PerlMagickのインストール

ImageMagickのソースディレクトリにそのバージョンに適用しているPerlMagickが入っているのでそれを使う

perl Makefile.pl
make
sudo make install

私の場合はmake中に下記のエラーが出た。

LD_RUN_PATH="/usr/local/src/ImageMagick-6.5.8-6/PerlMagick/../magick/.libs:/usr/lib" cc  -L../magick/.libs -lMagickCore -shared -O2 -L/usr/local/lib -fstack-protector  Magick.o  -o blib/arch/auto/Image/Magick/Magick.so     \
       -L/usr/local/src/ImageMagick-6.5.8-6/PerlMagick/../magick/.libs -lMagickCore -lperl -lm      \
     
/usr/bin/ld: cannot find -lperl
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/Image/Magick/Magick.so] Error 1


これはlibperlが見つからないため。
 
sudo apt-get install libperl-dev

で入る。これでもう一度make && make installインストールをしたら問題なく入る







コマンドラインを立ち上げてAndroid SDKのtoolsフォルダーまでいく

C:\eclipse-android\android-sdk-windows\tools>
C:\eclipse-android\android-sdk-windows\tools>adb logcat

C:\eclipse-android\android-sdk-windows\tools>adb logcat *:I
↑Infoだけ出力したい場合

と入力すれば、
ソース側で
import android.util.Log;

Log.i("Hello World");

などしたものは全部出力されますよ。

------------------------------------------------------
出力モード:
Log.v (for verbose)
   Log.d (for debug)
   Log.i (for info)
   Log.w (for warnings)
   Log.e (for errors)

参考サイト: http://developer.android.com/guide/developing/tools/adb.html


Apache 2.2を再インストールして、mod_perlを使ってCatalystを起動する設定にした。
Catalyst内のページにアクセスしようとするとApacheのログに下記のエラーが出てた。

[Mon Sep 14 13:48:50 2009] [error] [client 203.112.27.142] client denied by server configuration: /www/dev_koba206/cpanauthors, referer: http://www.koba206.com/

何が原因か探していたら、server confのアクセス権限の設定がApache 2.20から変わっていた。

Apache 2.0のは
<Directory > Options FollowSymLinks AllowOverride None </Directory>

Apache 2.20のは
<Directory> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory>

このセキュリティー強化設定でvhostのdocrootへのアクセス拒否を起こしていたのであった。

コメントアウトしたらOKになったけど、セキュリティー上どうなんだろ。。
djangoをインストール後、新しいウェブアプリケーション・ディレクトリを作成する。
$ django-admin.py startproject <ウェブアプリケーション名>

作成したウェブアプリをテスト起動するには
$ python manage.py runserver localhost:8000


ウェブアプリケーションの
を適用させるにはDBにテーブルを作る必要がある。それをするには下記のコマンドで実行

$ python manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (Leave blank to use 'tkobayashi'):
E-mail address: koba206@gmail.com
Password:
Password (again):
Superuser created successfully.
Installing index for auth.Permission model
Installing index for auth.Message model

参考URL:
http://docs.djangoproject.com/en/dev/intro/tutorial01/#intro-tutorial01

DjangoでMySQLを使う際にはまずMySQLdbをインストールする必要がある。

#python
>>> import MySQLdb
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
ImportError: No module named MySQLdb
とMySQLdbが入っていないエラーが出る。
pythonではapt-getみたいな自動インストールツールがある。それがeasy_install。これを使うには、まずsetuptoolsをインストールする必要がある。

wget http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py2.5.egg#md5=fe67c3e5a17b12c0e7c541b7ea43a8e6
sh setuptools-0.6c9-py2.5.egg

wget http://sourceforge.net/projects/mysql-python/files/mysql-python-test/MySQL_python-1.2.3c1-py2.6-linux-i686.egg
easy_install MySQL_python-1.2.3c1-py2.6-linux-i686.egg


↓結局こっちのほうがうまくいった
apt-get install python-mysqldb
apt-get install libmysqlclient15-dev

root@koba206:/usr/local/src# python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb

↑エラーが出なかったので、これでOK

参考URL
http://sourceforge.net/projects/mysql-python/files/

nginxではpsuedo streamingという途中再生が可能になる機能に対応している。
たとえば、ファイル名の後に ?start=60 を付けたら最初から1分後からの動画をリクエストできるようになっている。
これをiPhoneでも試してみようと思ったが、少し工夫が必要だったのでここに記載する。
iPhoneで再生可能なのはmp4ファイルで、videoがh.264、audioがaacだ。
 
Ngix&mp4ストリーミングモジュールインストール方法
cd /usr/local/src/
wget http://www.nginx.eu/download/sources/nginx-0.7.9.tar.gz
tar zxvf nginx-0.7.9.tar.gz

 ②

cd /usr/local/src/
svn export http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/nginx nginx_http_h264_streaming
svn export --force http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/mp4split nginx_http_h264_streaming

③ 

cd /usr/local/src/nginx-0.7.9
./configure --add-module=/usr/local/src/nginx_http_h264_streaming --sbin-path=/usr/local/sbin --with-debug
make
sudo make install

 vi /usr/local/nginx/conf/nginx.conf

下記を追加(43行目ぐらい):

location ~ \.mp4$ {
  mp4;
}
⑤起動
sudo /usr/local/sbin/nginx

-------------------------------------------------------------------------------------------------------

モジュールのSVN(iphone再生対応しているブランチ):

http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/nginx

http://h264.code-shop.com/svn/h264/tags/mod_h264_streaming-2.1rc2/mp4split

 

参照:

http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Nginx-Version2 - Nginxインスト方法

(ここに記載されているmod_h264_streamingはiPhone再生に対応していない)

http://h264.code-shop.com/trac/discussion/1/18 - iPhone range requestの件

http://h264.code-shop.com/trac/wiki/ReleaseNotes-Version2 iPhone range requestに対応しているバージョン

 


Perl5.10以前ではPseudo-hashesを使っても「Pseudo-hashes are deprecated」とWarningが出るだけだったが、Perl5.10では使えなくなっている。Restricted hashesを使うように推奨されている。

もちろん、Pseudo-hashesは使わないほうがいいのだが、どうしてもという時がある。
その時は、Class::PseudoHash モジュールを使うとPseudo-hashesをPerl5.10でも使えることができる。みたい。。


参照:Pro Perl
通常root権限がないとCPANモジュールをインストールする時に権限がなくてエラーが発生する。
これを回避することができる。自分にフルアクセスがあるホームディレクトリに全部入れることができる。

perl -MCPAN -e shell

cpan[6]> o conf makepl_arg "LIB=~/perl/lib \
    > INSTALLMAN1DIR=~/perl/man/man1 \
    > INSTALLMAN3DIR=~/perl/man/man3"
    makepl_arg         [LIB=~/perl/lib INSTALLMAN1DIR=~/perl/man/man1 INSTALLMAN3DIR=~/perl/man/man3]
Please use 'o conf commit' to make the config permanent!
↑フルパスじゃないとダメみたい

cpan[3]> o conf makepl_arg "LIB=/mnt/nfs/home/tkobayashi/perl/lib \
    > PREFIX=/mnt/nfs/home/tkobayashi/perl \
    > INSTALLMAN1DIR=/mnt/nfs/home/tkobayashi/perl/man/man1 \
    > INSTALLMAN3DIR=/mnt/nfs/home/tkobayashi/perl/man/man3"
    makepl_arg         [LIB=/mnt/nfs/home/tkobayashi/perl/lib PREFIX=/mnt/nfs/home/tkobayashi/perl INSTALLMAN1DIR=/mnt/nfs/home/tkobayashi/perl/man/man1 INSTALLMAN3DIR=/mnt/nfs/home/tkobayashi/perl/man/man3]
Please use 'o conf commit' to make the config permanent!

↓これでちゃんと値が入力しているかチェック
cpan[5]> o conf makepl_arg
    makepl_arg         [LIB=/mnt/nfs/home/tkobayashi/perl/lib PREFIX=/mnt/nfs/home/tkobayashi/perl INSTALLMAN1DIR=/mnt/nfs/home/tkobayashi/perl/man/man1 INSTALLMAN3DIR=/mnt/nfs/home/tkobayashi/perl/man/man3]
Type 'o conf' to view all configuration items

この修正をコミットしておく
cpan[3]> o conf commit
commit: wrote '/mnt/nfs/home/tkobayashi/.cpan/CPAN/MyConfig.pm'
これだけだとインストール先のディレクトリがPerlのライブラリパスに含まれていないので、せっかくインストールしたモジュールが使えない。そこでPERL5LIBという環境変数を設定する。

export PERL5LIB=/mnt/nfs/home/tkobayashi/perl/lib:/mnt/nfs/home/tkobayashi/perl/lib/site_lib

.bash_profileなどにこの設定を書き込んでおくとそのユーザでは常に野良インストールしたモジュールが使えるようになる。逆に言えばこの設定を無効にすることで、いつでも元の環境に戻すことができる。