memo.xight.org - 2006-02-10

2006-02-10 Fri

テストを楽にするための Auto Fill Bookmarklet

- Summary
何度も同じ入力する時間が無駄なので
JavaScript で Auto Fill.

ただし,onKeyUp などのイベントが起こらないので注意!

- Template

<form>
	<input id="id_name" name="name" />
</form>


javascript:(function(){
	if (document.getElementById(id)){
		function set(id,val){
			document.getElementById(id).value=val;
		}
	}
	set('id_name','value');
}()


- Sample
<form>
	<input id="name"     name="name" />
	<input id="mail"     name="mail" />
	<input id="company"  name="company" />
	<input id="position" name="position" />
	<input id="post"     name="post" />
	<input id="zip"      name="zip" />
	<input id="address"  name="address" />
	<input id="tel"      name="tel" />
	<input id="fax"      name="fax" />
	<textarea id="contents" name="contents"></textarea>
</form>

javascript:(function(){
	if (document.getElementById(id)){
		function set(id,val){
			document.getElementById(id).value=val;
		}
	}
	set('name','User Name');
	set('mail','user@example.com');
	set('company','Xight Inc.');
	set('position','Web Solution Group');
	set('post','Sub Leader');
	set('zip','000-0000');
	set('address','Tokyo');
	set('tel','00-1111-2222');
	set('fax','00-1111-3333');
	set('contents',"This is test.\nThis is test.");
}()


- 追記 [2006-02-14]
cl.pocari.org - 2006-02-13 より
getElementsByName版
javascript:(function(){
	if (document.getElementByName(name)){
		function set(name,val){
			document.getElementByName(name).value=val;
		}
	}
	set('name','value');
}()

watch - プログラムを定期的に実行し,出力をフルスクリーンで表示する

- Summary
変更点を強調表示してくれる -d オプションが便利.

- Usage (抜粋)
watch [-d] [-n <seconds>] <command>

- watch の使い方
メールを監視する

$ watch -n 60 from


ディレクトリの中身の変化を監視する

$ watch -d ls -l


dateコマンドを定期的に発行 (ネットワークが切断されないように)

$ watch -n 10 date


- Reference
Debian パッケージディレクトリ検索 (バイナリ) - procps