2011年10月アーカイブ

duはいろいろオプションがあるけど、

du -sh [FILE]...

で指定したファイルやディレクトリ下の合計容量が分かる。

例:
$ du -sh *

カテゴリー:

久しぶりに再起動しようとしたら、強制的にfsckが始まってしまい、なかなか起動しないー。
fsck(実際にはe2fsck)のタイミングを設定、表示するには、tune2fsを使う。

表示
# tune2fs -l /dev/sda1
・・・(略)
Mount count:              7
Maximum mount count:      27
Last checked:             Fri Oct 21 03:41:32 2011
Check interval:           15552000 (6 months)
Next check after:         Wed Apr 18 03:41:32 2012
・・・(略)
自動チェックを停止する
# tune2fs -c 0 -i 0 /dev/sda1 
tune2fs 1.39 (29-May-2006)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
確認
# tune2fs -l /dev/sda1
・・・(略)
Mount count:              7
Maximum mount count:      -1
Last checked:             Fri Oct 21 03:41:32 2011
Check interval:           0 (<none>)
・・・(略)


tune2fs でfsckを制御 - ike-daiの日記

カテゴリー:

$ sudo port upgrade outdated

とやると、アップデートのあるportsをすべてまとめてアップグレードできるが、特定のportsはアップグレードしたくない場合は、以下のように演算子を使って指定できる。

例: PHP関連はアップグレードしたくない場合
$ sudo port upgrade outdated and not php*

Excluding packages from MacPorts operations | The Gippy Pages

カテゴリー:

# useradd -o -u UID LOGIN
で、同じユーザID(UID)を持つ異なるユーザ名(LOGIN)のユーザを作成できるが、これはどんな時に使うのだろうか。


linux - Multiple *NIX Accounts with Identical UID - Server Fault

[Chapter 4] Users, Groups, and the Superuser

カテゴリー:

最初できないかと思ったけど、WebExceptionのResponseプロパティで取得できた。
HttpWebRequest.GetResponse()は、ステータスコードが2xx以外の場合は例外WebExceptionを投げるようである。例外をcatchしてResponseを見ればよい。

HttpWebResponse response = null;
try
{
    response = (HttpWebResponse)myHttpWebRequest.GetResponse();
}
catch (WebException e)
{
    response = (HttpWebResponse)e.Response;
}

// Get the stream associated with the response.
Stream receiveStream = response.GetResponseStream();

// ...以下略


.Net HttpWebRequest.GetResponse() raises exception when http status code 400 (bad request) is returned - Stack Overflow

カテゴリー:

カテゴリー: