Embest S3C44B0X Evaluation Board
RTC Test Example
RTC Check(Y/N)? y
Set Default Time at 2004-12-31 FRI 23:59:59
Set Alarm Time at 2005-01-01 00:00:01
... RTC Alarm Interrupt O.K. ...
Current Time is 2005-01-01 SAT
00:00:01
RTC Working now. To set date(Y/N)? y
Current date is (2005,01,01, SAT). input new date (yy-mm-dd w): 5-2-23 3
Current date is: 2005-02-23 WED
RTC Working now. To set time(Y/N)? y
Current time is (00:00:21). To set time(hh:mm:ss): 19:32:5
Current Time is 2005-02-23 WED
19:32:
鄰接矩陣類的根是A d j a c e n c y W D i g r a p h,因此從這個(gè)類開始。程序1 2 - 1給出了類的描述。程
序中,先用程序1 - 1 3中函數(shù)Make2DArray 為二組數(shù)組a 分配空間,然后對(duì)數(shù)組a 初始化,以描述
一個(gè)n 頂點(diǎn)、沒有邊的圖的鄰接矩陣,其復(fù)雜性為( n2 )。該代碼沒有捕獲可能由M a k e 2 D A r r a y
引發(fā)的異常。在析構(gòu)函數(shù)中調(diào)用了程序1 - 1 4中的二維數(shù)組釋放函數(shù)D e l e t e 2 D
E:\Visual_C__MFC擴(kuò)展編程實(shí)例 例18
動(dòng)態(tài)地抓取應(yīng)用程序的屏幕圖像并將其打印。
上一個(gè)實(shí)例打印的是文檔的報(bào)表,而不是當(dāng)前出現(xiàn)在屏幕上的內(nèi)容。在本例中,將實(shí)現(xiàn)
屏幕抓取并打印其內(nèi)容。M F C 為打印視提供了有限的支持, 但只要用M F C 在
C Vi e w : : O n D r a w ( )中所提供的設(shè)備環(huán)境,就可以繪制自己的視。在打印視的時(shí)候, M F C只需調(diào)
用具備打印機(jī)設(shè)備環(huán)境的O n D r a w ( )函數(shù)即可。但是,如果不繪制自己的視,例如,用一個(gè)或
者一個(gè)以上的控件窗口填充自己的視就不會(huì)打印任何東西。每個(gè)控件將使用自己的設(shè)備環(huán)境
將自己打印到屏幕,因此打印視的唯一途徑就是抓取屏幕(拷貝其內(nèi)容到一個(gè)位圖對(duì)象)并將其
打印到打印機(jī)。由于該功能整個(gè)與位圖相關(guān),因此將該功能封裝到了位圖類中。
給定n個(gè)整數(shù)a , a , ,an 1 2 組成的序列。序列中元素i a 的符號(hào)定義為:
ï î
ï í
ì
- <
=
>
=
1 0
0 0
1 0
sgn( )
i
i
i
i
a
a
a
a
符號(hào)平衡問題要求給定序列的最長(zhǎng)符號(hào)平衡段的長(zhǎng)度L,即:
þ ý ü
î í ì
= + - = å
=
£ £ £
max 1| sgn( ) 0
1
j
k i
i j n k
L j i a 。
例如,當(dāng)n=10,相應(yīng)序列為:1,1,-1,-2,0,1,3,-1,2,-1 時(shí),L=9。
How the K-mean Cluster work
Step 1. Begin with a decision the value of k = number of clusters
Step 2. Put any initial partition that classifies the data into k clusters. You may assign the training samples randomly, or systematically as the following:
Take the first k training sample as single-element clusters
Assign each of the remaining (N-k) training sample to the cluster with the nearest centroid. After each assignment, recomputed the centroid of the gaining cluster.
Step 3 . Take each sample in sequence and compute its distance from the centroid of each of the clusters. If a sample is not currently in the cluster with the closest centroid, switch this sample to that cluster and update the centroid of the cluster gaining the new sample and the cluster losing the sample.
Step 4 . Repeat step 3 until convergence is achieved, that is until a pass through the training sample causes no new assignments.