一.there are three key features of OOP languages:
* Encapsulation
*Interitance
*polymorphism
Encapsulation through the use of classes and objects
classes contains data declarations and method declarations
A class can be viewed as a blueprint of an object.
e.g each STring object contains specific characters
2009年2月9日 星期一
2009年1月9日 星期五
Network(三)---Protocol(2)
TPC/IP
Application Layer
Host-to-Host Transport Layer/Transport Layer
Network :ayer
Network Access Layer
IP功能
採用非connectionless 的傳送方式.
它提供的服務,可以分為以下三項:
1.封包分割.
2.定址功能
3.選徑(路由)功能
IP地址分類:
本來IP是一個32位元的二進位數值,因為難記,IP地址分為4段,每段有8個位元.再轉為十進制數值.
如:
十進位 202 115 43 41
二進位 11001010 01110011 00101001 00101001
32位元的IP位址中,包含2類訊息:
Network ID
Host ID
IP分為5個等級,分別以A,B,C,D,E
A類IP地址只有126個,以第一個位元組為網絡編號(1-126)
B類IP地址為128-191
C類IP地址為192-223
D類IP地址 係特殊位址,它不分網絡編號OR主機編號.為224-239
E類IP地址為240-247
Network Broadcast Address
如:150.11.35.215 150.11.255.255
Default SubnetMask
如:150.11.35.215 255.255.0 .0
220.224.24.1 255.255.255.0
Application Layer
Host-to-Host Transport Layer/Transport Layer
Network :ayer
Network Access Layer
IP功能
採用非connectionless 的傳送方式.
它提供的服務,可以分為以下三項:
1.封包分割.
2.定址功能
3.選徑(路由)功能
IP地址分類:
本來IP是一個32位元的二進位數值,因為難記,IP地址分為4段,每段有8個位元.再轉為十進制數值.
如:
十進位 202 115 43 41
二進位 11001010 01110011 00101001 00101001
32位元的IP位址中,包含2類訊息:
Network ID
Host ID
IP分為5個等級,分別以A,B,C,D,E
A類IP地址只有126個,以第一個位元組為網絡編號(1-126)
B類IP地址為128-191
C類IP地址為192-223
D類IP地址 係特殊位址,它不分網絡編號OR主機編號.為224-239
E類IP地址為240-247
Network Broadcast Address
如:150.11.35.215 150.11.255.255
Default SubnetMask
如:150.11.35.215 255.255.0 .0
220.224.24.1 255.255.255.0
2009年1月2日 星期五
Network(三)---Protocol(1)
OSI層次
Application layer
Presentation layer
Session Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
Application layer
提供一個介面,比應用程式可以透過網絡協定傳輸資料.
如:Telnet SMTP POP HTTP FTP
Presentation layer
接受資料封包,負責資料表達方式的相關處理.
功用:
1.資料壓縮
2.資料加密.
3.資料編碼轉換
4.通訊協定轉換
Session Layer
接受和發送資料電腦各個通訊程式,建立和維護一對一的會議.
功用:
1.建立通訊會議
2.控制會議
3.資料同步錯誤恢復
Transport Layer
功用:
1.把較大的資料塊分割成封包,把封包比下一層.
2.錯誤偵測
3.連接埠(PORT)分配
Network Layer
1.封包傳送路徑之choose.
2.流量控制,佢分open loop and close loop
Data Link Layer
1.提供直接透過區域網路連接的2點之間可靠.無錯誤的連接.
頁框分割和控制/
2.接收網路層資料,重新分剖為易傳輸的頁框.
3.提供媒體存取控制
4.流量控制和偵錯.
Physical Layer
它從資料連接層接收頁框,之後轉為傳輸媒介可傳輸的訊號.
Physical Layer規定通訊雙方使用的通訊設備的規格/
Application layer
Presentation layer
Session Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
Application layer
提供一個介面,比應用程式可以透過網絡協定傳輸資料.
如:Telnet SMTP POP HTTP FTP
Presentation layer
接受資料封包,負責資料表達方式的相關處理.
功用:
1.資料壓縮
2.資料加密.
3.資料編碼轉換
4.通訊協定轉換
Session Layer
接受和發送資料電腦各個通訊程式,建立和維護一對一的會議.
功用:
1.建立通訊會議
2.控制會議
3.資料同步錯誤恢復
Transport Layer
功用:
1.把較大的資料塊分割成封包,把封包比下一層.
2.錯誤偵測
3.連接埠(PORT)分配
Network Layer
1.封包傳送路徑之choose.
2.流量控制,佢分open loop and close loop
Data Link Layer
1.提供直接透過區域網路連接的2點之間可靠.無錯誤的連接.
頁框分割和控制/
2.接收網路層資料,重新分剖為易傳輸的頁框.
3.提供媒體存取控制
4.流量控制和偵錯.
Physical Layer
它從資料連接層接收頁框,之後轉為傳輸媒介可傳輸的訊號.
Physical Layer規定通訊雙方使用的通訊設備的規格/
2009年1月1日 星期四
Network(二)---Media+equipment
Media
coaxial cable
優點:
被一層金屬包住可以抵抗干擾
缺點:
成本高,難以彎曲
twisted-pair cable
銅線組成,分無遮蔽雙絞線.和有遮蔽絞線
optical Fiber
分Multimode Fiber and Single-mode Fiber
equipment
network interface card
功用:
1.把需要發送的資料傳輸媒介可以傳輸的訊號.
2接收傳輸媒介的訊號,傳換為電腦可處理的資料.
eg.PCI網路卡.
Modem
eg,ADSL Modem
Repeater
功用:
整形,放大.轉送信息.
HUB
功用:
用在建置STAR,連接多個網絡.
Bridges
功用:連接多個網絡.like Repeater,轉送信息(但它可以依據轉送訊息的目的地).
Switch
功用:
提高網路存取效能.
Router
IP 分享器.
功用:
用來連接區域網絡和網際網絡.可以比區域網絡(LAN)內的電腦共用一個對外的網路連線.
coaxial cable
優點:
被一層金屬包住可以抵抗干擾
缺點:
成本高,難以彎曲
twisted-pair cable
銅線組成,分無遮蔽雙絞線.和有遮蔽絞線
optical Fiber
分Multimode Fiber and Single-mode Fiber
equipment
network interface card
功用:
1.把需要發送的資料傳輸媒介可以傳輸的訊號.
2接收傳輸媒介的訊號,傳換為電腦可處理的資料.
eg.PCI網路卡.
Modem
eg,ADSL Modem
Repeater
功用:
整形,放大.轉送信息.
HUB
功用:
用在建置STAR,連接多個網絡.
Bridges
功用:連接多個網絡.like Repeater,轉送信息(但它可以依據轉送訊息的目的地).
Switch
功用:
提高網路存取效能.
Router
IP 分享器.
功用:
用來連接區域網絡和網際網絡.可以比區域網絡(LAN)內的電腦共用一個對外的網路連線.
2008年12月30日 星期二
Network(一)---Topology
電腦網絡分硬體與軟體

