ストリーミングダウンロードスクリプト

[twitter:@riocampos]さんにトラックバックをいただいた(http://d.hatena.ne.jp/riocampos+tech/20130726/p1)ので自分が使用しているスクリプトをさらします。*1

動作環境

  • Mountain Lion, ffmpeg(homebrew), ruby-1.9.3(rvm) です。

ffmpeg は homebrew でインストールしています。

$ brew info ffmpeg
ffmpeg: stable 1.2.1, HEAD
http://ffmpeg.org/
/usr/local/Cellar/ffmpeg/1.2.1 (149 files, 26M) *
  Built from source with: --with-rtmpdump, --with-openssl, --with-ffplay
From: https://github.com/mxcl/homebrew/commits/master/Library/Formula/ffmpeg.rb
$ ffmpeg -version
ffmpeg version 1.2.1
built on Jul 20 2013 13:52:04 with Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-librtmp --enable-ffplay --enable-openssl
libavutil      52. 18.100 / 52. 18.100
libavcodec     54. 92.100 / 54. 92.100
libavformat    54. 63.104 / 54. 63.104
libavdevice    54.  3.103 / 54.  3.103
libavfilter     3. 42.103 /  3. 42.103
libswscale      2.  2.100 /  2.  2.100
libswresample   0. 17.102 /  0. 17.102
libpostproc    52.  2.100 / 52.  2.100

スクリプト


すごい久しぶりのダイアリーではてな記法がぜんぜん思い出せません。

*1:[twitter:@riocampos]さんが最新版(V2.0)を公開されています。http://d.hatena.ne.jp/riocampos+tech/20130729/p1

Rails 2.3 と mongrel_cluster と prefix

Railsを2.3にあげたら、こんなエラーが出るようになった。

'load_missing_constant': uninitialized constant ActionController::AbstractRequest (NameError)

Rails 2.3 には、 ActionController::AbstractRequest がなくなったので、mongrel_cluster で prefix を指定することができなくなったということらしい。

かわりに、どうするかというと

(1) config/environment.rb か config/environments/production.rb あたりに、次のように書いておく。

config.action_controller.relative_url_root = '/prefix'

(2) このままだと、cssやjsなどの静的ファイルが読めなくなるので、apacheの設定を次のように変更しておく。

# Rails 2.3の設定
ProxyPass /prefix http://localhost:4000
ProxyPassReverse /prefix http://localhost:4000

# Rails 2.2の設定
# ProxyPass /prefix http://localhost:4000/prefix
# ProxyPassReverse /prefix http://localhost:4000/prefix

Windowsのephemeral port

Windowsではephemeral portとして1024以降を使用する。
ephemeral port として使用してほしくないポートがある場合は、レジストリに記述することによって除外することができる。

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\ReservedPorts

REG_MULTI_SZなので、複数の範囲が指定できる。

1098-1099
1433-1434

あたりを指定しておくと幸せになれる。

PCが変わると、つい設定を忘れてしまいがち。

ソースコードのエンコーディング

JBossSeamが作成するbuild.xmlにはソースコードエンコーディング指定がないので、忘れずに指定すること

<property name="javac.encoding" value="utf-8" />

<target name="compile" depends="init"
        encoding="${javac.encoding}" ...

JSFと数値文字参照

今頃になってやっとJBossSeam 2.0を使い始めたら、以前に解決したはずの数値文字参照の問題が再発している。
JSFの実装がApache MyFacesからSunのJSF RIに変わったためらしい。

http://sourceforge.jp/projects/japan-jbug/wiki/JSF-I18N

手順

  1. jsf-1.2_04-b16-p02-NoNumericCharacterReference-20080317.zip をダウンロードして展開する。
  2. $(JBOSS_HOME)/server/default/deploy/jboss-web.deployer/jsf-libs のjsf-api.jar, jsf-impl.jarを差し替える。