2009-12-08
touch -m ファイルの修正時刻を変更
$ find ./foldername -type f | xargs touch -m *.*
書式
touch [−acfhm] [−r file] [−t CC]YY]MMDDhhmm[.SS? file …
説明
「touch」コマンドは、「file」で指定したファイルのアクセス時刻と変更時刻を、現在の時刻に変更します。ファイルが存在しなかった場合は、デフォルトのパーミッションで、サイズ「0」のファイルが作成されます。
- a
アクセス時刻のみを変更します。
- c
ファイルが存在しない場合も新規に空ファイルを作成しません。
−f
ファイルのアクセス許可がない場合でも、強制的に実行します。
−h
ファイルがシンボリックリンクの場合、リンクが指すファイルの代りにシンボリックリンク自身の時刻を変えます。
- m
修正時刻だけを変更します。
- r file
現在の時刻の代わりに file と同じタイムスタンプに書き換えます。
−t CC]YY]MMDDhhmm[.SS]
MMは月、DDは日、hhは時、mmは分、CCは西暦年の上2桁、YYは西暦年の下2桁、ssは秒を表します。
file
タイムスタンプを変更するファイル。
サンプル
例1)filenameファイルを新規に作成。
$ touch filename
例2)filenameファイルのタイムスタンプを1982年3月15日9時34分に変更。
$ touch -t 198203150934 filename
2009-11-28
iPod nano skins 4th/5th
むかし、マリオのスキンが欲しくって欲しくって探したけど日本には無くて、諦めたんだけど、今では日本で販売されていた!!!他にも面白そうなスキンをチョイス。あ、探していたのはまだiPod(1st)の時代。ここでは現行の4th/5thをチョイス。
2009-11-27
iPod nano skins 1st/2nd
むかし、以下にあるマリオのスキンが欲しくって欲しくって探したけど日本には無くて、諦めたんだけど、今では日本で販売されていた!!!他にも面白そうなスキンをチョイス。あ、探していたのはまだiPod(1st)の時代。だから以下は1st/2nd用だす。
2009-10-07
PDK
http://pdk.android.com/online-pdk/guide/index.html
Android Platform Developer's Guide
Welcome to the Android Platform Dev Guide! This guide provides an under-the-hood introduction to the Android platform, and is designed for platform developers and manufacturers building Android-powered devices.
If you're a software developer interested in developing applications for Android, please visit the Android Developers site.
---
こんなサイトがある。独自の証明書の作り方やビルド方法など面白い。
2009-10-06
protected-broadcast
1.6のgitコミット差分を見ていたら、Broadcastの一部がSystemからしかSendできないようになっていた。確かにこれまではウソのシステム通知が可能で、自作アプリからぼんぼんシステムエラーを起こすことができた。それがAndroidの思想かと思っていたが、やはり対応したのだな。
AndroidManifest.xmlに<protected-broadcast>というタグが追加されている。ここに記載することで、そのActionは守られるようになる。
../core/res/AndroidManifest.xml <-- ================================================ --> <-- Special broadcasts that only the system can send --> <-- ================================================ --> <eat-comment /> <protected-broadcast android:name="android.intent.action.SCREEN_OFF" /> <protected-broadcast android:name="android.intent.action.SCREEN_ON" /> <protected-broadcast android:name="android.intent.action.USER_PRESENT" /> <protected-broadcast android:name="android.intent.action.TIME_TICK" /> <protected-broadcast android:name="android.intent.action.TIMEZONE_CHANGED" /> <protected-broadcast android:name="android.intent.action.BOOT_COMPLETED" /> <protected-broadcast android:name="android.intent.action.PACKAGE_INSTALL" /> <protected-broadcast android:name="android.intent.action.PACKAGE_ADDED" /> <protected-broadcast android:name="android.intent.action.PACKAGE_REPLACED" /> <protected-broadcast android:name="android.intent.action.PACKAGE_REMOVED" /> <protected-broadcast android:name="android.intent.action.PACKAGE_CHANGED" /> <protected-broadcast android:name="android.intent.action.PACKAGE_RESTARTED" /> <protected-broadcast android:name="android.intent.action.PACKAGE_DATA_CLEARED" /> <protected-broadcast android:name="android.intent.action.UID_REMOVED" /> <protected-broadcast android:name="android.intent.action.CONFIGURATION_CHANGED" /> <protected-broadcast android:name="android.intent.action.BATTERY_CHANGED" /> <protected-broadcast android:name="android.intent.action.BATTERY_LOW" /> <protected-broadcast android:name="android.intent.action.BATTERY_OKAY" /> <protected-broadcast android:name="android.intent.action.ACTION_POWER_CONNECTED" /> <protected-broadcast android:name="android.intent.action.ACTION_POWER_DISCONNECTED" /> <protected-broadcast android:name="android.intent.action.ACTION_SHUTDOWN" /> <protected-broadcast android:name="android.intent.action.DEVICE_STORAGE_LOW" /> <protected-broadcast android:name="android.intent.action.DEVICE_STORAGE_OK" /> <protected-broadcast android:name="android.intent.action.AIRPLANE_MODE" /> <protected-broadcast android:name="android.intent.action.NEW_OUTGOING_CALL" /> <protected-broadcast android:name="android.intent.action.REBOOT" />
Broadcastの送信処理は、ActivityManagerServiceに実態がある。ここで、callingUidがシステムからの送信要求であるかを見るように変更が加えられている。
../services/java/com/android/server/am/ActivityManagerService.java /* * Prevent non-system code (defined here to be non-persistent * processes) from sending protected broadcasts. */ if (callingUid == Process.SYSTEM_UID || callingUid == Process.PHONE_UID || callingUid == Process.SHELL_UID || callingUid == 0) { // Always okay. } else if (callerApp == null || !callerApp.persistent) { try { if (ActivityThread.getPackageManager().isProtectedBroadcast( intent.getAction())) { String msg = "Permission Denial: not allowed to send broadcast " + intent.getAction() + " from pid=" + callingPid + ", uid=" + callingUid; Log.w(TAG, msg); throw new SecurityException(msg); } } catch (RemoteException e) { Log.w(TAG, "Remote exception", e); return BROADCAST_SUCCESS; } }
2009-10-05
Broadcastのウソ通知
Broadcastは自作アプリからでもウソのシステム通知が可能である。例えば、以下のようにBroadcastを送信するだけで、バッテリー残量が無い!とシステムは警告ポップアップを表示する。
Intent intent = new Intent( "android.intent.action.BATTERY_CHANGED" ); intent.putExtra( "level", 0 ); sendStickyBroadcast( intent );
しかし、1.6では一部だけウソ通知に対応したようだ。
protected-broadcast
http://d.hatena.ne.jp/Raspberry-Farad/20091006/1258976816
2009-10-04
Toast(トースト)を使う
http://developer.android.com/reference/android/widget/Toast.html
import android.widget.Toast; String str = "Hello!!!"; Toast.makeText( this, str, Toast.LENGTH_LONG ).show();
| Time | Details |
|---|---|
| LENGTH_LONG | Show the view or text notification for a long period of time. |
| LENGTH_SHORT | Show the view or text notification for a short period of time. |
2009-10-03
悪魔城伝説
「吸血コウモリにも注意、当たったら、オダブツ」
人生にも、同じことが言えます。
どんな人でも、いつか必ず、死というものは、やって参ります。だからこそ、生きるということを、大切に、考えなければなりません。生きてるからこそ、嬉しいことがあり、悲しいことがあり、その、生きるという、修行を、卒業できてからこそ、自分の、命の、終焉というものを、迎えることができるのです。
芦田住職