分散式網絡=中央電腦具備計算功能的電腦.其他外部電腦只能叫終端機(terminal),非一台具備獨立功能的電腦,因為這些終端機並不能進行運算,只把資料透過線路傳送到中央電腦上.等待中央電腦進行處理,處理完畢後的結果,再透過線路,傳回送終端機.
client/server架構=每一台電腦都有獨立處理,儲存資料的能力.
Network Topology
Bus Network Topology=把多台電腦連接到單一通訊媒體上網路連線上.

優點:
成本低,不需集線器或交換器等等,網路連線耗材較少.
缺點:
1.電腦數量上升,網路傳輸衝突大增,傳輸效能會下降.
2.當某一網路線中斷時,由於訊號反射影響,整個網路的通訊都會中斷.
Star Network Topology
Star Network Topology=把所有電腦連接到一個中央裝置(集線器,交換器,路由器)所組成的Topology結構.
優點:
1.中央裝置型以方便網絡管理,限制節點存取.
2.中央節點外的連線故障只會影響使用該連線的電腦,不會影響網路其他電腦.
3.只要中央裝置支援,不同目的地通訊可以同時進行.
缺點:
1.較BUS貴,另行購置中央裝置,所需的網路連線較長.
2.中央節點發生故障,整個網路就不能通訊.
Ring Topology
Ring Topology=透過網路媒首尾連接,組成的一個環狀網路.
2008年12月29日 星期一
Maths(四)---Probability and Statistics(9)
Standard Normal Distribution
例一.
Given Z is the normal distribution with μ = 0 and σ2 = 1, i.e. Z ~ N(0, 1), findthe following probabilities using the standard normal table.
(a) P(Z ≤ 1.25)
(b) P( Z >. 2.33)
(c) P(0.5 <. Z <. 1.5)
(d) P(Z <. -1.25)
(e) P(-1.5 <. Z <. -0.5)
Solution
(a) P(Z ≤ 1.25) = 0.8943
(b) P(Z > 2.33) = 1 – Φ(2.33) = 1 – 0.9901 = 0.0099
(c)P(0.5 <. Z <. 1.5) = Φ(1.5) – Φ(0.5)
= 0.9332 – 0.6915
= 0.2417
(d) P( Z <. -1.25) = P(z >. 1.25)= 1 – Φ(1.25)= 1 – 0.8944= 0.1056
(e)P(-1.5 <. Z <. -0.5) = P(0.5 <. Z <. 1.5) = 0.2417
例二.
Given Z is the normal distribution with μ = 0 and σ2 = 1, i.e. Z ~ N(0, 1), findthe value of c if
(a) P(Z ≤ c) = 0.8888
(b) P( Z > c) = 0.37
(c) P(Z <. c) = 0.025 (d) P(0 ≤ Z ≤ c) = 0.4924
Solution
(a) Φ(c) = 0.8888
c = 1.22
(b) 1 − Φ(c) = 0.37
Φ(c) = 0.63
c = 0.34
(c) Obviously c is negative and the standard normal table cannot be used directly.Recall that P(Z < -z) = P(Z > z) .
∴ 0.025 = P(Z <. c) = P(Z >. -c) = 1 – Φ(-c)
i.e. Φ(-c) = 0.975
-c = 1.96
c = -1.96
(d) P(0 ≤ Z ≤ c) = Φ(c) – 0.5 = 0.4924
Φ(c) = 0.992
c = 2.43
Standardization of Normal Random Variables
例一.
Suppose X ~ N(10, 6.25).
Find the following probabilities
(a) P(X <. 13)
(b) P(X > 5)
(c) P(8 <. X <. 15)
Solution
Let Z =(X -10)/2.5
(a) P(X <. 13) = P(Z <(13−10)/2.5)= P(Z <.1.2) = 0.8849
(b)P(X > 5) = P(Z >(5 −10)/2.5)= P(Z > -2) = P(Z <.2) = 0.9773
(c) P(8 <.X <.15)=P((8-10)/2.5<.Z<.(15-10)/2.5) = P(-0.8 <.Z <.2) = Φ(2) – Φ(-0.8) = Φ(2) – (1 – Φ(0.8))
= 0.9772 – (1 – 0.7881)
= 0.7653
例二.
The lifetime of light bulbs produced in a certain factory is normally distributed withmean 3000 hours and standard deviation 50 hours. Find the probability that arandomly chosen light bulb has a lifetime less than 2900 hours.
Solution
Let X be the lifetime of a randomly chosen light bulb. Then X ~ N(3000, 502).
Let Z =(X − 3000)/50
P(X <.2900) = P(Z <.-2) = 1 – 0.9772 = 0.0228
例三. If a random variable has the normal distribution with μ = 40 and σ = 2.4, find theprobabilities that it will take a value (a) less than 43.6 (b) greater than 38.2 (c) between 40.6 and 43.0 (d) between 35.8 and 44.2. Solution Let X be the random variable.
(a) P(X <.43.6) = P(Z <.(43.6− 40)/2.4)= P(Z <.1.5) = 0.9332
例一.
Given Z is the normal distribution with μ = 0 and σ2 = 1, i.e. Z ~ N(0, 1), findthe following probabilities using the standard normal table.
(a) P(Z ≤ 1.25)
(b) P( Z >. 2.33)
(c) P(0.5 <. Z <. 1.5)
(d) P(Z <. -1.25)
(e) P(-1.5 <. Z <. -0.5)
Solution
(a) P(Z ≤ 1.25) = 0.8943
(b) P(Z > 2.33) = 1 – Φ(2.33) = 1 – 0.9901 = 0.0099
(c)P(0.5 <. Z <. 1.5) = Φ(1.5) – Φ(0.5)
= 0.9332 – 0.6915
= 0.2417
(d) P( Z <. -1.25) = P(z >. 1.25)= 1 – Φ(1.25)= 1 – 0.8944= 0.1056
(e)P(-1.5 <. Z <. -0.5) = P(0.5 <. Z <. 1.5) = 0.2417
例二.
Given Z is the normal distribution with μ = 0 and σ2 = 1, i.e. Z ~ N(0, 1), findthe value of c if
(a) P(Z ≤ c) = 0.8888
(b) P( Z > c) = 0.37
(c) P(Z <. c) = 0.025 (d) P(0 ≤ Z ≤ c) = 0.4924
Solution
(a) Φ(c) = 0.8888
c = 1.22
(b) 1 − Φ(c) = 0.37
Φ(c) = 0.63
c = 0.34
(c) Obviously c is negative and the standard normal table cannot be used directly.Recall that P(Z < -z) = P(Z > z) .
∴ 0.025 = P(Z <. c) = P(Z >. -c) = 1 – Φ(-c)
i.e. Φ(-c) = 0.975
-c = 1.96
c = -1.96
(d) P(0 ≤ Z ≤ c) = Φ(c) – 0.5 = 0.4924
Φ(c) = 0.992
c = 2.43
Standardization of Normal Random Variables
例一.
Suppose X ~ N(10, 6.25).
Find the following probabilities
(a) P(X <. 13)
(b) P(X > 5)
(c) P(8 <. X <. 15)
Solution
Let Z =(X -10)/2.5
(a) P(X <. 13) = P(Z <(13−10)/2.5)= P(Z <.1.2) = 0.8849
(b)P(X > 5) = P(Z >(5 −10)/2.5)= P(Z > -2) = P(Z <.2) = 0.9773
(c) P(8 <.X <.15)=P((8-10)/2.5<.Z<.(15-10)/2.5) = P(-0.8 <.Z <.2) = Φ(2) – Φ(-0.8) = Φ(2) – (1 – Φ(0.8))
= 0.9772 – (1 – 0.7881)
= 0.7653
例二.
The lifetime of light bulbs produced in a certain factory is normally distributed withmean 3000 hours and standard deviation 50 hours. Find the probability that arandomly chosen light bulb has a lifetime less than 2900 hours.
Solution
Let X be the lifetime of a randomly chosen light bulb. Then X ~ N(3000, 502).
Let Z =(X − 3000)/50
P(X <.2900) = P(Z <.-2) = 1 – 0.9772 = 0.0228
例三. If a random variable has the normal distribution with μ = 40 and σ = 2.4, find theprobabilities that it will take a value (a) less than 43.6 (b) greater than 38.2 (c) between 40.6 and 43.0 (d) between 35.8 and 44.2. Solution Let X be the random variable.
(a) P(X <.43.6) = P(Z <.(43.6− 40)/2.4)= P(Z <.1.5) = 0.9332
(b) P(X > 38.2) = P(Z >(38.2 − 40)/2.4) = P(Z > -0.75) = P(Z <.0.75) = 0.7734
(c) P(40.6 <.X <.43.0) = P((40.6 -40)/2.4<.Z<.(43.0-40)/2.4)
= P(0.25 <.Z <.1.25)
= 0.2957
(d)P(35.8 <.X <.44.2) = P((35.8-40)/2.4<.z<.(44.2-40)/2.4)
= P(-1.75 <.Z <.1.75)
= 0.9198
Maths(四)---Probability and Statistics(8)
Poisson Distribution
A manufacturer of a certain type of LCD-screen finds that the number of “deadspots” on a screen is a Po(0.8) random variable. A screen with more than 3 “deadspots” has to be sold at a discount. Find the proportion of screens that are sold at a discount.
Solution
例二.
The probability distribution for a Poisson random variable X iS
例一.
A manufacturer of a certain type of LCD-screen finds that the number of “deadspots” on a screen is a Po(0.8) random variable. A screen with more than 3 “deadspots” has to be sold at a discount. Find the proportion of screens that are sold at a discount.
Solution
Let X be the number of “dead spots” on a screen. Then X ~ Po(0.8).
The proportion of screens that are sold at a discount
= P( X > 3)
= 1 – p(0) – p(1) – p(2) – p(3)
= 0.00908
例二.
A radio active source is emitting α-particles at an average of 2.6 particles per minute.Find the probability that the number of particles emitted in one minute is
(a) 0
(b) 1
(c) more than 1
Solution
Let X be the number of particles emitted in one minute.
(c) P(X > 1) = 1 – 0.0743 – 0.193 = 0.7327
Poisson Approximation to Binomial Distribution
A rule of thumb for the conditions under which this approximation may be used is
n ≥ 100, np <>
例一.
A company ships memory chips in boxes of 200. It is known that 0.001 of all thechips are defective. Find the probability that less than 3 chips in a box aredefective.
Solution
Let X be the number of defective chips in a box. Then X ~ Bin(200, 0.001).The average number of defective chips in a box = 200 × 0.001 = 0.2The distribution of X may be approximated by Po(0.2).
Let X be the number of defective chips in a box. Then X ~ Bin(200, 0.001).The average number of defective chips in a box = 200 × 0.001 = 0.2The distribution of X may be approximated by Po(0.2).
訂閱:
文章 (Atom)







