2011年7月4日 星期一

證明 數學歸納法

數學歸納法(Mathematical Induction)立論的基礎是來自良序原理(Well-Ordering Property)。
Well-Ordering Property告訴我們:任何自然數的非空子集合會有一個最小的元素。(Every nonempty subset of the set of positive integers has a least element.)
首先我先以矛盾證法證明數學歸納法的合法性(Validity):
假設已知條件:P(1)為真,且對所有自然數k而言,敘述 P(k)→P(k+1)亦為真。

為證明P(n)對所有自然數n而言恆為真的話,假設存在一自然數n使得P(n)為假。
則根據Well-Ordering Property,讓P(n)為假的自然數集合S是自然數集合N的子集合,它是個非空集合,並存在一個最小的元素,我們稱此元素為m。
我們知道m不會是1,因為已知條件中已給出P(1)為真。
既然m不會是1,那它必定是個大於1的自然數,m-1也會是個自然數。
此外,因為m-1小於m,m已經是S集合中最小的元素了,所以m-1並不屬於S集合;因此知P(m-1)必為真。
所以我們得到了P(m-1)為真,P(m)為假的結論。
根據已知條件:P(k)→P(k+1) (P(k)為真,則P(k+1)亦為真),我們知道這個結論和已知條件矛盾,因此推得"存在一自然數n使P(n)為假"這個敘述是錯誤的!
也就是說,P(n)對任何自然數n恆為真。得證!



refer from:
http://tw.myblog.yahoo.com/jw!XToZojWTHRI2EfbctdR8ag--/article?mid=1628&prev=1629&l=f&fid=78

2011年4月28日 星期四

OS: Thrashing



在電腦的知識範疇中,談到thrashing前,必需先大略對虛擬記憶體有點瞭解。虛擬記憶體的概念,其實就是將硬碟割出一塊空間,這一部份我們叫他虛擬記憶體(Virtural Memory),而原先的記憶體稱之為實體記憶體(Physical Memory)。  


當程式要執行的部份,從虛擬記憶體(亦即硬碟)搬至實體記憶體再執行。由於硬碟的空間遠較實體記憶體為大,因此使用虛擬記憶體這種技術,可以讓程式不受實體記憶體容量的限制,此外由於行程(Process,指執行中的程式)只需將部份載入實體記憶體,因此可以讓更多行程同時存於實體記憶體,進而提高CPU的使用率。


  Thrashing這種現象指的是,欲使用的資料從虛擬記憶體搬至實體記憶體時,實體記憶體可能有一部份需要被置換,這些置換的資料再搬至虛擬記憶體中。然而被置換的部可能馬上又要使用,再從虛擬記憶體搬至實體記憶體,如此週而復始不斷進行搬運的動作,所有時間都花在這些無關緊要的置換搬運,導致CPU的使用率大幅降低。  
 
現在的電腦可以同時執行很多程式,如此CPU使用率大幅上升,達到最大的利用。然而執行的程式超過一定的數量時,很容易發生thrashing,CPU的使用率反而降低。


refer from:
http://blog.xuite.net/draz/draz/3826515

2011年3月2日 星期三

Win7: Login your computer directly

Open command application and key "netplwiz" to set the mode you want.

refer from:

Win7: Open admin

cmd (use admin's authority by right click)

then "net user administrator /active:yes"

if you want to close it,change yes to no.

2011年2月25日 星期五

Freerunner: The problem of enter in Terminal emulator

1. You need to change keyboard type in your freerunner that is ruKeyboard.apk from
http://android-on-freerunner.googlecode.com/issues/attachment?aid=4852331778978639661&name=ruKeyboard_v1.3.4.apk&token=2bf2f673c0b38748aa74d0894a6006a0

2. Use adb to instll this .apk.

refer from:
http://code.google.com/p/android-on-freerunner/issues/detail?id=55

Android: Install ADB in Linux

1. Download http://www.4shared.com/file/182574434/c1225b3d/AndTools.html then execute it.


2. Install Android SDK from http://developer.android.com/sdk/index.html.

3. Update Android SDK that need to include ADB.

4. You need to add environment variable so input "$gedit ~/.bashre".

5. Key in "export PATH=$PATH:/home/light/sdk/platform-tools/" in the end of the opened file. (depends on your path of ADB)

6. Key in "$adb" to check this instruction existed.

refer from:
http://developer.android.com/index.html

2011年2月24日 星期四

Android: Install .apk by ADB

After your google phone has already communicated with computer successfully,input " $adb install xxx.apk"