2016/05/03

SimpleCV installation on Windows

http://www.simplecv.org/download/
からダウンロードして実行,だけではうまくいかなかったのでメモ

環境: Windows 7 Enterprise
Python 2.7.10をインストール済み

Python 2.7.3をインストールしようとするので,キャンセル
(キャンセルしても,SimpleCV自体のインストールは何事もなく進む)

easy_install PIL がそんなもん見つからない,となってこけているので,
http://www.pythonware.com/products/pil/
ここから Python Imaging Library 1.1.7 for Python 2.7 をダウンロードしてインストール

easy_install cython が  Microsoft Visual C++ 9.0 is required でこけているので,
出力されたメッセージ通り http://aka.ms/vcpython27 からMicrosoft Visual C++ Compiler for Python 2.7をダウンロードしてインストールし,再度 easy_install cython を実行




2015/10/22

The remote session was disconnected because there are no Remote Desktop client access licenses available for this computer. Please contact the server administrator.

毎回検索するのでメモ

レジストリ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing を削除して再起動
(削除の前にexportしてバックアップを取っておくと安心)
mstsc.exeを管理者権限で実行する

2014/10/25

Android projectをtutorial通りに作るとエラーになる

環境
Android SDK + Eclipse
API19と21をダウンロード済み
どうも,21が出てからのエラーっぽい?

公式ページにあるtutorial通りにAndroid projectを作ると,
作ったMyFirstAppの他に,appcompat_v7というのができ,
これが
appcompat_v7\res\values-v21\styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
みたいなエラーを大量にはく.

下記のページ通り,http://developer.android.com/sdk/index.htmlから全部が入ったbundle-xxx.zipをダウンロードし,unzip.その中の,sdk\extras\android\support\v7を\android-sdk\extras\android\support\v7と置き換える.
これで,再度Android projectを作り直せば,appcompat_v7のエラーはなくなる
(Android projectごと作り直すのではなく,appcompat_v7のみimportし直すでも可)

んで,今度はこんなエラーが出る
[2014-10-24 21:20:00 - MyFirstApp] Found 2 versions of android-support-v4.jar in the dependency list,
[2014-10-24 21:20:00 - MyFirstApp] but not all the versions are identical (check is based on SHA-1 only at this time).
[2014-10-24 21:20:00 - MyFirstApp] All versions of the libraries must be the same at this time.

android-support-v4.jarというjarが違うらしい.
上記で置き換えたv7\appcompat\libsにあるものと
v4\にあるものが
違うとな
とりあえず,v4の下にあるものの方が,サイズが大きかったので,v4の下にあるものをv7\appcompat\libsの下にコピー
これでAndroid projectを作り直したら,エラーはなくなった.



参考
http://stackoverflow.com/questions/26521922/error-in-running-android-application-project-api-19

2014/05/23

npm installとやると,MSBUILDなんたらなエラーがでる

Windows 7 64bitの場合

Windows SDK for Windows 7.1をインストールすればよい.

ただし,普通にインストールしようとすると,これもまたエラーになるので,
Microsoft Visual C++ 2010 x86 Redistributable
・Microsoft Visual C++ 2010 x64 Redistributable
をアンインストールしてからインストールする.
その後,上記ソフト(MSのページからダウンロード可)をインストールする

参考:
http://www.projectgroup.info/tips/Others/comm_0004.html
http://support.microsoft.com/kb/2717426/de

2014/05/05

MongoDB as Windows service

Windows 7 32bit環境.

Document通りにサービスに登録しても起動できなかったのでメモ.
# 別のWindows 7 64bit環境ではドキュメント通りにできた...

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MongoDB\ImagePath

を下記の通りに変更.

"c:\Program Files\mongodb-win32-i386-2.4.8\bin\mongod.exe" --logpath "c:\Program Files\mongodb-win32-i386-2.4.8\log\mongodb.log" --serviceName MongoDB --service

重要なのは,MongoDB の前に --serviceName を入れることと,logpath はディレクトリ名じゃなくてファイル名にしないとダメみたい,という点.

参考: stackoverflow: Error 1053 When Starting Windows XP Service Running Mongo DB 1.6.3

2012/06/12

Ruby on Rails on Fedora 17

Fedora 17 上で Ruby on Rails を動かしたときのメモ.簡単には動かなかったので...

# yum install ruby  -> ruby, rubygems がインストールされる

$ gem install rails

$ rails new foo
$ cd foo

ま,ここまでは普通.

[error 1]
・症状
$ rails server
/home/hanayuki/.gem/ruby/1.9.1/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
        from /home/hanayuki/.gem/ruby/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:5:in `'
...(以下略)

・対処法
Gemfileに下記を追加
gem 'therubyracer'
$ bundle update

参考:http://d.hatena.ne.jp/kano4/20110708/javascript_runtime_error

[error2]
・症状
$ rails server
/home/hanayuki/.gem/ruby/1.9.1/gems/railties-3.2.5/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `active_record' for # (NoMethodError)

        from /home/hanayuki/herokucamp/rails_project/foo/config/application.rb:54:in `'
        from /home/hanayuki/herokucamp/rails_project/foo/config/application.rb:13:in `'
        from /home/hanayuki/herokucamp/rails_project/foo/config/application.rb:12:in `'
...(以下略)

・対処法
Gemfileに以下を追加
gem 'bigdecimal'
$ bundle update


これでやっと,rails server が動くようになります.

2012/01/21

python read subprocess stdout line by line


proc = subprocess.Popen(['python','fake_utility.py'],stdout=subprocess.PIPE)
for line in iter(proc.stdout.readline,''):
    print line

でまわす.

for line in proc.stdout:

ではうまくいかない

参考:
http://stackoverflow.com/questions/2804543/read-subprocess-stdout-line-by-line


追記:

hoge.sh | python foo.py

みたいな形で,パイプからの入力を標準入力で受ける場合も同じ.
CSV形式で読むならこんな感じ

csvreader = csv.reader(iter(sys.stdin.readline, ''))
for data_vals in csvreader:
    print data_vals

参考:
http://stackoverflow.com/questions/6556078/how-to-read-a-csv-file-from-a-stream-and-process-each-line-as-it-is-written