2016年1月29日金曜日

MacでVLCを複数ウィンドウで再生できるようにする

VLCで同時に複数画面で再生したい場合、Windowsでは設定に「複数ウィンドウで開く」という項目があるらしいが、Macには無い。

その場合は、スクリプトエディタでスクリプトを書けば開けるようになる。

Mac標準のスクリプトエディタを起動し、以下のスクリプトを貼り付ける。
VLCはアプリケーションフォルダに置いておく。

on run
    do shell script "open -n /Applications/VLC.app"
    tell application "VLC" to activate
end run

on open theFiles
    repeat with theFile in theFiles
        do shell script "open -na /Applications/VLC.app " & quote & (POSIX path of theFile) & quote
    end repeat
    tell application "VLC" to activate
end open
ファイル→書き出すをクリックし、適当な名前を付け、保存する場所を選ぶ。
ドラッグアンドドロップなどで使いやすいようにデスクトップなど。
ダイアログ下部の「ファイルフォーマット」を「アプリケーション」に変更し、保存する。

出来たアプリケーションに動画ファイルをドロップすれば、複数ウィンドウで再生できるようになる。

参考
http://superuser.com/questions/894840/how-to-play-multiple-instances-of-vlc-on-mac

2016年1月1日金曜日

Elasticsearch 2.0系 でupdateしようとしたときに illegal_argument_exception が出る時の対処法

Elasticsearchで更新しようとして、
curl -X POST http://localhost:9200/blog/article/1/_update?pretty -d '{"script": {"inline": "ctx._source.content = \"new content\""}}'
を実行して
{
  "error" : {
    "root_cause" : [ {
      "type" : "remote_transport_exception",
      "reason" : "[Artie][127.0.0.1:9300][indices:data/write/update[s]]"
    } ],
    "type" : "illegal_argument_exception",
    "reason" : "failed to execute script",
    "caused_by" : {
      "type" : "script_exception",
      "reason" : "scripts of type [inline], operation [update] and lang [groovy] are disabled"
    }
  },
  "status" : 400
}
のようなエラーが返ってくるとき、elasticsearch.ymlに設定が必要になる。
/etc/elasticsearch/elasticsearch.yml とかにあるファイルを開いて
script.inline: on
を書けば良い。

ググったら↓こう書けと出てくるページもあるが、2.0系では有効ではない。
script.engine.groovy.inline.aggs: on
script.groovy.sandbox.enabled: true

参考
http://stackoverflow.com/questions/25291927/how-to-run-update-elasticsearch-with-external-script
http://t-cyrill.hatenablog.jp/entry/2014/04/19/161422