need to add
2011年3月25日金曜日
mvc Android sample
http://www.anddev.it/index.php/topic,32.msg32.html?PHPSESSID=9sergpmb12t8utmv0t22gc11ribdlo5b#msg32
need to add to android.xml
need to add
2011年3月21日月曜日
java enum
1. package test;
2.
3. /**
4. * enumのテスト
5. * @author miyasaka
6. */
7. public class EnumTest {
8.
9. enum test {
10. one ("いち", 1),
11. two ("に", 2),
12. three ("さん", 3),
13. four ("よん", 4),
14. five ("ご", 5),
15. six ("ろく", 6),
16. seven ("なな", 7),
17. eight ("はち", 8),
18. nine ("きゅう", 9),
19. ten ("じゅう", 10);
20.
21. private final String hiragana; //ひらがな
22. private final int number; // 数字
23.
24. private test(String hiragana, int number) {
25. this.hiragana = hiragana;
26. this.number = number;
27. }
28.
29. public String Hiragana() { return hiragana; }
30. public int Number() { return number; }
31. }
32.
33.
34. /**
35. * @param args
36. */
37. public static void main(String[] args) {
38.
39. int count1 = 0;
40. int count2 = 0;
41.
42. for (test t1: test.values()) {
43. System.out.println("[" + t1.ordinal() + "]:" +
44. t1.toString() + " " +
45. t1.Hiragana() + " - " +
46. t1.Number() );
47. count1 += t1.ordinal();
48. count2 += t1.Number();
49. }
50.
51. System.out.println("count1:" + count1);
52. System.out.println("count2:" + count2);
53.
54. }
55. }
2.
3. /**
4. * enumのテスト
5. * @author miyasaka
6. */
7. public class EnumTest {
8.
9. enum test {
10. one ("いち", 1),
11. two ("に", 2),
12. three ("さん", 3),
13. four ("よん", 4),
14. five ("ご", 5),
15. six ("ろく", 6),
16. seven ("なな", 7),
17. eight ("はち", 8),
18. nine ("きゅう", 9),
19. ten ("じゅう", 10);
20.
21. private final String hiragana; //ひらがな
22. private final int number; // 数字
23.
24. private test(String hiragana, int number) {
25. this.hiragana = hiragana;
26. this.number = number;
27. }
28.
29. public String Hiragana() { return hiragana; }
30. public int Number() { return number; }
31. }
32.
33.
34. /**
35. * @param args
36. */
37. public static void main(String[] args) {
38.
39. int count1 = 0;
40. int count2 = 0;
41.
42. for (test t1: test.values()) {
43. System.out.println("[" + t1.ordinal() + "]:" +
44. t1.toString() + " " +
45. t1.Hiragana() + " - " +
46. t1.Number() );
47. count1 += t1.ordinal();
48. count2 += t1.Number();
49. }
50.
51. System.out.println("count1:" + count1);
52. System.out.println("count2:" + count2);
53.
54. }
55. }
2010年12月20日月曜日
android handler 非同期処理
http://www.adamrocker.com/blog/261/what-is-the-handler-in-android.html
http://labs.techfirm.co.jp/android/cho/1079
http://labs.techfirm.co.jp/android/cho/1079
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..
から開くとメモリリーク解析結果が表示される
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
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
#!/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
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
登録:
投稿 (Atom)