2010年11月25日木曜日

android memory leak

1.adb shellにて出力先の書き込み権限をつける
chmod 777 /data/misc

2.ソースに下記出力用の処理追加する
try {
long outputString = System.currentTimeMillis();
Debug.dumpHprofData("/data/misc/" + Long.toString(outputString) + ".hprof");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

3.android実機の/data/misc/配下には.hprofファイルが生成されるんで、
androidツールキットtools配下のhprof-convを利用してhprofのフォーマット
を変換する
./hprof-conv input.hprof output.hprof

4. output.hprofをeclipseのMemory Analysis perspective(eclipseのMATプラグイン)
からfile->open heap dump..
から開くとメモリリーク解析結果が表示される

2010年10月17日日曜日

use web camera in ubuntu 10.10

try guvcview -d /dev/videoX change X to 0 1 2 and test


original page is this one:
https://help.ubuntu.com/community/UVC

2010年10月8日金曜日

複数ファイルに処理をかけるシェル

すべてのファイルの最後一行にend of lineを追加するシェル

#!/bin/sh

FILES=`find . -name '*.txt'`

for file in ${FILES}; do
echo -n $file: replacing...
cp -p $file $file.bak
echo "end of file" >> $file
echo done
done

2010年8月2日月曜日

linux ファイル名 rename

次の様なmp3ファイルに対し、以下の2つの変更をしたい。

Brian Kelly - Cool Blue (www-briankelly-com).mp3
Doug Wisler - Serenity Shores (www-dougwisler-com).mp3

(例7) 「 ( url )」を削除する。

$ rename 's/ \(\S*\)//' *.mp3

(例8) 演奏者のファーストネームをイニシャル化する。

$ rename 's/^?[a-z]* /\. /' *.mp3

元ネタ
https://wiki.ubuntulinux.jp/UbuntuTips/FileHandling/RenameCommand

2010年7月28日水曜日

linux GUI表示について

GNOME Display Managerが表示できなくなった場合は
service gdm stop
service gdm start
で解消できるかも

2010年6月30日水曜日

about git

http://marklodato.github.com/visual-git-guide/

2010年6月17日木曜日

テキストファイル内のタブをスペースに置き換えるには

1. linuxコマンドで実行する場合
expand --tab=4 before.txt > after.txt

2. vimで実施する場合
:set expandtab
:set ts=4
:retab


逆の動作をする場合
linux:
unexpand before.txt > after.txt