fix a bug
突然發現鏈路的接口描述都是vlan,而不是實際的物理口,為了找出出錯的原因,又浪費我幾乎一天的時間。還好,終于去掉了一個嚴重的bug。原來fdb表經常變化,每次提取的結果都不一樣,我修改程序,僅在需求時提取fdb表信息,這樣數據就比較準確了。posted @ 2007-07-28 21:26 afunms 閱讀(91) | 評論 (0) | 編輯 收藏
My Software,My Dream—Forge a more perfect NMS product.
posted @ 2007-07-28 21:26 afunms 閱讀(91) | 評論 (0) | 編輯 收藏
下午跟用戶溝通了一下,得知我們的軟件能自動畫出拓撲圖,對我們的軟件很感興。
終于到周末了,這周可真累壞了。但是收獲還是很大,呵呵。
posted @ 2007-07-27 18:56 afunms| 編輯 收藏
不論怎樣,在發現過程中,沒有拋出空指針錯誤已經讓我很滿意了。
posted @ 2007-07-26 19:14 afunms 閱讀(122) | 評論 (0) | 編輯 收藏
posted @ 2007-07-25 21:45 afunms 閱讀(133) | 評論 (0) | 編輯 收藏
posted @ 2007-07-24 21:04 afunms| 編輯 收藏
posted @ 2007-07-23 14:15 afunms 閱讀(141) | 評論 (0) | 編輯 收藏
我的第一個SOAP程序,這將成為我研究web service的開始
public class HelloClient
{
public String getName(String name)
{
return "你好" + name + ",歡迎來到Web服務的世界!";
}
}
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
import java.net.URL;
public class SayHelloClient
{
public static void main(String[] args)
{
try
{
String endpoint = "http://localhost:8080/axis/HelloClient.jws";
Service service = new Service();
Call call = (Call) service.createCall();
call.setOperationName(new QName(endpoint,"getName"));
call.setTargetEndpointAddress(new URL(endpoint));
String ret = (String) call.invoke(new Object[]{"zhangsan"});
System.out.println("return value is:" + ret);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
posted @ 2007-07-22 19:50 afunms 閱讀(208) | 評論 (0) | 編輯 收藏
The Fight Against Crime
Today the crime rate in some of our cities seems to be rising. Many citizens complain about the
thefts and robberies that take place in their street blocks. Therefore, more and more people are
appealing to the authorities to take strong measures to reduce the crime rate.
Faced with criminals, different people have different attitudes towards them. Some become so
frightened that they tend to give up fighting or to turn a blind eye to the criminals. Others, however,
are brave enough to fight the criminals even at the risk of their own lives. In their eyes, responsibility
is the most important of all the values that hold honest people together. Without it there can be no
self-respect, no trust, no law,ultimately, no society. There is no doubt that they set a good example
for all of us to follow.
As far as I am concerned, my suggestions are as follows. In the first place, every one of us should
receive a law education. Secondly, criminals must be punished severely. Finally, it is urgent to set up a
foundation to reward those who fight criminals. In the way we can stand up to any crime and smash it.
posted @ 2007-07-04 17:33 afunms 閱讀(703) | 評論 (0) | 編輯 收藏
Which is more important, health or wealth? When given this question, different people
have varied answers. Some insist that health plays a more important role in our life, while
others see more advantages arising from wealth.
The first group of people quote the old saying "Health is above wealth" to prove their
idea. They argue that, on the one hand, a strong person can do almost anything as long as
he/she tries hard. On the other hand, however, rich people will not be able to enjoy the
wealth if their days are numbered.
Moreover,they may think that they can buy everything they like with money.For
example,beautiful clothes,delicious food,large houses and luxury cars can be afforded.
Therfore,their life is quite comfortable.Nowadays,many younggirls marry old rich men
for their money.They belive that they will be happier only with money.However,can they
be really happy?
In contrast, the advocates of wealth have such arguments as follows.in their opinion,
they can do more things includeearning more money with the help of health body.So,
they spend more time doing exercise and enjoying a health diet.Thus,their life is regular and
colouful.Firstly, wealthy people will be able to buy more healthful food. Secondly, they can
enjoy better facilities to improve their health. Take my neighbor, Lao Wang, as an example.
He had a heart attack and is in hospital. However, he cannot afford the expensive operation,
which costs as much as 100,000 yuan. Therefore, he has to lie in bed hopelessly. If he were
a rich man, his life could be saved.
In short, we cann't draw a conclusion easily that which one is important. For one thing, it
is true that we can do many things when we are very rich, but we can never buy our health
and healthy relationship with others. For another, we can enjoy a more healthy life with
money. Thererore, we should try to strike a balance between them and gain wealth with a
health body.
posted @ 2007-07-03 17:50 afunms 閱讀(873) | 評論 (0) | 編輯 收藏
posted @ 2007-07-02 13:41 afunms 閱讀(728) | 評論 (0) | 編輯 收藏
Cisco Discovery Protocol (CDP) is primarily used to obtain protocol addresses of neighboring devices and discover the platform of those devices. CDP can also be used to show information about the interfaces your router uses. CDP is media- and protocol-independent, and runs on all Cisco-manufactured equipment including routers, bridges, access servers, and switches.
Use of SNMP with the CDP Management Information Base (MIB) allows network management applications to learn the device type and the SNMP agent address of neighboring devices, and to send SNMP queries to those devices. Cisco Discovery Protocol uses the CISCO-CDP-MIB.
CDP runs on all media that support Subnetwork Access Protocol (SNAP), including local-area network (LAN), Frame Relay, and Asynchronous Transfer Mode (ATM) physical media. CDP runs over the data link layer only. Therefore, two systems that support different network-layer protocols can learn about each other.
Each device configured for CDP sends periodic messages, known as advertisements, to a multicast address. Each device advertises at least one address at which it can receive SNMP messages. The advertisements also contain time-to-live, or holdtime, information, which indicates the length of time a receiving device should hold CDP information before discarding it. Each device also listens to the periodic CDP messages sent by others in order to learn about neighboring devices and determine when their interfaces to the media go up or down
CDP Version-2 (CDPv2), the most recent release of the protocol, provides more intelligent device tracking features. These features include a reporting mechanism which allows for more rapid error tracking, thereby reducing costly downtime. Reported error messages can be sent to the console or to a logging server, and cover instances of unmatching native VLAN IDs (IEEE 802.1Q) on connecting ports, and unmatching port duplex states between connecting devices.
Command |
Purpose |
clear cdp counters |
Resets the traffic counters to zero. |
clear cdp table |
Deletes the CDP table of information about neighbors. |
show cdp |
Displays the interval between transmissions of CDP advertisements, the number of seconds the CDP advertisement is valid for a given port, and the version of the advertisement. |
show cdp entryentry-name [protocol| version] |
Displays information about a specific neighbor. Display can be limited to protocol or version information. |
show cdp interface[type number] |
Displays information about interfaces on which CDP is enabled. |
show cdp neighbors[type number] [detail] |
Displays the type of device that has been discovered, the name of the device, the number and type of the local interface (port), the number of seconds the CDP advertisement is valid for the port, the device type, the device product number, and the port ID. Issuing the detailkeyword displays information on the native VLAN ID, the duplex mode, and the VTP domain name associated with neighbor devices. |
show cdp traffic |
Displays CDP counters, including the number of packets sent and received and checksum errors. |
show debugging |
Displays information about the types of debugging that are enabled for your router. See the Cisco IOS Debug Command Reference for more information about CDP debugcommands. |
posted @ 2007-05-17 11:10 afunms 閱讀(318) | 評論 (0) | 編輯 收藏
posted @ 2007-05-16 16:16 afunms 閱讀(179) | 評論 (0) | 編輯 收藏
http://www.jdon.com/designpatterns/builder.htm
Builder模式定義:
將一個復雜對象的構建與它的表示分離,使得同樣的構建過程可以創建不同的表示.
Builder模式是一步一步創建一個復雜的對象,它允許用戶可以只通過指定復雜對象的類型和內容就可以構建它們.用戶不知道內部的具體構建細節.Builder模式是非常類似抽象工廠模式,細微的區別大概只有在反復使用中才能體會到.
為何使用?
是為了將構建復雜對象的過程和它的部件解耦.注意: 是解耦過程和部件.
因為一個復雜的對象,不但有很多大量組成部分,如汽車,有很多部件:車輪 方向盤 發動機還有各種小零件等等,部件很多,但遠不止這些,如何將這些部件裝配成一輛汽車,這個裝配過程也很復雜(需要很好的組裝技術),Builder模式就是為了將部件和組裝過程分開.
如何使用?
首先假設一個復雜對象是由多個部件組成的,Builder模式是把復雜對象的創建和部件的創建分別開來,分別用Builder類和Director類來表示.
首先,需要一個接口,它定義如何創建復雜對象的各個部件:
public interface Builder { //創建部件A 比如創建汽車車輪 } |
用Director構建最后的復雜對象,而在上面Builder接口中封裝的是如何創建一個個部件(復雜對象是由這些部件組成的),也就是說Director的內容是如何將部件最后組裝成成品:
public class Director { private Builder builder; public Director( Builder builder ) { } } |
Builder的具體實現ConcreteBuilder:
通過具體完成接口Builder來構建或裝配產品的部件;
定義并明確它所要創建的是什么具體東西;
提供一個可以重新獲取產品的接口:
public class ConcreteBuilder implements Builder { Part partA, partB, partC; } |
復雜對象:產品Product:
public interface Product { } |
復雜對象的部件:
public interface Part { } |
我們看看如何調用Builder模式:
ConcreteBuilder builder = new ConcreteBuilder();
Director director = new Director( builder );
director.construct();
Product product = builder.getResult();
posted @ 2007-05-15 21:40 afunms 閱讀(88) | 評論 (0) | 編輯 收藏