SIGMOD: ACM SIGMOD Conf on Management of
Data
PODS: ACM SIGMOD Conf on Principles of DB
Systems
VLDB: Very Large Data Bases
ICDE: Intl Conf on Data Engineering
CIKM: Intl. Conf on Information and Knowledge Management
ICDT: Intl Conf on Database Theory
Rank
2:
摘要: That’s why I don’t want to hear people’s ideas.SSD: Intl Symp on Large Spatial Databases
DEXA: Database and Expert System Applications
FODO: Intl Conf on Foundation on Data Organization
EDBT: Extending DB Technology
DOOD: Deductive and Object-Oriented Databases
DASFAA: Database Systems for Advanced Applications
SSDBM: Intl Conf on Scientific and Statistical DB Mgmt
CoopIS - Conference on Cooperative Information Systems
ER - Intl Conf on Conceptual Modeling (ER)
參考 http://www3.ntu.edu.sg/home/assourav/crank.htm
I’m not interested until I see their execution. 閱讀全文 摘要: 這兩天在學(xué)習(xí)python,主要參考簡(jiǎn)明教程http://www.swaroopch.com/byteofpython/ , 入門(mén)很不錯(cuò),有興趣推薦參考。
在16章中,作者建議讀者寫(xiě)一個(gè)地址簿程序,還記得寫(xiě)它都是在大一學(xué)c語(yǔ)言的年代了,不過(guò)下午還是抽出了一點(diǎn)時(shí)間來(lái)寫(xiě)這個(gè)程序,寫(xiě)了兩個(gè)版本,一個(gè)是使用python 字典來(lái)存儲(chǔ)名字和地址,另一個(gè)版本則使用python的面向?qū)ο筇匦裕瑏?lái)鏈?zhǔn)酱鎯?chǔ)聯(lián)系人對(duì)象。 閱讀全文 摘要: 據(jù)說(shuō)最近psp最近要升值了~無(wú)論是因?yàn)槠平獾脑蜻€是什么,但總之估計(jì)sony還是很難想到,當(dāng)然我們也很值得慶幸的是這幫hack的大牛已然將kvm,python stackless等移植到了psp平臺(tái),強(qiáng)大的ppc支持,可足以媲美幾年前的personal computer,這一點(diǎn)毋庸置疑,更不用去與手機(jī)平臺(tái)相對(duì)比了。 閱讀全文 摘要: org.eclipse.jface.viewers.TreeViewer
的繼承關(guān)系是 閱讀全文 目前 ext已經(jīng)全面升級(jí)了主站,而且也release2.1版本,并新增了一些例子。
最近發(fā)布的Firefox3 beta 5版本,個(gè)人認(rèn)為還是比較不錯(cuò),運(yùn)行JS的也更快、上網(wǎng)速度也快了很多。
但經(jīng)原來(lái)做的一些js程序測(cè)試,ext2.0版本運(yùn)行在FF3Beta5上還存在一些顯示問(wèn)題。
摘要: 昨天寫(xiě)了個(gè)關(guān)于圖庫(kù)的總結(jié)mail 在這貼下,以供參考,當(dāng)然望不吝賜教 閱讀全文 摘要: 前兩天寫(xiě)了一個(gè)處理邏輯表達(dá)式的小程序,可以用來(lái)處理專(zhuān)家系統(tǒng)實(shí)事等邏輯關(guān)系表達(dá)式。 閱讀全文 摘要: EasyMock 是一套通過(guò)簡(jiǎn)單的方法對(duì)于指定的接口或類(lèi)生成 Mock 對(duì)象的類(lèi)庫(kù),它能利用對(duì)接口或類(lèi)的模擬來(lái)輔助單元測(cè)試。本文將對(duì) EasyMock 的功能和原理進(jìn)行介紹,并通過(guò)示例來(lái)說(shuō)明如何使用 EasyMock 進(jìn)行單元測(cè)試。 閱讀全文 摘要: Craigslist的網(wǎng)站上沒(méi)有圖片,只有密密麻麻的文字,標(biāo)著各種生活信息,是個(gè)巨大無(wú)比的網(wǎng)上分類(lèi)廣告加BBS的組合... 閱讀全文 摘要: Trie樹(shù)是一棵度 m ≥ 2 的樹(shù),它的每一層分支不是靠整個(gè)關(guān)鍵碼的值來(lái)確定,而是由關(guān)鍵碼的一個(gè)分量來(lái)確定。 閱讀全文 摘要: For myself learning.
Personal Mastery 閱讀全文 摘要: Have you read Jess In Action by Earnest J. Freedman-Hill? It's one of the better books out there on rule engines, though it does require some experience to get the most out of the book.
A variation on the bookstore could be recommendation engine. That would provide an opportunity to use a rule engine for direct matching on category/subcategory and aggregations. 閱讀全文 摘要: IBM Dump Analyzer for Java是來(lái)分析虛擬機(jī)穩(wěn)定性的一種可擴(kuò)展框架。對(duì)Java虛擬機(jī)生成的產(chǎn)物進(jìn)行自動(dòng)診斷。 閱讀全文 摘要: 實(shí)在忍受不了sun的做事風(fēng)格和它的開(kāi)發(fā)工具了,nb的beta6一踏糊涂一堆bug,唉~想著就想起來(lái)sun中國(guó)弄個(gè)nb插件的比賽不僅過(guò)程糟糕,獲獎(jiǎng)了居然還不兌現(xiàn)承諾,到現(xiàn)在也杳無(wú)音信,估計(jì)是證書(shū)也不想發(fā)了,真是讓大家對(duì)它越發(fā)感到?jīng)]有信心~~~~~~~~~不提這個(gè)了,還是講講Europa 和 myeclipse, 最近在寫(xiě)一個(gè)基于規(guī)則的引擎,用的Europa 和myeclipse6 感覺(jué)非常舒服,myeclipse的功能也大大加強(qiáng)了比如改進(jìn)了javaEE5 提高了EJB3開(kāi)發(fā)效率可以支持從數(shù)據(jù)模型到bean的轉(zhuǎn)換,java的持久化程度及其Spring-JPA的高度集成。開(kāi)發(fā)ajax的朋友可以發(fā)現(xiàn) myeclipse對(duì)ajax的開(kāi)發(fā)和測(cè)試做的也非常好,尤其是對(duì)js的調(diào)試。Web開(kāi)發(fā)的另一個(gè)特點(diǎn)是支持RAD web。nb原來(lái)喊的一項(xiàng)特色是集成了matisse,在myeclipse目前也集成了它而且對(duì)于可視化swing開(kāi)發(fā)非常方便,當(dāng)然你也可以自己按照,不直接更新。
myeclipse中集成的derby和tomcat也大大加速了服務(wù)器的連接和部署,調(diào)試等。至于db視圖個(gè)人使用oracle 閱讀全文 摘要: Given a picture composed entirely of horizontal and vertical line segments, calculate the minimum number of times you must lift your pen to trace every line segment in the picture exactly n times.
Each line segment will be of the form "
Let's say you have a binary string such as the following:
011100011
One way to encrypt this string is to add to each digit the sum of its adjacent digits. For example, the above string would become:
123210122 閱讀全文 摘要: People enjoy mazes, but they also get them dirty. Arrows, graffiti, and chewing gum are just a few of the souvenirs people leave on the walls. You, the maze keeper, are assigned to whiten the maze walls. Each face of the wall requires one liter of paint, but you are only required to paint visible faces. You are given a map of the maze, and you must determine the amount of paint needed for the job. 閱讀全文 摘要: In written languages, some symbols may appear more often than others. Expected frequency tables have been defined for many languages. For each symbol in a language, a frequency table will contain its expected percentage in a typical passage written in that language. For example, if the symbol "a" has an expected percentage of 5, then 5% of the letters in a typical passage will be "a". If a passage contains 350 letters, then 'a' has an expected count of 17.5 for that passage (17.5 = 350 * 5%). Pl 閱讀全文 摘要: A speed radar is installed in a highway zone where the maximum speed limit is maxLimit mph, and the minimum speed limit is minLimit mph. 閱讀全文 摘要: 好長(zhǎng)時(shí)間沒(méi)寫(xiě)程序了感覺(jué),忘了很多東西,呵呵,今天打開(kāi)Eclipse寫(xiě)了一個(gè)Struts的小應(yīng)用,也回顧了一遍它的主要內(nèi)容,這篇隨筆就把整理的一些東西貼出來(lái)吧。 閱讀全文 摘要: 本程序?yàn)閮?yōu)化,比較好的方法是,進(jìn)行曲線積分,算誤差比進(jìn)行方程約束,由于時(shí)間比較少,稍候會(huì)給出優(yōu)化程序。 閱讀全文 摘要: A simple implement of own stack 閱讀全文 摘要: To find a max segment in a array which includes negative and positive no.There r several methods to solve this question. 閱讀全文 摘要: 今天很早的來(lái)到公司,首先查收了一下郵箱,發(fā)現(xiàn)5封新郵件,仔細(xì)的看了下都是關(guān)于我前天申請(qǐng)一個(gè)IBM USA那邊的一個(gè)DB訪問(wèn)權(quán)限的郵件。 閱讀全文 摘要: Sun has just announced the winners of netbeans plugin competition 閱讀全文 摘要: PMI(Performance MonitoringInfrastructure) 閱讀全文 there r so many sundries during these days and almost every point is focussing on papers\projects\ ...\recommending data for my next master degree, but my thought just is in a mess, i cannot describe the stage && status except paying more attention,well,just feeling time is out of my hand.the only thing I am looking forward is the result of nb plugin competition and i will send the request and willing letter to the professors later but then.I m believing that though have lost the opportunity of my target ~~God, it's so pity for a sudden change,at the same time, I stood with everything.I have got another time now and have prepared all the condition for the coming applying.thx in advance for my friends, because u have give a stage and some suporting.especially to stand^-^.TracyYan now has just rushing in && strangely,I find~~~~after six years,why not then, I have also no answers, may be pretty but not really for the feeling,~~~~~.
Yestoday I have collected some data about computer science department professors of pku, bless.
benny is a so kind person though he(she is a judge, but i really want to say,actually not to him.here the only puzzlement is why now after a month asking the method how to use the tool and why dont know the document which has contains all the info he want to know, I know, really, each guy is busy, busy with one's sundries,so many! Symptom.
摘要: 首先說(shuō)點(diǎn)別的:),今天google adsense給我回信關(guān)于blog頭搜索不好用的原因是嵌在了
JavaFX當(dāng)前是備受SUN推崇和重點(diǎn)推廣的項(xiàng)目之一,也是Java技術(shù)繼續(xù)演化的內(nèi)容之一。 閱讀全文 摘要: 今天瀏覽網(wǎng)頁(yè),看見(jiàn)篇寫(xiě)JNDI比較基礎(chǔ),也比較詳細(xì)的文章,又自己整理了一下,post到新手區(qū)了,。。。。:)JNDI是java訪問(wèn)名字和目錄服務(wù)的接口,與JDBC一樣,它僅僅只定義了一套服務(wù)接口,實(shí)現(xiàn)由具體廠商提供。作為j2ee核心組件之一,它為應(yīng)用程序查找其他程序組件和資源提供了統(tǒng)一的接口,其中最常見(jiàn)的用途就是數(shù)據(jù)源的配置、EJB名字查找、JMS相關(guān)配置等。JNDI的架構(gòu)如下圖。在JDK1.3中... 閱讀全文 摘要: 開(kāi)篇,哈哈哈,我喜歡這句話“NO MONEY ONLY WORK DADADI”。
ITM provides out of box uses to quickly deploy and active the app with the best ibm practice.admins can define the user's views,threshold and so on.Tivoli Enterprise Monitoring Agents are available for monitoring different types of platforms and applications, including mainframes,middleware,distributed,and database... 閱讀全文 摘要: CLI command line interface ... 閱讀全文 摘要: 據(jù)說(shuō)極有可能迅速取代目前流行的SWING和SWT技術(shù)。 閱讀全文 北京今天有些風(fēng),但是依然擋不住本有的悶熱。傍晚下樓吃飯,就像突然走進(jìn)蒸籠一樣的感覺(jué),想象著眼前如果是大海該多好啊,說(shuō)到這真是慚愧,我在大連待了20多年,居然不會(huì)游泳,哎~...吃完飯,我從上地佳園溜達(dá)到公司,休息了一下。本想著看點(diǎn)書(shū),但是這個(gè)時(shí)候似乎是快到下班的時(shí)間了,看著白領(lǐng)一族的匆匆離去、聯(lián)想圍欄旁悠然自得的粉刷小匠,我突然萌生要離開(kāi)這兒,去高校轉(zhuǎn)轉(zhuǎn)的念頭。
繞過(guò)DASCOM沿著信息路來(lái)到了五街,在路牌下等者656...我真的實(shí)在受不了了太陽(yáng)的直射和等車(chē)的煩躁,終于決定今天也學(xué)一次抗日前的長(zhǎng)征,學(xué)一次開(kāi)學(xué)前的軍訓(xùn),...自己走到北大,也算熟悉熟悉一路的環(huán)境。現(xiàn)在回來(lái)我真的發(fā)現(xiàn)這是一個(gè)了不起的決定,因?yàn)檫@實(shí)在太累,走去五環(huán)-北大-四環(huán),又跑回上地,即使在地圖上只能算作一指之距。想想先前走到北京體校時(shí)看見(jiàn)一個(gè)學(xué)生繞學(xué)校跑時(shí)的竊竊思緒,我更敬佩自己。腳累得很,但我也算是準(zhǔn)備好了這段時(shí)間出門(mén)在外的辛苦...RuiRui,你說(shuō)得很好,堅(jiān)持久了,也就好了。
摘要: 今天自己突然想起來(lái)整理一下標(biāo)準(zhǔn)的charset,感覺(jué)還算有必要。當(dāng)然java... 閱讀全文 昨天來(lái)得北京,準(zhǔn)備我以后幾個(gè)月的實(shí)習(xí)生活。北京還是和我原來(lái)來(lái)的感覺(jué)一樣,到處都是人流車(chē)流,太陽(yáng)總是離得很近,風(fēng)吹起的揚(yáng)塵讓我透不過(guò)氣...唯一使人感覺(jué)現(xiàn)代感的和不很疲憊的就是坐著北京的城鐵和地鐵,起碼它們不會(huì)因?yàn)樾苟S行┌参康氖亲贗BM的辦公大廳,我喜歡IT深邃的魅力,和品茶的悠然...
昨天一天十分疲倦,或許正如跟個(gè)遠(yuǎn)方的小弟在instantChat上所談的,這一天真的讓我品到了生活的很多酸澀和勞苦,我漸漸發(fā)現(xiàn)走路也是一件非常非常累得事情,漸漸發(fā)現(xiàn)與人相處的道理和囊中的羞澀。其實(shí)昨天一天就花了我3千多,房屋的中介賺得很多感覺(jué),1200的房子,中介費(fèi)也要得1200,還有押金。不過(guò)房子我到是感覺(jué)還好,在上地佳園,至少感覺(jué)這的環(huán)境和保安還算可以,只是與人合租,不是很自在。
昨天也累壞了我一個(gè)高中同學(xué),她陪我到處轉(zhuǎn)了一天,真的很謝謝她。
不知道下一步會(huì)如何,但是我得準(zhǔn)備好在這煎熬悶熱、運(yùn)籌自己的生活、學(xué)會(huì)太多太多...
摘要: 這兩天找了一些portal相關(guān)的資料,也從中學(xué)到了很多東西。據(jù)說(shuō)我們學(xué)校還有個(gè)portal,不過(guò)現(xiàn)在不知為什么down掉了... 閱讀全文 摘要: Sun has rolled out the Temple of Sun Contest with a US$5,000 cash prize. This is a great vehicle to promote Sun Studio on campus. 閱讀全文 摘要: ANT是一個(gè)基于JAVA的自動(dòng)化腳本引擎,腳本格式為XML。除了做JAVA編譯相關(guān)任務(wù)外,ANT還可以通過(guò)插件實(shí)現(xiàn)很多應(yīng)用的調(diào)用。 閱讀全文 摘要: 軟件開(kāi)發(fā)習(xí)慣中一個(gè)細(xì)微更改都可能會(huì)對(duì)軟件質(zhì)量產(chǎn)生巨大改進(jìn)。將單元測(cè)試合并到開(kāi)發(fā)過(guò)程中,然后從長(zhǎng)遠(yuǎn)角度來(lái)看它可以節(jié)省多少時(shí)間和精力。本文通過(guò)使用代碼樣本說(shuō)明了單元測(cè)試的種種好處,特別是使用 Ant 和 JUnit 帶來(lái)的各種方便。 閱讀全文 摘要: 在Ant出現(xiàn)之前,構(gòu)建和部署Java應(yīng)用需要使用包括特定平臺(tái)的腳本、Make文件、各種版本的IDE甚至手工操作的“大雜燴”。現(xiàn)在,幾乎所有的開(kāi)源 Java項(xiàng)目都在使用Ant,大多數(shù)公司的內(nèi)部項(xiàng)目也在使用Ant。Ant在這些項(xiàng)目中的廣泛使用自然導(dǎo)致了讀者對(duì)一整套Ant最佳實(shí)踐的迫切需求。 閱讀全文 摘要: By the way,there is a tool,Sun Device Detection Tool ,which is based on jnlp protocol, can tell us in just a few minutes whether the Solaris OS supports the devices that are detected in our x86 system, in advance. 閱讀全文 摘要: 昨晚同學(xué)找我?guī)兔?xiě)一個(gè)利用GOOGLE API的小程序,也比較感興趣所以就應(yīng)下了。下載了GOOGLE提供的googleapi.jar,大約花了20多分鐘,寫(xiě)了這個(gè)小程序,由于需要提供GOOGLE key所以也懶得去申請(qǐng),就沒(méi)有測(cè)試~~呵呵 閱讀全文 摘要: 元數(shù)據(jù)是利用JDBC創(chuàng)建和操作數(shù)據(jù)庫(kù)對(duì)象的一個(gè)很重要的概念和應(yīng)用,所以今天我特地的找了一些詳細(xì)解析個(gè)概念的資料,和利用java來(lái)操作的實(shí)例。 閱讀全文 出于java的安全限制,System.getProperty("line.seperator")是不能夠直接取得的。可以這樣做:
new sun.security.action.GetPropertyAction("line.separator"));
2 String drivers;
3
4 try {
5 drivers = (String) java.security.AccessController
6 .doPrivileged(new sun.security.action.GetPropertyAction(
7 "jdbc.drivers"));
8 } catch (Exception ex) {
9 drivers = null;
10 }
11 println("DriverManager.initialize: jdbc.drivers = " + drivers);
12 if (drivers == null) {
13 return;
14 }
15 while (drivers.length() != 0) {
16 int x = drivers.indexOf(':');
17 String driver;
18 if (x < 0) {
19 driver = drivers;
20 drivers = "";
21 } else {
22 driver = drivers.substring(0, x);
23 drivers = drivers.substring(x + 1);
24 }
25 if (driver.length() == 0) {
26 continue;
27 }
28 try {
29 println("DriverManager.Initialize: loading " + driver);
30 Class.forName(driver, true, ClassLoader.getSystemClassLoader());
31 } catch (Exception ex) {
32 println("DriverManager.Initialize: load failed: " + ex);
33 }
34 }
35 }
摘要: 可供程序利用的資源(內(nèi)存、CPU時(shí)間、網(wǎng)絡(luò)帶寬等)是有限的,優(yōu)化的目的就是讓程序用盡可能少的資源完成預(yù)定的任務(wù)。優(yōu)化通常包含兩方面的內(nèi)容:減小代碼的體積,提高代碼的運(yùn)行效率。本文討論的主要是如何提高代碼的效率。 閱讀全文 1.變量引用的時(shí)候,空指針情況的防止,即為空檢查.
2.數(shù)學(xué)運(yùn)算異常,如除0的情況.數(shù)組越界異常,字符串訪問(wèn)過(guò)界
3.數(shù)據(jù)庫(kù)檢索記錄,結(jié)果記錄行數(shù)狀況的處理.
4.畫(huà)面顯示項(xiàng)目的確認(rèn).
5.畫(huà)面顯示項(xiàng)目達(dá)到上限時(shí)情況的處理.
6.系統(tǒng)出錯(cuò)的時(shí)候,異常信息是否正確.
7.數(shù)據(jù)庫(kù)連接,游標(biāo)的處理.
8.數(shù)學(xué)運(yùn)算時(shí),數(shù)據(jù)精度的處理.
Today with tomcat admin, a Graphic interface for us to config the JNDI for our program,I configured the context and connection pool jioning IBM DB2 ExC-9.Actually,JNDI is an API specified in Java technology that provides naming and directory functionality to applications written in the Java programming language. It is designed especially for the Java platform using Java's object model. Using JNDI, applications based on Java technology can store and retrieve named Java objects of any type. In addition, JNDI provides methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes (Name-Value,context).JNDI is also defined independent of any specific naming or directory service implementation. It enables applications to access different, possibly multiple, naming and directory services using a common API. Different naming and directory service providers can be plugged in seamlessly behind this common API. This enables Java technology-based applications to take advantage of information in a variety of existing naming and directory services, such as LDAP, NDS, DNS, and NIS(YP), as well as enabling the applications to coexist with legacy software and systems. Using JNDI as a tool, we can build new powerful and portable applications that not only take advantage of Java's object model but are also well-integrated with the environment in which they are deployed.
A directory is typically used to associate attributes with objects. A person object, for example, can have a number of attributes, such as the person's surname, fisrtName,telephone numbers, electronic mail address and so on. Using JNDI, to retrieve the email address of a person object, the code looks as follows.
2 String email = (String)personAttribute.get();
An intuitive model for the Java programmer is to be able to lookup objects like printers and databases from the naming/directory service. Using JNDI, to lookup a printer object, the code looks as follows. (it's important and most used)
2 printer.print(document);
//*******************The Log class
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.uitl.Date;
import java.text.DateFormat;
public class Log{
private static final String filePath = PropertyReader.getResource("Log_File_Path");//Supposing we have define in the last ProperyReader class and the file
public static final String EXCEPTION = "Exception";
public static final String CREATE_STAFF = "Create Staff";
public static final String EDIT_STAFF = "Edit Staff";
public static final String DELETE_STAFF = "Delete Staff";
public static final String RECORD_HAS_EXIST = "Record Has Exist";
public static void log(String msg_type, Exception e){
StringBuffer errMsg = new StringBuffer(e.toString);
for(int i=0;i<e.getStackTrace().length;i++){
errMsg.append("\n\t at");
errMsg.append(e.getStackTrace()[i].toString);
}
log(msg_type,errMsg.toString());
OptionPanel.showErrMsg("Sorry,System may have an error \n System will exit");
System.exit(-1);
}
public static void log(String msg.type,Staff staff){
String msg = null;
if(msg_type == CREATE_STAFF){
msg = staff.toString() + "has benn created";
}else if(msg_type == EDIT_STAFF){
msg = staff.toString() + "has been Changed";
}else if(msg_type == DELETE_STAFF){
msg = staff.toString() + "has been Deleted";
}else if(msg_type == RECORD_HAS_EXIST){
msg = staff.toString() + "has exist in the database";
}
log(msg_type,msg);
}
private static void log(String msg_type,String msg){
BufferedWriter out = null;
DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
try{
out = new BufferedWriter(new FileWriter(getLogFilePath(),true));//如果為 true,則將字節(jié)寫(xiě)入文件末尾處,而不是寫(xiě)入文件開(kāi)始處
out.write("["+df.format(new Date()) + "] <" + msg_type + "> :" + msg);
out.newline();
out.newline();
}catch(IOException e){
e.printStackTrace();
}finally{
try{
if(out!=null){
out.close();
}
}catch(IOException e){
e.printStackTrace();
}
}
}
private static String getLogFilePath(){
File logDir = new File(filePath);
if(!logDir.exists()){
logDir.mkdir();
}
int i = 1;
String fileName = filePath + "log_";
File file = new File(fileName + i + ".txt");
while(file.exists() && file.length() > 30000L) {
i++;
file = new File(fileName + i + ".txt");
}
return fileName + i + ".txt"
}
}
//*****************************The OptionPanel Dialog Class for the Log Class
import javax.swing.JOptionPane;
public class OptionPanel {
private static final String appTitle = PropertyReader.getResource("App_Title");//suposing the file has been established and the property app-title stands for the name of application
private static final MainFrame frame = MainFrame.getMainFrame();
public static void showWarningMsg(String msg){
JOptionPane.showMessageDialog(frame,msg,appTitle,JOptionPane.WARNING_MESSAGE);
}
public static void showErrMsg(String msg){
JOptionPane.showMessageDialog(frame,msg,appTitle,JOptionPane.Error_MESSAGE);
}
public static int showConfirmMsg(String msg){
return JOptionPane.showConfirmDialog(frame,msg,appTitle,JOptionPane.YES_NO_OPTON,JOptionPane.QUESTION_MESSAGE);
}
}
In a project, we can write a class to read the properties.As following,
import java.io.InputStream;
import java.io.IOException;
import java.util.Properties;
public class PropertyReader{
private static Properties property = null;
static{
InputSteam stream = null;
try{
stream=PropertyReader.class.getResourceAsStream("/resource/properties.properties");
property = new Properties();
property.load(stream);
}catch(IOException e){
e.printStackTrace();
}finally{
if(stream != null){
try{
stream.close();
}catch(IOException e){
e.printStackTrace();
}
}
}
}
public static String getResource(String key){
if(property == null){
return null;// init error;
}
return property.getProperty(key);
}
}
List a class to use the title Properties.
import java.util.Properties;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class FirstDayTestProperties {
public static void main(String[] args) throws Exception{
Properties ProTest = new Properties();
String fileName="PropertiesTest.properties";
try{
ProTest.setProperty("lastDir","C:\\PropertyTest");
ProTest.store(new FileOutputStream(fileName),null);
}catch(IOException e){
e.printStackTrace();
}
try{
FileInputStream inStream=new FileInputStream(fileName);
ProTest.load(inStream);
ProTest.list(System.out);
}catch(FileNotFoundException e){
e.printStackTrace();
}
}
}
The class I just write now without any testing,but i think it seems no errors:).Share.
<1>Module Usually,in enterprise software,it presents the logic of the commercial bean.To the SE Swing GUI,it contains data and the rules that govern access to and updates of this data.Especially,the model doesn't carry a reference to the view but instead uses an event-notification model to notify insteaded parties of a change.One of the consequences of this powerful design is that many views can have the same model.When a change in the data model occurs,each view is notified by a property change event and can change itself accordingly.Hence, the controller may mediate the data flow between the model and the view in both directions,which helps to more completely decouple the model from the view,and the controller may also provide the methods which effect the model's property changes for one or more views that are registered with it.
<2>View It specifies exactly how the module data should be presented,changing with the model data.
<3>Controller Controller defines all the methods connecting to the user action which are called by the View.
....Next,may be the two days after tomorrow ,I ll give a real example to explain this schema in details.......
這周學(xué)校組織無(wú)償獻(xiàn)血,雖然我并不在乎學(xué)校不給什么所謂的補(bǔ)償,我也不會(huì)因?yàn)楂I(xiàn)血怎么怎么的就有所目的,只是感覺(jué)這種行為還算是對(duì)社會(huì)作出了一點(diǎn)貢獻(xiàn)。最嶇奇的是導(dǎo)員居然不讓我獻(xiàn)血,當(dāng)然他的勸告算能讓我接受,但是自己還是很固執(zhí)的感覺(jué),無(wú)奈的導(dǎo)員也只好應(yīng)下了。哎~我這個(gè)人真是經(jīng)不起別人的勸告發(fā)現(xiàn),在好些個(gè)朋友的“嚇唬”下,終于作出了心虛的妥協(xié)...哎~,不過(guò)也算給我的母親一個(gè)很好的交代了。
不說(shuō)這些令人掃興的話題了,還有一件好事,就是跟我關(guān)系很鐵的一個(gè)老師有了21個(gè)月的小寶寶,其實(shí)他才告訴我的,還是在網(wǎng)上。不過(guò)早應(yīng)該猜到了,因?yàn)檫@幾天就發(fā)現(xiàn)他“不誤正業(yè)”,整天不在辦公室,往家里一個(gè)勁的跑,不過(guò)在這里,雖然他不會(huì)知道,還是祝愿他博士論文順利通過(guò)吧,雙喜臨門(mén)...
想早些休息了,Good night&& Good dream. 剛剛看看過(guò)魯豫有約的兩期節(jié)目,是采訪的年輕輕但身價(jià)過(guò)億的李想、高燃、戴志和茅侃侃。其實(shí),我并不因?yàn)樗麄兊哪贻p或是很有錢(qián),而感到任何詫異,但自己卻很欣常他們各自所持有的信念和創(chuàng)業(yè)過(guò)程中對(duì)資金的運(yùn)營(yíng)勇氣,我真的不知道隨著他們事業(yè)的增長(zhǎng)、社會(huì)的變更,他們還是否會(huì)是浪潮的寵兒、是否會(huì)和原來(lái)一樣,對(duì)待更多的運(yùn)營(yíng)資本同樣的保持清醒地頭腦,但我還是很祝福他們...
看過(guò)之后,我的感觸很深,在這個(gè)社會(huì)上,或許是因?yàn)殡S著一個(gè)人學(xué)歷的漸漸增長(zhǎng),他也會(huì)變得懶惰,因?yàn)樗僖膊粫?huì)像社會(huì)地位很卑微的人一樣為生計(jì)擔(dān)心,我本也相信,人在骨子里是懶惰的。其實(shí),我自己也曾想過(guò),以后能找個(gè)比較大的外企工作,幾年之后一個(gè)月拿個(gè)幾W塊就ok了,然后就是一輩子平平淡淡的生活...:),或許我的思想還不夠先進(jìn)吧。他們的經(jīng)歷,也讓我重新思考,說(shuō)句實(shí)話,其實(shí)他們并沒(méi)什么,只是在坎坷的社會(huì)中,為了自己的信念堅(jiān)持了下來(lái),并一直做到了現(xiàn)在。我想我也該在為別人打工的同時(shí),定位自己的目標(biāo),并堅(jiān)定的追求。高燃是我很佩服的一個(gè)人,完全是因?yàn)樗膱?zhí)著,無(wú)論是他考清華、追GirlFriend 還是去找投資人,最后到辦好公司。人的天賦很重要,但我還是更喜歡執(zhí)著... Yestoday night,CA coordinator emailed and phoned me for Sunstudio running and test the ping-home function,I m sorry that I really didn't know what's this really mean under Unix,I am not sure,maybe about to edit the file of host,but I just ping -s localhost,well,maybe another ip destination.more awful,I cannot run the #./SUNWspro/bin/f95, #./SUNWspro/bin/cc, #./SUNWspro/bin/CC...I have sent the first test result,and continue to learn more about it,but I m really sorry.
The day before yestoday,I have received the intern offer letter from IBM CDL...to my surprise,cos of my little time,only can support 3-4ms.it's too absurd that when the assistant
ask my IdCard num,well,God,I forgot it...:) During the time,not so along,exactly,only a few days ago,I met a manager in the IBM(BJ)CRL,She is a very kind person,also a manager(i think),she has recommended me to her colleagues,which I really thank her.so yestoday,these persons phoned me and asked if wanted to do some QA jobs,if though,they knew that i was admired by CDL.To the manners,I think today I should take their phone test though I will not accept their opportunity as to my promise to the CDL,That's important I think.
Now I was a junior student,coming to realize that the campus life will be end,I was lucky I think,especailly about so many friends,can be ambassador of Sun Microsystems.lnc,can be a intern of IBM and so on.Now in my dream,hope that I can be a recommend student to get the master degree of tsingHua or BJUniversity this Sep.,then can go aboard for future research,last,back to the motherland to have a peace life,for which I will try my hard and best.
Maybe,u are tied of Windows and come to thinking of trying Linux,so many good Operation Systems,like,Suse Redhat ...or Novell have all enterprise u might need,as well,support communities.well,it's true enough--Solaris is also available and as a OpenSolaris form with AMD and Intel friends,with a pretty community going && more and more third-party supporting.U may download the Solaris form www.opentech.org.cn, www.opensolaris.org, ...Sun.
I very like OpenSolaris not only its security,its creative,convinient...whereas,its all:).The Java Desktop is cool and we may also use click to operate,well,I like the terminal more.Now I use Solaris as a developer desktop,it integrates the Netbeans to develop Java which is also a excellent enviroment to develop others after u plug in,Sun Studio,a platform to develop C/C++ &&fortan,with sun compiler,efficient.If u think Solaris is too big and Enterprise-heavy,u will make a mistake,Solaris is very small but excellent perform,:),U can try urself.
yestoday i make a techtalk about Sun openSolaris and Java,C/C++ development under it in my campus(DaLian University of Technology).To my surprise There were more students from the disrelated computer science Department,more,even more girls.I saw a Linux teachers attending,I was very pleased,cos of Solaris is sure to attract the fancy of the Linux users,at least,It's better in my...our's eyes.:),as following I attach some of pics of my tech-talking to share with u.


Most developers have heard of, and possibly used, scripting languages such as Ruby, JavaScript, and Python. These dynamic languages are enjoying a resurgence in popularity, largely because of their flexibility and simplicity, and the productivity gains they promise.
Java 6 comes with built-in support for scripting languages. You can embed scripts in various scripting languages into your Java applications, passing parameters, evaluating expressions, and retrieving results. And you can do it all pretty seamlessly.
First of all, you obtain a new ScriptEngine object from a ScriptEngineManager, as shown here:
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
Each scripting language has its own unique identifier. The "js" here means you're dealing with JavaScript.
Now you can start having some fun. Interacting with a script is easy and intuitive. You can assign scripting variables using the put() method and evaluate the script using the eval() method,. which returns the most recently evaluated expression processed by the script. And that pretty much covers the essentials. Here's an example that puts it all together:
engine.put("cost", 1000);
String decision = (String) engine.eval(
"if ( cost >= 100){ " +
"decision = 'Ask the boss'; " +
"} else {" +
"decision = 'Buy it'; " +
"}");
assert ("Ask the boss".equals(decision));
You can do more than just pass variables to your scripts— you can also invoke Java classes from within your scripts. Using the importPackage() function enables you to import Java packages, as shown here:
engine.eval("importPackage(java.util); " +
"today = new Date(); " +
"print('Today is ' + today);");
Another cool feature is the Invocable interface, which lets you invoke a function by name within a script. This lets you write libraries in scripting languages, which you can use by calling key functions from your Java application. You just pass the name of the function you want to call, an array of Objects for the parameters, and you're done! Here's an example:
engine.eval("function calculateInsurancePremium(age) {...}");
Invocable invocable = (Invocable) engine;
Object result = invocable.invokeFunction("calculateInsurancePremium",
new Object[] {37});
You actually can do a fair bit more than what I've shown here. For example, you can pass a Reader object to the eval() method, which makes it easy to store scripts in external files, or bind several Java objects to JavaScript variables using a Map-like Binding object. You can also compile some scripting languages to speed up processing. But you probably get the idea that the integration with Java is smooth and well thought-out.
剛剛結(jié)束了IBM的電面,一個(gè)GG和JJ,問(wèn)的主要問(wèn)題都放在我的項(xiàng)目上了,尤其是Netbeans的插件。由于我申請(qǐng)的實(shí)習(xí)生,所以在之中也問(wèn)了很多實(shí)習(xí)時(shí)間的問(wèn)題,感覺(jué)IBM問(wèn)問(wèn)題很不含糊,甚至要問(wèn)出幾月幾號(hào)......這一點(diǎn)可以說(shuō)明IBM是一個(gè)很值得人去的地方。英文問(wèn)題我感覺(jué)我答得不是很好,先問(wèn)得IBM的文化之類(lèi)的,之后居然問(wèn)得IBM person慚愧啊 本來(lái)還知道幾個(gè)的,一緊張都忘了。在角色兌換時(shí),我問(wèn)得我的表現(xiàn),和職業(yè)生涯建議,好小子,他們居然還反問(wèn)我職業(yè)生涯,說(shuō)了一通......整個(gè)電面是從4:10-4:45,最后GG說(shuō)面試表現(xiàn)還好,只是我能實(shí)習(xí)的時(shí)間比他們要求的時(shí)間要少,唉~~ 我的系主任啊,等待結(jié)果中....希望自己能去IBM體驗(yàn)一下藍(lán)色巨人的風(fēng)范吧。一會(huì)4:30要參加北京IBM研究院的一個(gè)電面,快到時(shí)間了,不免心里稍有些緊張,不知道先前積累的一點(diǎn)英語(yǔ)一會(huì)是否會(huì)奏效,呵呵,,,,不過(guò),無(wú)論如何我會(huì)盡可能抓住這次來(lái)之不易的機(jī)會(huì)的。 摘要: This post had been writen long before,...but 閱讀全文 摘要: Java SE 6.0(代號(hào)Mustang,野馬)已經(jīng)發(fā)布,詳情請(qǐng)見(jiàn) 野馬奔騰而出,Java SE 6 正式版發(fā)布 ,它給我們帶來(lái)了哪些新的特性了。 首先,我們看看JDK 6.0包含了大量的JSR,分為四組,分別為: 在簡(jiǎn)化開(kāi)發(fā)方面: 199: Compiler API... 閱讀全文
前幾天好不容易下到了JDK6mustang,今天恰好有時(shí)間升級(jí)了一下Netbeans默認(rèn)的JDK版本。這里簡(jiǎn)單的說(shuō)明一下升級(jí)的方法。如果我 們不修改Netbeans的屬性,需要在JavaPlatform manager中加入另一版本的類(lèi)庫(kù)。新建工程后如果要修改類(lèi)庫(kù),還需要修改項(xiàng)目的類(lèi)庫(kù)屬性,現(xiàn)在通過(guò)修改默認(rèn)的JDK類(lèi)庫(kù),便可方便很多,更不需要重新 安裝NB。
我的NB裝在D盤(pán)中,可以在該路徑找到文件D:\Netbeans-5.5\etc\Netbeans.conf,我們將原有的默認(rèn)類(lèi)庫(kù)netbeans_jdkhome="D:\Java\jdk1.5.0_07"修改為 netbeans_jdkhome="D:\Java\jdk1.6.0"便輕松的完成了升級(jí),當(dāng)然在tools-〉JavaPlatform manager〉中當(dāng)然也可以將我們慣用的D:\Java\jdk1.5.0_07加入為可選用類(lèi)庫(kù)。
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>拖拽Demo</title>
<style type="text/CSS">
body
{
margin:0px;
}
#aim
{
position:absolute;
width:200px;
height:30px;
border:1px solid #666666;
background-color:#FFCCCC;
}
#sourceLayer, #cloneLayer
{
position:absolute;
width:300px;
height:50px;
border:1px solid #666666;
background-color:#CCCCCC;
cursor:move;
}
.docked
{
display:none;
filter:alpha(opacity=100);
}
.actived
{
display:block;
filter:alpha(opacity=70);
}
</style>
</head>
<body >
<div id="aim">locate</div>
<div id="sourceLayer" unselectable="off"><img src="http://www.baidu.com/img/logo.gif" alt="Drag Demo">Source of the demo</div>
<div id="cloneLayer" class="docked" unselectable="off"></div>
<script type="text/javascript" language="javascript">
var aim;
var sourceLayer;
var cloneLayer;
var aimX;
var aimY;
var orgnX;
var orgnY;
var draging = false;
var offsetX = 0;
var offsetY = 0;
var back;
var thisX ;
var thisY ;
var time ;
var stepX ;
var stepY ;
function getLayer(inAim,inSource,inClone)
{
aim = document.getElementById(inAim);
sourceLayer = document.getElementById(inSource);
cloneLayer = document.getElementById(inClone);
}
function initDrag(initAimX,initAimY,initOrgnX,initOrgnY)
{
aimX = initAimX;
aimY = initAimY;
orgnX = initOrgnX;
orgnY = initOrgnY;
aim.style.pixelLeft = aimX;
aim.style.pixelTop = aimY;
sourceLayer.style.pixelLeft = orgnX;
sourceLayer.style.pixelTop = orgnY;
cloneLayer.style.pixelLeft = orgnX;
cloneLayer.style.pixelTop = orgnY;
}
function BeforeDrag()
{
if (event.button != 1)
{
return;
}
cloneLayer.innerHTML = sourceLayer.innerHTML; 容
offsetX = document.body.scrollLeft + event.clientX - sourceLayer.style.pixelLeft;
offsetY = document.body.scrollTop + event.clientY - sourceLayer.style.pixelTop;
cloneLayer.className = "actived";
draging = true;
}
function OnDrag()
{
if(!draging)
{
return;
}
event.returnValue = false;
cloneLayer.style.pixelLeft = document.body.scrollLeft + event.clientX - offsetX;
cloneLayer.style.pixelTop = document.body.scrollTop + event.clientY - offsetY;
}
function EndDrag()
{
if (event.button != 1)
{
return;
}
draging = false;
if (event.clientX >= aim.style.pixelLeft && event.clientX <= (aim.style.pixelLeft + aim.offsetWidth) &&
event.clientY >= aim.style.pixelTop && event.clientY <= (aim.style.pixelTop + aim.offsetHeight))
{
sourceLayer.style.pixelLeft = aim.style.pixelLeft;
sourceLayer.style.pixelTop = aim.style.pixelTop;
cloneLayer.className = "docked";
}
else
{
thisX = cloneLayer.style.pixelLeft;
thisY = cloneLayer.style.pixelTop;
offSetX = Math.abs(thisX - orgnX);
offSetY = Math.abs(thisY - orgnY);
time = 500;
stepX = Math.floor((offSetX/time)*20);
stepY = Math.floor((offSetY/time)*20);
if(stepX == 0)
stepX = 2;
if(stepY == 0)
stepY = 2;
moveStart();
}
}
function moveStart()
{
back = setInterval("MoveLayer();",15);
}
function MoveLayer()
{
if(cloneLayer.style.pixelLeft <= orgnX && cloneLayer.style.pixelTop <= orgnY)
{
cloneLayer.style.pixelLeft += stepX;
cloneLayer.style.pixelTop += stepY;
if(cloneLayer.style.pixelLeft > orgnX)
{
stepX = 1;
}
if(cloneLayer.style.pixelTop > orgnY)
{
stepY = 1;
}
//if the coordinate of X Y are same
if(cloneLayer.style.pixelLeft == orgnX)
{
stepX = 0;
}
if(cloneLayer.style.pixelTop == orgnY)
{
stepY = 0;
}
if(cloneLayer.style.pixelLeft == orgnX && cloneLayer.style.pixelTop == orgnY)
{
EndMove();
}
}
//locate to the downleft of the object
else if(cloneLayer.style.pixelLeft <= orgnX && cloneLayer.style.pixelTop >= orgnY)
{
cloneLayer.style.pixelLeft += stepX;
cloneLayer.style.pixelTop -= stepY;
if(cloneLayer.style.pixelLeft > orgnX)
{
stepX = 1;
}
if(cloneLayer.style.pixelTop < orgnY)
{
stepY = 1;
}
if(cloneLayer.style.pixelLeft == orgnX)
{
stepX = 0;
}
if(cloneLayer.style.pixelTop == orgnY)
{
stepY = 0;
}
if(cloneLayer.style.pixelLeft == orgnX && cloneLayer.style.pixelTop == orgnY)
{
EndMove();
}
}
else if(cloneLayer.style.pixelLeft >= orgnX && cloneLayer.style.pixelTop <= orgnY)
{
cloneLayer.style.pixelLeft -= stepX;
cloneLayer.style.pixelTop += stepY;
if(cloneLayer.style.pixelLeft < orgnX)
{
stepX = 1;
}
if(cloneLayer.style.pixelTop > orgnY)
{
stepY = 1;
}
if(cloneLayer.style.pixelLeft == orgnX)
{
stepX = 0;
}
if(cloneLayer.style.pixelTop == orgnY)
{
stepY = 0;
}
if(cloneLayer.style.pixelLeft == orgnX && cloneLayer.style.pixelTop == orgnY)
{
EndMove();
}
}
//locate to the right of the object
else if(cloneLayer.style.pixelLeft >= orgnX && cloneLayer.style.pixelTop >= orgnY)
{
cloneLayer.style.pixelLeft -= stepX;
cloneLayer.style.pixelTop -= stepY;
if(cloneLayer.style.pixelLeft < orgnX)
{
stepX = 1;
}
if(cloneLayer.style.pixelTop < orgnY)
{
stepY = 1;
}
if(cloneLayer.style.pixelLeft == orgnX)
{
stepX = 0;
}
if(cloneLayer.style.pixelTop == orgnY)
{
stepY = 0;
}
if(cloneLayer.style.pixelLeft == orgnX && cloneLayer.style.pixelTop == orgnY)
{
EndMove();
}
}
//to the design
else
{
EndMove();
}
}
//stop and then back to the state ()carton
function EndMove()
{
sourceLayer.style.pixelLeft = orgnX;
sourceLayer.style.pixelTop = orgnY;
cloneLayer.style.pixelLeft = orgnX;
cloneLayer.style.pixelTop = orgnY;
cloneLayer.className = "docked";
clearInterval(back);
}
//Main function of this demo
function startDraging(inAim,inSource,inClone,initAimX,initAimY,initOrgnX,initOrgnY)
{
getLayer(inAim,inSource,inClone)
initDrag(initAimX,initAimY,initOrgnX,initOrgnY);
sourceLayer.onmousedown = BeforeDrag;
document.onmousemove = OnDrag; //if we use cloneLayer,then the content will be draged ,and well a bug
cloneLayer.onmouseup = EndDrag;
}
//transfer
startDraging("aim","sourceLayer","cloneLayer",600,500,50,50);
//-->
</script>
</body>
</html> As beginning,still don't know how to begin this post~but really should begin to write something about tech.Sometimes some one like to talk that A good bazoo can
make a good bussiness card~,may be so,may be not,I really want to throw it away,but cannot,just can to learn and write ...off topics...
From now I propose to write a route about js tech with my learning steps.Ajax is a good thing maybe the world just like it some good but really short. Js is called for the full JavaScriptlanguage,it's welcomed because it can be run at the piont of client and also effective.when we talk about java object orientation is the focus piont which attracts our attention.we can define a class and then a function.But to JS ,when we create a function and make a instance of this function,we just regard it as a class,so we may say a newable function was a class.The class may have its own attributes or methods,but now we can use the sign["~"]to quote it(refer to).
Now I give a simple example about this
Of course,u can express with arr.push("Eric").After this,I want to say,we can insert,update & delete attributes or methods when we need.As following
user.name="Eric";
user.age="21";
user.sex="male";
//we insert 3 Atts/
user.show=function(){
alert("Name is"+this.name);
}
//we insert 1 Mes/
delete is very very easy,a old story.. we use undefined
user.name=undefined;
user.show=undefined;
//....
This is js today's post,easiness goes,.~ ..
FileWriter fw = new FileWriter(writetext);//就像創(chuàng)建打印機(jī)
PrintWriter pw = new PrintWriter(fw);//這個(gè)呢打印針頭了。


第三步,輸入啟動(dòng)類(lèi)。輸入帶有 main 方法的類(lèi)名
Pattern pattern = Pattern.compile("\\w+@\\w+.\\w+");
Matcher matcher = pattern.matcher(text);
if(matcher.find()){
System.out.println(matcher.group());
}
表格 A: 字符匹配 |
|||
操作 |
解釋 |
例子 |
結(jié)果 |
. |
單個(gè)字符匹配 |
.ord |
匹配 “ford”, “lord”, “2ord”, |
[ ] |
多個(gè)字符列表 |
[cng] |
只會(huì)匹配 “cord”, “nord”, 和 “gord” |
[^ ] |
不出現(xiàn)字符列表 |
[^cn] |
匹配 “lord”, “2ord”, 等. 但不會(huì)匹配 “cord” or “nord” |
|
|
[a-zA-Z] |
匹配 “aord”, “bord”, “Aord”, “Bord”等 |
|
|
[^0-9] |
匹配 “Aord”, “aord”, 等. 但不會(huì)匹配“2ord”, 等. |
表格 B: 重復(fù)操作符 |
|||
操作 |
解釋 |
例子 |
結(jié)果 |
? |
匹配0次或1次 |
“?erd” |
匹配 “berd”, “herd”“erd”等 |
* |
匹配0次以上 |
“n*rd” |
匹配 “nerd”, “nrd”, “neard”, 等. |
+ |
匹配1次以上 |
“[n]+erd” |
匹配 “nerd”, “nnerd”, 等., 但不匹配 “erd” |
{n} |
匹配n次 |
“[a-z]{2}erd” |
匹配“cherd”, “blerd”, 等. 但不匹配 “nerd”, “erd”, “buzzerd”, 等. |
{n,} |
匹配n次以上 |
“.{2,}erd” |
匹配 “cherd” and “buzzerd”, but not “nerd” |
{n,N} |
匹配n-N次 |
“n[e]{1,2}rd” |
匹配 “nerd” and “neerd”等 |
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JTree;
import javax.swing.tree.*;
public class NewTree {
public NewTree() {
JFrame jframe=new JFrame();//創(chuàng)建窗體
Container c=jframe.getContentPane();//創(chuàng)建容器
JScrollPane scrollPane=new JScrollPane();//創(chuàng)建一個(gè)用于樹(shù)的容器
DefaultMutableTreeNode root=new DefaultMutableTreeNode("root");//創(chuàng)建樹(shù)根節(jié)點(diǎn)
DefaultMutableTreeNode file=new DefaultMutableTreeNode("file1");//創(chuàng)建一個(gè)文件節(jié)點(diǎn)
root.add(file);//將文件節(jié)點(diǎn)添加到根節(jié)點(diǎn)下
JTree tree=new JTree(root);//以根節(jié)點(diǎn)為參數(shù)創(chuàng)建一個(gè)樹(shù)對(duì)象
scrollPane.setViewportView(tree);//將樹(shù)添加到scrollPane里面,并顯示
c.add(scrollPane);//將scrollPane添加到窗體里
jframe.pack();
jframe.setVisible(true);
jframe.addWindowListener(new WindowAdapter(){//這段代碼用于默認(rèn)關(guān)閉
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
public static void main(String[] args){
new NewTree();
}
}
DefaultMutableTreeNode root=new DefaultMutableTreeNode("root");
DefaultMutableTreeNode file=new DefaultMutableTreeNode("file1");
root.add(file);
JTree tree=new JTree(root);
tree.setModel(treeModel);
October 20, 2006 - Anyone who believes college students today are lacking in initiative, creativity, or work ethic should take a close look at the recent accomplishments of a team of students at the Ecole de Technologie Superieure (ETS) in Montreal, Quebec. Over the past three years, this team of 12 has been heads-down working on the mechanical design, electrical system, and Java™ control and navigation software for an AUV—a submarine—and preparing it for the International Autonomous Underwater Competition sponsored by the Association for Unmanned Vehicles Systems International (AUVSI) and the Office of Naval Research (ONR) in San Diego, California.
![]() |
SONIA Team
Click here for more images |
For no college credits, no pay, and no guarantee of success, the ETS team designed and built an AUV that could meet the complex and demanding mission requirements of the competition. Detailed in an 18-page document, these requirements included the ability to autonomously pass through a gate, detect a flashing light, find and connect with a docking station, locate a pipe and drop material into a bin—all underwater and with no communication with the team.
The submarine is called SONIA, which stands for Système d’Opérations Nautiques Intelligent et Autonome, and is just over one meter long, with a dry weight of 20 kg and a unique box-shaped design. It is equipped with sensors and two color video cameras. Navigation data input is provided by a compass and two gyroscopes as well as active and passive sonar arrays.
SONIA outperformed all but two of the 21 entries in the student competition, securing a place for ETS on the podium for a fourth year in a row. With an overall budget of just $15,000 U.S. (provided by ETS and a variety of corporate sponsors), the ETS team scored higher than teams with six-figure budgets. The competition was won by the University of Florida, but the ETS team came out ahead of renowned engineering schools such as MIT, Georgia Tech, and Virginia Tech.
Innovative Design, Expert Software Engineering
Two of the characteristics that set SONIA apart from competitors were its innovative box-shaped design and the sophistication of its core software systems.
![]() |
SONIA underwater
Click here for more images |
The ETS team’s expertise with Java software proved a decisive advantage. Martin Morissette, software team leader of the SONIA team, is currently entering his third year in software engineering, and recently completed a six-month internship at Sun Labs, where he worked on the “Squawk VM,” a small J2ME™ virtual machine (VM) written almost entirely in Java. The Squawk VM provides the ability to run wireless transducer applications directly on the CPU without any underlying OS, saving overhead and improving performance.
“I learned a great deal during my time with Sun Labs that was extremely useful in the development of the navigation software for SONIA,” said Morissette. “The fact is, Java is an excellent programming language for robotics. All schools teach Java, so everyone on the software team knows how to use it. It’s object-oriented; it’s portable so it runs on Macs, PCs, Linux, whatever; it’s very efficient so we don’t have to worry about memory management; and there are lots of APIs available. And if you know how to write your applications properly, it can be very fast.”
The ETS team used Java for mission control and SONIA’s control systems, Java Management Extensions (JMX) for management, and a Java 3-D Simulator to simulate a broad range of mission scenarios. The team is now investigating the possibilities of Real-time Java, introduced at this year’s JavaOne Conference, for AUV and other robotics applications.
Consensus Building and Peer Review
According to Mr. Mercier, teamwork was every bit as important as technology in the ETS team’s success. “I can’t stress strongly enough that our ability to work together was the key to our success in the competition,” he said. “This is not about 12 individuals working on separate tasks by themselves. Every step of the way, we worked as a team and built consensus, so in the end everyone learned more. And that’s what this is really all about.”
For example, each software change was subject to peer review. All team members would receive an e-mail containing the previous version of the software, the new version incorporating a proposed change, and the rationale behind the change. Far from slowing the process down, the peer review concept got more team members more actively engaged, and ultimately resulted in far higher quality, according to Mr. Mercier. These peer reviews also ease the integration of new team members. Being a volunteer based project, volunteers come and go on a regular basis.
At the same time, the team shared tips and tricks with peers at other educational institutions. “This is more of a friendly rivalry than a dog-eat-dog competition,” said Tennessee Carmel-Veilleux, electrical team leader of the SONIA team. “We like to exchange information with some of the other teams, keep in touch with them. Who knows—we may all be working together some day.”
In recognition of the team’s willingness to work with other teams, and for achievements at the Unmanned Underwater Vehicle Competition, Felix Pageau, team captain, won the Andy Estabrook Award for "initiative and vision in the unmanned underwater systems.” Given for the first time to a student, the award was presented by the Lindbergh Chapter, San Diego, CA, of the AUVSI. Andy Estabrook was a pioneer in unmanned robotics and this award was created to honor his accomplishments in the advance of unmanned systems technology.
What’s next for the ETS team? The team itself is growing rapidly, thanks in part to the success at this year’s competition. The team leaders now find themselves in management roles as the team’s ranks have swollen to 34. “We’re going to compete again next year, and we’re going to focus on making our software more stable, more reliable, and faster,” said Mr. Morissette. In the mean time, the team leaders will be presenting their work at a variety of conferences worldwide—from Florida and Washington D.C. to Cologne, Germany.
And when will they get around to more traditional college activities such as frat parties and beer runs? “Probably never,” said Mr. Mercier. “We’re geeks. We’re doing what we love.”
For more information:
- SONIA website: http://sonia.etsmtl.ca
- Project Squawk (Java implementation of Project SunSPOT):http://research.sun.com/projects/squawk/
- Real-Time Specification for Java (RTSJ): http://www.rtsj.org
- Association for Unmanned Vehicle Systems International (AUVSI) http://www.auvsi.org/
- AUVSI Lindbergh Chapter: http://www.sd-auvsi.org/index.html
Sun在基于AMD Opteron和UltraSPARC®處理器的系統(tǒng)上,采用Sun Studio 11和Solaris 10軟件,創(chuàng)立了四大基準(zhǔn)性能測(cè)試中的三項(xiàng)性能測(cè)試(SPECint2006、SPECfp2006和SPECint_rate2006)的最高記錄,確 立了Sun在標(biāo)準(zhǔn)性能方面的領(lǐng)導(dǎo)地位。采用Sun Studio 11軟件所具有的先進(jìn)性能,如自平行技術(shù)(Auto-Parallelism Technology),基于AMD Opteron處理器的Sun Fire X4200服務(wù)器,其性能超越了基于Intel處理器的競(jìng)爭(zhēng)對(duì)手的系統(tǒng),如HP ProLiant DL380 G4服務(wù)器和HP ProLiant DL385服務(wù)器。Sun還公布了其旗艦產(chǎn)品Sun Fire E25K服務(wù)器的優(yōu)異性能,兌現(xiàn)了它曾對(duì)高端商務(wù)計(jì)算領(lǐng)域做出的承諾。據(jù)IDC公司2006年第二季度全球服務(wù)器市場(chǎng)季度報(bào)告得知,Sun的高端系統(tǒng)針對(duì) Sun Studio軟件做了優(yōu)化,這幫助Sun成為了這一季度內(nèi)取得市場(chǎng)份額增長(zhǎng)的唯一的服務(wù)器廠商。
所創(chuàng)立的SPEC CPU2006基準(zhǔn)性能的測(cè)試記錄是2006年8月24日發(fā)布的。這一記錄是上個(gè)最高記錄的4倍。該基準(zhǔn)性能測(cè)試針對(duì)了各種各樣的負(fù)載,得到了實(shí)際應(yīng)用中 更好的適用性結(jié)果。這一新的基準(zhǔn)性能測(cè)試在各種計(jì)算密集的負(fù)載上測(cè)試了計(jì)算機(jī)處理器、內(nèi)存架構(gòu)和編譯器的性能,這些負(fù)載應(yīng)用包括有,蛋白質(zhì)排序、MPEG -4編碼、XML處理、流體動(dòng)力學(xué)、結(jié)構(gòu)性力學(xué)和語(yǔ)音識(shí)別等。
“Sun Studio軟件繼續(xù)顯示了在幫助開(kāi)發(fā)商最大化其應(yīng)用程序性能的能力上的領(lǐng)導(dǎo)地位,”Sun公司開(kāi)發(fā)工具高級(jí)總監(jiān)Don Kretsch說(shuō),“6個(gè)月內(nèi)50,000次下載,使采用Sun Studio 11軟件的企業(yè)開(kāi)源開(kāi)發(fā)者們獲得了諸多好處:減少了開(kāi)發(fā)時(shí)間,提高了便攜性,還改善了他們所開(kāi)發(fā)的應(yīng)用程序的性能。”
Sun Studio 11軟件為開(kāi)發(fā)者帶來(lái)的最大好處之一就是各個(gè)組件之間的集成性非常好,這些組件包括有:編譯器優(yōu)化組件、多線程警示調(diào)試器、性能分析工具和一個(gè)基于 NetBeans的集成開(kāi)發(fā)環(huán)境(IDE)。這些工具組件還可以在其他的編譯器上工作,這就使開(kāi)發(fā)者們可以很容易地將Sun Studio工具與他們現(xiàn)有的開(kāi)發(fā)環(huán)境混和在一起使用。新發(fā)布的Sun Studio Express項(xiàng)目對(duì)正在研發(fā)中的Sun Studio未來(lái)版本的主要特性將定期予以提供。包括針對(duì)Linux的編譯器優(yōu)化組件在內(nèi)的最新的一些性能在最近于舊金山舉行的2006 LinuxWorld上做了演示。此外,新的Data Race Detection Tool(數(shù)據(jù)族探查工具)對(duì)現(xiàn)有的多線程庫(kù)、多線程工具和編譯器優(yōu)化等特性是一個(gè)重要的補(bǔ)充,可使多線程應(yīng)用的開(kāi)發(fā)變得更加簡(jiǎn)化和容易。
開(kāi)發(fā)者可從網(wǎng)站http://developers.sun.com/sunstudio下載免費(fèi)的、無(wú)限制的Sun Studio軟件。
產(chǎn)品系統(tǒng)要求: SPARC 平臺(tái)
- 內(nèi)存:至少為 512 MB 內(nèi)存;建議使用 1 GB
- 磁盤(pán)空間:1.7 GB
- 安裝光盤(pán)
x86/x64 平臺(tái)
- 內(nèi)存:至少為 512 MB 內(nèi)存;建議使用 1 GB
- 磁盤(pán)空間 (Solaris OS):1.1 GB
- 磁盤(pán)空間 (Linux OS):0.6 GB
- 安裝光盤(pán)
支持的操作系統(tǒng):: Solaris OS
Solaris 8、9 和 10 操作系統(tǒng)整個(gè) Solaris 軟件組、整個(gè) Solaris 軟件組加 OEM 支持或者開(kāi)發(fā)人員 Solaris 軟件組
Linux OS
- Sun Java Desktop System,版本 3
- SUSE Linux Enterprise Server 9
- Red Hat Enterprise Linux 4
許可要求:: 免許可費(fèi)的運(yùn)行時(shí)庫(kù) (.so) 分發(fā)
使用限制:: 您應(yīng)承諾軟件不會(huì)被設(shè)計(jì)、許可或計(jì)劃用于任何核設(shè)施的設(shè)計(jì)、修建、操作或維護(hù)。
支持的相關(guān)標(biāo)準(zhǔn):: C:
- ISO/IEC 9899:1999,編程語(yǔ)言 - C ("C99")
- ISO/IEC 9899:1996,C
- FIPS 160 標(biāo)準(zhǔn)。
- K&R C
- OpenMP C API Version 2.5
C++:
- ISO/IEC 14992:2003 C++ 標(biāo)準(zhǔn)
- OpenMP C++ API 2.5 版
Fortran:
- ANSI X3.198-1992 Fortran 90
- ISO 1539:1991 Fortran
- ISO/IEC 1539-1:1997 Fortran 95
- OpenMP Fortran API 2.5 版
第三方兼容應(yīng)用程序:: GNU Compiler Collection(Linux 平臺(tái))
升級(jí)計(jì)劃:: 源和目標(biāo)級(jí)與以前版本的兼容性以及 GNU C/C++ 兼容性功能,簡(jiǎn)化升級(jí)和采用。
摘要: 今天翻譯了一篇實(shí)錄,先發(fā)到自己的blog上吧,呵呵 開(kāi)放Java平臺(tái)(Micro Edition,微型版)源碼:對(duì)話Sun公司移動(dòng)&嵌入式平臺(tái)高級(jí)主管香農(nóng).林奇 在2006年5月的JavaOne會(huì)議上,Sun微系統(tǒng)公司宣布即將開(kāi)放Java技術(shù)的源碼。目前,Sun已經(jīng)計(jì)劃開(kāi)放大部分Java平臺(tái)的源碼,包括在2006年末之前開(kāi)放Micro Edition (Java ME)和Java平... 閱讀全文
Sun發(fā)布Solaris ZFS-全球最先進(jìn)的文檔系統(tǒng)
Solaris 10 OS最新升級(jí)版包括Solaris ZFS 1.0文檔系統(tǒng)
提供了端到端的數(shù)據(jù)完整性,重新定義縮放能力,大大降低數(shù)據(jù)管理成本
(2006年5月25日訊) Sun Microsystems公司發(fā)布了一個(gè)具有革命性的新的文檔系統(tǒng)Solaris ZFS
1.0,它提供了多項(xiàng)突破性的功能,包括公共管理任務(wù)的自動(dòng)化、保護(hù)數(shù)據(jù)免受非法行為的侵害,以及提供實(shí)際上無(wú)限的縮放能力。Solaris ZFS
1.0將作為我們這個(gè)星球上最先進(jìn)的操作系統(tǒng)Solaris 10
OS的下一個(gè)商業(yè)版本的一個(gè)組成部分在今年6月份對(duì)外正式提供。此外,Solaris 10 OS的最新版本Solaris 10
6/06將先進(jìn)的前攝性自愈技術(shù)和聯(lián)網(wǎng)技術(shù),與對(duì)PostgreSQL開(kāi)源數(shù)據(jù)庫(kù)的全面支持結(jié)合起來(lái),進(jìn)一步強(qiáng)化了Solaris 10
OS作為宿主高性能的關(guān)鍵數(shù)據(jù)庫(kù)解決方案的首選平臺(tái)的地位。
作為世界上最先進(jìn)的文檔系統(tǒng),Solaris ZFS可以自動(dòng)檢測(cè)和修改細(xì)小的數(shù)據(jù)錯(cuò)誤或遭遇意外侵害的數(shù)據(jù),以提供信息的完整性。Solaris
ZFS還因?yàn)椴恍枰碜诠芾砥鞫蟠蠛?jiǎn)化了數(shù)據(jù)的管理,而卷宗管理器是今天數(shù)據(jù)管理事務(wù)中最耗時(shí)、最費(fèi)錢(qián)的部分。例如,今天,一項(xiàng)典型的系統(tǒng)管理任務(wù)可能
需要40多分鐘來(lái)完成,但是采用Solaris
ZFS,僅僅需要幾秒鐘的時(shí)間,且沒(méi)有系統(tǒng)宕機(jī)的危險(xiǎn),從而大大降低了數(shù)據(jù)管理的成本費(fèi)用。此外,Solaris
ZFS還是世界上第一個(gè)128位的文檔系統(tǒng),這使系統(tǒng)具有了實(shí)際上無(wú)限的數(shù)據(jù)容量。Solaris
ZFS提供的先進(jìn)的縮放能力和管理能力,使它成為許許多多傳統(tǒng)UNIX?文檔系統(tǒng)的理想替代品。
Solaris是宿主高性能數(shù)據(jù)庫(kù)的杰出平臺(tái)。最近,Oracle指名Solaris 10
OS作為其開(kāi)源64位開(kāi)發(fā)和部署環(huán)境的理想平臺(tái)。現(xiàn)在,Sun還將開(kāi)源PostgreSQL數(shù)據(jù)庫(kù)集成在Solaris 10
OS的最新版本內(nèi),對(duì)PostgreSQL數(shù)據(jù)庫(kù)提供全面支持。Sun與PostgreSQL社團(tuán)開(kāi)展合作,讓他們采用Solaris 10
OS提供的各種先進(jìn)技術(shù),如前攝性自愈技術(shù)、Solaris分區(qū)特性和Solaris動(dòng)態(tài)跟蹤能力(DTrace)等。
“面對(duì)不斷增長(zhǎng)的依順性要求,今天的數(shù)據(jù)量每9~12個(gè)月就要翻番,但今天的文檔系統(tǒng)還植根在上世紀(jì)70年代的技術(shù)之中,”Sun公司主管系統(tǒng)軟件部的
副總裁Tom Goguen說(shuō),“Solaris
ZFS從設(shè)計(jì)之初就是要迎接今天數(shù)據(jù)管理的挑戰(zhàn),它的預(yù)期壽命是20~30年。這一128位的文檔系統(tǒng)所能存儲(chǔ)的自愈數(shù)據(jù)是今天已有文檔系統(tǒng)的160億
倍,同時(shí)還大大簡(jiǎn)化了卷宗的管理。Solaris ZFS將是今年內(nèi)發(fā)布的最重要的創(chuàng)新技術(shù)之一。”
Solaris
10是我們這個(gè)星球上最先進(jìn)的操作系統(tǒng),它可在650多款SPARC和x64/x86平臺(tái)上運(yùn)行,獲得來(lái)自獨(dú)立軟件廠商的2,200多種應(yīng)用程序的支持。
其無(wú)與倫比的功能性和硬件平臺(tái)的支持,加上它所提供的行業(yè)唯一的應(yīng)用兼容性保證,加快了Solaris 10
OS在全球的應(yīng)用步伐,目前Solaris 10 OS的注冊(cè)許可數(shù)已超過(guò)450萬(wàn)。
具有革命性的新的文檔系統(tǒng)技術(shù)
Solaris ZFS 1.0具有任何其他商用文檔系統(tǒng)技術(shù)所無(wú)法匹敵的優(yōu)異性能。客戶可以從Solaris ZFS技術(shù)中享用到先進(jìn)的數(shù)據(jù)完整性技術(shù)、使用和管理的簡(jiǎn)易性、難以置信的高性能,以及實(shí)際上無(wú)限的縮放能力。
- 端到端的數(shù)據(jù)完整性―― 基于校驗(yàn)和與事務(wù)性寫(xiě)入復(fù)制(copy-on-write)機(jī)制的突破性的結(jié)合,Solaris ZFS可提供滿足CIO和系統(tǒng)管理員要求的數(shù)據(jù)準(zhǔn)確性。Solaris ZFS擁有先進(jìn)的錯(cuò)誤檢測(cè)機(jī)制,能識(shí)別被損壞的數(shù)據(jù),并將之在運(yùn)行中修改過(guò)來(lái)。例如,鏡像的一側(cè)被意外地重寫(xiě),ZFS可以對(duì)之檢測(cè)、修補(bǔ)和恢復(fù),且完全不 干擾服務(wù)的進(jìn)行。
- 簡(jiǎn)化的管理――Solaris ZFS提供了一種基于共享的架構(gòu)模式,使所有的共享數(shù)據(jù)和功能納入虛擬內(nèi)存管理。Solaris ZFS文檔系統(tǒng)可以自動(dòng)地增長(zhǎng)或收縮,而無(wú)需占據(jù)額外存儲(chǔ)空間的卷宗管理器。Solaris ZFS還提供了在任何時(shí)間點(diǎn)上對(duì)文檔系統(tǒng)進(jìn)行瞬間快照的能力,這就大大節(jié)約了一般系統(tǒng)管理員手工恢復(fù)文檔所花費(fèi)的時(shí)間和資源。
- 性能的巨大提升――Solaris ZFS的架構(gòu)設(shè)計(jì)有助于提高速度。寫(xiě)入復(fù)制的設(shè)計(jì)可將隨意寫(xiě)入轉(zhuǎn)變?yōu)榭焖龠B續(xù)寫(xiě)入。其輸入/輸出(I/O)帶寬在有數(shù)據(jù)存儲(chǔ)時(shí)可自動(dòng)加大。無(wú)論工作量如 何,多種字區(qū)尺寸會(huì)自動(dòng)做出最佳配合。智能化的預(yù)取感式讀取可加快運(yùn)行速度。而且,它的高級(jí)的、可擴(kuò)展的I/O子系統(tǒng)設(shè)計(jì)采用了記分板式的流水線操作和依 賴(lài)性時(shí)序安排,同樣提供了極大的性能提升。
-
無(wú)限的數(shù)據(jù)容量――Solaris ZFS是世界上第一個(gè)128位文檔系統(tǒng),具有實(shí)際上無(wú)限的數(shù)據(jù)容量。
Sun公司簡(jiǎn)介
一個(gè)獨(dú)具特色的理念――“網(wǎng)絡(luò)就是計(jì)算機(jī)”,指引著Sun各項(xiàng)技術(shù)的發(fā)展,為全球各個(gè)重要的市場(chǎng)增添活力。Sun共享創(chuàng)新和創(chuàng)建社團(tuán)的思想體系處于新
一代網(wǎng)絡(luò)計(jì)算-參與時(shí)代-的最前沿。Sun的足跡遍及全球100多個(gè)國(guó)家和地區(qū),其互聯(lián)網(wǎng)的網(wǎng)址為http://www.sun.com。Sun公司的中
文網(wǎng)址為http://www.sun.com.cn。
ZFS是第一個(gè)128位的文件系統(tǒng),同時(shí)ZFS又被Sun
Microsystems稱(chēng)作史上最后一個(gè)文件系統(tǒng)。因?yàn)檫@個(gè)文件系統(tǒng)含有多項(xiàng)創(chuàng)新技術(shù),不僅成功地解決現(xiàn)有文件系統(tǒng)的問(wèn)題和陋習(xí),而且前瞻性地考量了未
來(lái)對(duì)存儲(chǔ)空間的需求,單個(gè)文件系統(tǒng)可以達(dá)到256 quadrillion(264) Zettabytes(221)。
ZFS不僅符合POSIX文件系統(tǒng)的標(biāo)準(zhǔn),而且提供了許多高級(jí)功能比如:Quota(配額),Reservation(預(yù)留),
Compression(壓縮),
Snapshot(快照),Clone(克隆)等。如果你還在堅(jiān)持使用現(xiàn)有32位或者64位的文件系統(tǒng),如果你還在“痛并不快樂(lè)著”地用著各式各樣的
Volume Manager,那就很值得看看這里列出的使用ZFS的十條理由。
1. 再也不需要fsck, scandisk
不管你是在用Linux,UNIX還是Windows,相信大家都有過(guò)類(lèi)似的體會(huì):當(dāng)系統(tǒng)意外斷電或者非法關(guān)機(jī),系統(tǒng)重起后發(fā)現(xiàn)文件系統(tǒng)有
inconsistent的問(wèn)題,這時(shí) 候就需要fsck或者scandisk
來(lái)修復(fù),這段時(shí)間是非常耗時(shí)而且最后不一定能夠修復(fù)成功。更糟糕的是,如果這是一臺(tái)服務(wù)器需要做fsck的時(shí)候,只能offline(下線),而且現(xiàn)有應(yīng)
用往往都是大硬盤(pán),相應(yīng)fsck修
復(fù)時(shí)間也很長(zhǎng),這對(duì)許多使用該服務(wù)器的用戶來(lái)說(shuō)幾乎不能忍受的。而使用ZFS后大家可以徹底拋棄fsck這種工具,因?yàn)閆FS是一個(gè)基于COW(Copy
on
Write)機(jī)制的文件系統(tǒng)。COW是不會(huì)對(duì)硬盤(pán)上現(xiàn)有的文件進(jìn)行重寫(xiě),保證所有硬盤(pán)上的文件都是有效的。所以不會(huì)有這種inconsistent的概
念,自然就不需要這種工具了。
2. 管理簡(jiǎn)單
ZFS作為一個(gè)全新的文件系統(tǒng),全面拋棄傳統(tǒng)File System
+ Volume Manager + Storage的架構(gòu),所有的存儲(chǔ)設(shè)備是通過(guò)ZFS Pool進(jìn)行管理,只要把各種存儲(chǔ)設(shè)備加 入同一個(gè)ZFS
Pool,大家就可以輕松的在這個(gè)ZFS Pool管理配置文件系統(tǒng)。大家再也不用牢記各種專(zhuān)業(yè)概念,各種命令newfs,
metinit及各種Volume Manager的用法。在ZFS中我們只需要兩個(gè)命令,zpool(針 對(duì)ZFS
Pool管理)和zfs(針對(duì)ZFS文件系統(tǒng)的管理),就可以輕松管理128位的文件系統(tǒng)。舉個(gè)例子,我們經(jīng)常會(huì)遇到系統(tǒng)數(shù)據(jù)增長(zhǎng)過(guò)
快,現(xiàn)有存儲(chǔ)容量不夠,需要添加硬盤(pán),如果依照傳統(tǒng)的Volume Manager管理方式,那我
們需要預(yù)先要考慮很多現(xiàn)有因素,還要預(yù)先根據(jù)應(yīng)用計(jì)算出需要配置的各種參數(shù)。在ZFS情況下,我們的系統(tǒng)管理員可以徹底解放,再也不需要這種人為的復(fù)雜
考慮和計(jì)算,我們可以把這些交給ZFS,因?yàn)閆FS Pool會(huì)自動(dòng)調(diào)節(jié),動(dòng)態(tài)適應(yīng)需求。我們只需一個(gè)簡(jiǎn)單的命令為 這個(gè)ZFS
Pool加入新的硬盤(pán)就可以了:
zpool add zfs_pool mirror c4t0d0 c5t0d0
基于這個(gè)動(dòng)態(tài)調(diào)節(jié)的ZFS Pool之上的所有的文件系統(tǒng)就可以立即使用到這個(gè)新的硬盤(pán),并且會(huì)自動(dòng)的選擇最優(yōu)化的參數(shù)。
而且ZFS同時(shí)也提供圖形化的管理界面,下面是一個(gè)ZFS圖形化管理的一個(gè)截屏:
[attachment=2119]
3. 沒(méi)有任何容量限制
ZFS(Zettabyte File
System)文件系統(tǒng)就如其名字所預(yù)示,可以提供真正的海量存儲(chǔ),在現(xiàn)實(shí)中幾乎不可能遇到容量問(wèn)題。在現(xiàn)有的64位kernel(內(nèi)
核)下,它可以容納達(dá)到16 Exabytes(264)大小的單個(gè)文件,可以使用264個(gè)存儲(chǔ)設(shè)備,可以創(chuàng)建264個(gè)文件系統(tǒng)。
4. 完全保證 數(shù)據(jù) 的正確和完整
由于ZFS所有的數(shù)據(jù)操作都是基 于Transaction(事務(wù)),一組相應(yīng)的操作會(huì)被ZFS解
析為一個(gè)事務(wù)操作,事務(wù)的操作就代表著一組操作要么一起失敗,要么一起成功。而且如前所說(shuō),ZFS對(duì) 所有的操作是基于COW(Copy on
Write), 從而保證設(shè)備上的數(shù) 據(jù)始終都是有效的,再也不會(huì)因?yàn)橄到y(tǒng)崩潰或者意外掉電導(dǎo)致數(shù)據(jù)文件的inconsistent。
還有一種潛在威脅 數(shù)據(jù)的可能是來(lái)自于硬件設(shè)備的問(wèn)題,比如磁
盤(pán),RAID卡的硬件問(wèn)題或者驅(qū)動(dòng)bug。現(xiàn)有文件系統(tǒng)通常遇到這個(gè)問(wèn)題,往往只是簡(jiǎn)單的把錯(cuò)誤數(shù)據(jù)直接交給上層應(yīng)用,通常我們把這個(gè)問(wèn)題稱(chēng)作
Silent Data Corruption。而在ZFS中,對(duì)所有數(shù)據(jù)不管是用戶數(shù)據(jù)還是文件系統(tǒng)自身的metadata數(shù)
據(jù)都進(jìn)行256位的Checksum(校 驗(yàn)),當(dāng)ZFS在提交數(shù)據(jù)時(shí)會(huì)進(jìn)行校驗(yàn),徹底杜絕這種Silent Data Corruption情況。
5. 提供優(yōu)異 性能和擴(kuò)展性
和傳統(tǒng)File System + Volume Manager + Storage架構(gòu)不同,ZFS則是直接基于存儲(chǔ)設(shè)備提供所有的功能,因此有自己獨(dú)有的創(chuàng)新特性,性能自然非比尋常。
* Dynamic Striping vs. Static Striping
由于ZFS是基于COW和一個(gè)全局動(dòng)態(tài)的ZFS Pool,任何一次寫(xiě) 操作,都是對(duì)一塊新數(shù)據(jù)塊(Block)的一次寫(xiě)操作。ZFS從ZFS
Pool中動(dòng)態(tài)挑選出一個(gè)最優(yōu)的設(shè)備,并且以一個(gè)transaction(事
務(wù))線性寫(xiě)入,充分有效地利用了現(xiàn)有設(shè)備的帶寬,我們把這個(gè)特性稱(chēng)為Dynamic Striping。而相對(duì)應(yīng)的Static
Striping則是傳統(tǒng)文件系統(tǒng)所使用的方式,Static Striping需要管理員預(yù)先對(duì)這組Stripe進(jìn)行正確地計(jì)算人為
設(shè)置,而且如果加入新的設(shè)備則需要再次人為的計(jì)算和設(shè)置,更為嚴(yán)重的是如果人為計(jì)算錯(cuò)誤,則會(huì)直接影響系統(tǒng)的性能。而在使用Dynamic
Striping這種特性之后,我們根本不需要人為介入,ZFS會(huì)自動(dòng)調(diào)整,智能的為你 提供最佳的設(shè)備,最快的操作方式。
* 支持多種 大小的數(shù)據(jù)塊(Multiple Block Size)
ZFS支持多種大小的數(shù)據(jù)塊定義,從512字節(jié)到1M字節(jié)。和傳統(tǒng)文件系統(tǒng)往往都是固定大小數(shù)據(jù)塊不同,ZFS則是可以動(dòng)態(tài)的根據(jù)不同 大小的文件進(jìn)行計(jì)算,動(dòng)態(tài)的選擇最佳的數(shù)據(jù)塊。
因?yàn)椴煌笮?shù)據(jù)
塊,直接影響到實(shí)際使用硬盤(pán)容量和讀取速度。如果使用較小的數(shù)據(jù)塊,存儲(chǔ)文件所導(dǎo)致的碎片則較少,讀寫(xiě)小文件更快一些,但是會(huì)導(dǎo)致需要?jiǎng)?chuàng)建更多的
metadata,讀寫(xiě)大文件則會(huì)更費(fèi)時(shí)。如果使用較大的數(shù)據(jù)塊,使用的metadata較少,更利于讀寫(xiě)大文件,但是會(huì)導(dǎo)致更多的碎片。ZFS根據(jù)實(shí)際
調(diào)查現(xiàn)有文件使 用的情況,分析出一個(gè)選擇數(shù)據(jù)塊大小的算法,動(dòng)態(tài)的根據(jù)實(shí)際文件大小確定最佳的數(shù)據(jù)塊。所以ZFS是
非常智能的,在不需要系統(tǒng)管理員介入,就可以得到一個(gè)自我調(diào)優(yōu)的結(jié)果。當(dāng)然ZFS也支持用戶對(duì)單個(gè)文件或者整個(gè)文件系統(tǒng)
所使用的數(shù)據(jù)塊大小的自定義設(shè)置。
* 智能預(yù)讀取(Intelligent Prefetch)
多數(shù)的操作系
統(tǒng)都 有這種將數(shù)據(jù)預(yù)先讀取的功能,而ZFS則是建立在文件系統(tǒng)上直接提供的一種更加智能的數(shù)據(jù)預(yù)讀取功能。它不僅可以智能地識(shí)別出多種讀取模式, 進(jìn)
行提前讀取數(shù)據(jù),而且可以對(duì)每個(gè)讀取數(shù)據(jù)流進(jìn)行這種預(yù)讀取智能識(shí)別,這個(gè)對(duì)許多流媒體提供者來(lái)說(shuō)是件非常好的事情。
在擴(kuò)展性上,和現(xiàn)有文件系統(tǒng)多是基于一個(gè)受限的靜態(tài)模型不同,ZFS是采用ZFS Pool這個(gè)動(dòng)態(tài)概念,它的metadata也是動(dòng)態(tài),并且讀寫(xiě)操作都是可并行的,并且具有優(yōu)先級(jí)概念,所以即使在大數(shù)據(jù)量,多設(shè)備的情況下仍可以保證性能的線性增長(zhǎng)。
6. 自我修復(fù)功能
* ZFS Mirror 和 RAID-Z
傳統(tǒng)的硬盤(pán)Mirror及RAID 4,RAID 5陣列方式都會(huì)遇到前面提到過(guò)的問(wèn)題:Silent Data
Corruption。如果發(fā)生了某塊硬盤(pán)物理問(wèn)題導(dǎo)致數(shù)據(jù)錯(cuò)誤,現(xiàn)有的Mirror,包括RAID 4,RAID
5陣列會(huì)默默地把這個(gè)錯(cuò)誤數(shù)據(jù)提交給上層應(yīng)用。如果這個(gè)錯(cuò)誤發(fā)生在Metadata中,則會(huì)直接導(dǎo)致系統(tǒng)的Panic。
而且還有一種更為嚴(yán)重的情況是:在RAID 4和RAID
5陣列中,如果系統(tǒng)正在計(jì)算Parity數(shù)值,并再次寫(xiě)入新數(shù)據(jù)和新Parity值的時(shí)候發(fā)生斷電,那么整個(gè)陣列的所有存儲(chǔ)的數(shù)據(jù)都毫無(wú)意義了。
在ZFS中則提出了相對(duì)應(yīng)的ZFS
Mirror和RAID-Z方式,它在負(fù)責(zé)讀取數(shù)據(jù)的時(shí)候會(huì)自動(dòng)和256位校驗(yàn)碼進(jìn)行校驗(yàn),會(huì)主動(dòng)發(fā)現(xiàn)這種Silent Data
Corruption,然后通過(guò)相應(yīng)的Mirror硬
盤(pán)或者通過(guò)RAID-Z陣列中其他硬盤(pán)得到正確的數(shù)據(jù)返回給上層應(yīng)用,并且同時(shí)自動(dòng)修復(fù)原硬盤(pán)的Data Corruption 。
* Fault Manager
在Solaris 10中,包含 一個(gè)ZFS診斷引擎和Solaris的 Fault Manager(這也是Solaris 10的
另一個(gè)新特性)交互,可以實(shí)時(shí)地診斷分析并且報(bào)告ZFS Pool和存儲(chǔ)設(shè)備的錯(cuò)誤,用戶可以通過(guò)Fault
Manager及時(shí)得到一個(gè)非常友善的消息。這個(gè)診斷引擎雖然不會(huì)采取主動(dòng)的行為去修復(fù)或者解決
問(wèn)題,但是會(huì)在消息中提示系統(tǒng)管理員可采取的動(dòng)作。類(lèi)似下面一個(gè)ZFS報(bào)錯(cuò)消息,其中REC-ACTION就是建議采取的動(dòng)作:
SUNW-MSG-ID: ZFS-8000-D3, TYPE: Fault, VER: 1, SEVERITY: Major
EVENT-TIME: Fri Mar 10 11:09:06 MST 2006
PLATFORM: SUNW,Ultra-60, CSN: -, HOSTNAME: neo
SOURCE: zfs-diagnosis, REV: 1.0
EVENT-ID: b55ee13b-cd74-4dff-8aff-ad575c372ef8
DESC: A ZFS device failed. Refer to http://sun.com/msg/ZFS-8000-D3 for more information.
AUTO-RESPONSE: No automated response will occur.
IMPACT: Fault tolerance of the pool maybe compromised.
REC-ACTION: Run ’zpool status -x’ and replace the bad device.
7. 安全
在安全上,ZFS支持類(lèi)似NT風(fēng)格NFSv4版的ACL(讀取控制列表)。而且前面所提到的256位驗(yàn)證碼,用戶可選擇多種驗(yàn)證方式,包括SHA-256驗(yàn)證算法,從而在物理存儲(chǔ)單元級(jí)別上保證數(shù)據(jù)的安全性。
8. 超強(qiáng)功能
ZFS作為“最后一個(gè)文件系統(tǒng)”,涵蓋了基本的文件系統(tǒng)和Volume管理的功能,同時(shí)
一并提供許多企業(yè)級(jí)別的超強(qiáng)功能:Quota(配額),Reservation(預(yù)留), Compression(壓 縮),
Snapshot(快照),Clone(克隆)。并且速度非常快。有了這個(gè)文件系統(tǒng),大家再也不需要任何Volume Manager了。
9. 兼容性
ZFS是一個(gè)完全兼容POSIX規(guī)范的文件系統(tǒng),所以處于上層的應(yīng)用程序是完全不受影響。ZFS也提供一個(gè)Emulated
Volume模塊,可以把任何一個(gè)ZFS文件系統(tǒng)作為普通的塊設(shè)備使用。同時(shí)ZFS也可以使用基于Volume
Manager構(gòu)建的Volume作為存儲(chǔ)設(shè)備單 元。這樣在不需要修改應(yīng)用程序,不修改已有文件系統(tǒng)下,給了大家最大的自由度去獲得ZFS提供的各
種特性。
10. 開(kāi)源
ZFS是Sun Microsystems公 司作為OpenSolaris的一個(gè)開(kāi)源項(xiàng)目運(yùn)作并且完全免費(fèi)使用,點(diǎn)擊這里(http://www.opensolaris.org/os/community/zfs/source/) 可以直接瀏覽到ZFS的代碼。 這就代表著我們不僅同時(shí)可以享受商業(yè)公司的高質(zhì)量,也可以獲得開(kāi)源模式的優(yōu)點(diǎn)。
雖然目前只有Solaris支持該文件系統(tǒng),但是這種開(kāi)源的模式必定會(huì)促進(jìn)更多基于ZFS的應(yīng)用。現(xiàn)在已經(jīng)有國(guó)外開(kāi)發(fā)者正在將ZFS移植到Linux和
Mac OS上來(lái)。如果想要體驗(yàn)一下ZFS,由于目前它和Solaris 10綁定在一起,所以需要下載最新版的Solaris 10 6/06 (http://www.sun.com/software/solaris/get.jsp)。
參考:
Solaris ZFS Administration Guide: http://docs.sun.com/app/docs/doc/819-5461?l=zh&q=ZFS
Solaris 10 Zone FAQ: http://www.sun.com/software/solaris/faqs/zfs.xml
Automatic Performance Tuning in the Zettabyte File System: http://tesla.hpl.hp.com/self-manage03/Finals/henson-self-tune.pdf
昨天是我sun技術(shù)大使入職第一天,即興奮又感覺(jué)自己充滿了責(zé)任。下周要去北京和兄弟院校的大使,參加技術(shù)培訓(xùn)。
我一直很努力的學(xué)習(xí)著,雖然也曾彷徨,也曾摒棄過(guò)中國(guó)的教育,但是我知道我逃脫不掉,所以我還要好好學(xué)習(xí),要保研,很想出國(guó)......大三了,讓我認(rèn)識(shí)了sun中國(guó)研究院,并加入了sun校園技術(shù)大使的行列,讓我榮幸萬(wàn)分。所以我又不斷地告訴自己,好好學(xué)習(xí),好好學(xué)習(xí)技術(shù),好好服務(wù)自己的母校、祖國(guó).....真的
今天早上,我和幾個(gè)同學(xué),早早的起來(lái),出去掛上了Sun技術(shù)講座的條幅,去北京前,我會(huì)先作一個(gè)講座,我真的很感謝我的同學(xué)......其實(shí),正是很多小事,才會(huì)讓我們真正感動(dòng)。
vold存在于進(jìn)程之中,我們可以通過(guò)ps -ef命令進(jìn)行查詢(xún),它的存在使得插上U盤(pán)后,系統(tǒng)可以自動(dòng)識(shí)別設(shè)備。
如果無(wú)法自動(dòng)識(shí)別,我們可以嘗試重新啟動(dòng)vold,操作方法如下:pkill -HUP vold 這個(gè)時(shí)候插上U盤(pán),是否U盤(pán)燈亮了?
如果還不亮,請(qǐng)執(zhí)行rmformat命令,這個(gè)東西類(lèi)似Windows中的檢查硬件改變操作,它可以自動(dòng)查出剛剛插上的U盤(pán)(極個(gè)別品牌U盤(pán)例外,依照以往經(jīng)驗(yàn)……愛(ài)國(guó)者的U盤(pán)最容易被識(shí)別)。
系統(tǒng)識(shí)別了U盤(pán),接下來(lái)我們就要mount一下了,具體操作是:mount -F pcfs -o ro /dev/dsk/c2t0d0p0:c /mnt,不過(guò)你的U盤(pán)是不是c2t0d0p0這個(gè)設(shè)備,我這里可是說(shuō)不好,你自己試驗(yàn)一下吧 用mount查一下就OK了。
1、直接插上u盤(pán),然后ls -l /dev/usb,看是否發(fā)現(xiàn)usb設(shè)備。 不過(guò)今天用 ls -l |grep usb 自動(dòng)就識(shí)別咯。(Netac朗科) 2、在/etc/dsk里查詢(xún)到usb對(duì)應(yīng)的設(shè)備名稱(chēng)(ls -l /dev/dsk) 3、直接mount -F pcfs /dev/dsk/c1t0d0s0 /mnt 然后就可以了。 進(jìn)/mnt目錄。ls就可以查看到u盤(pán)里的內(nèi)容了。
# rmformat
姝e湪鏌ユ壘璁懼...
1. Logical Node: /dev/rdsk/c3t0d0s2
Physical Node: /pci@0,0/pci1028,182@1d,2/storage@1/disk@0,0
Connected Device: Netac OnlyDisk 1.21
Device Type: Removable
2. Logical Node: /dev/rdsk/c3t0d0p0
Physical Node: /pci@0,0/pci1028,182@1d,2/storage@1/disk@0,0
Connected Device: Netac OnlyDisk 1.21
Device Type: Removable
# mount -f pcfs /dev/dsk/c3t0d0s2:c /usb
mount: No such device or address
# mount -f pcfs /dev/rdsk/c3t0d0p0:c /usb
mount: Block device required
# mount -f pcfs /dev/rdsk/c3t0d0s2 /usb
mount: Block device required
# mount -f pcfs /dev/rdsk/c3t0d0s2:c /usb
mount: Block device required
# mount -f pcfs /dev/dsk/c3t0d0p0:c /usb
卸載 #umount /usb
#eject /dev/rdsk/c3t0d0p0
今天還發(fā)現(xiàn),(朗科)u盤(pán) 在用戶注銷(xiāo)重新登陸時(shí),可以自動(dòng)掛載
昨天在自己的筆記本(DellD610)上安裝了Solaris10操作系統(tǒng),分區(qū)情況如下,c0d0/c/d/e/f+(2.9G),c盤(pán)放的Xp系統(tǒng),D盤(pán)還是原來(lái)windows下的軟件。f盤(pán)裝的則是Solaris操作系統(tǒng)。首先,在安裝過(guò)程中,Solaris給我的印象很好,因?yàn)樗坪躏@卡它已經(jīng)識(shí)別了,所以顯示的很清楚,java的風(fēng)格我本人也是比較喜歡的。
其它的軟件安裝: 網(wǎng)站:sun軟件包最主要的網(wǎng)站是http://www.sunfreeware.com,其次是各開(kāi)源網(wǎng)站如http://mirror.vmmatrix.net ,還有其他一些(如apache 的網(wǎng)站 www.apache.org)。如果不知道某個(gè)軟件的下載地址,可以在 www.google.com里搜索。安裝包下載到本地磁盤(pán),必須把這些包存放到運(yùn)行 solaris10的機(jī)器上。Wget似乎是一個(gè)很受歡迎的下載工具,情況也是如此。不巧的是,solaris10本身不帶wget這個(gè)工具,所以初始安 裝的系統(tǒng)還不能使用這個(gè)便利。有的網(wǎng)友先把文件下載到windows,然后用ssh secure file transfer把它傳輸?shù)絪olaris 10的某個(gè)目錄。
1、wget下載。例如下載apache到當(dāng)前目錄的命令為:wget ftp://ftp.sunfreeware.com/pub/freeware/intel/10/apache-2.2.0-sol10-x86-local.gz 。
下載完成后,用命令# ls -al查看當(dāng)前目錄是否有剛才現(xiàn)在的文件存在。
2、用ssh secure file transfer傳送。這個(gè)比較簡(jiǎn)單,不再多說(shuō)。
當(dāng)然,我也認(rèn)為使用掛載也是完全可以的。
Solaris10 安裝軟件包的方法主要有三種:solaris包、二進(jìn)制源碼、安裝腳本。接下來(lái)分別介紹這幾種安裝方法。
1、solaris 10包。Solaris包的文件格式大致是*-local.gz ,如apache的包文件apache-2.2.0-sol10-x86-local.gz。在安裝一個(gè)包之前,我們應(yīng)當(dāng)先查看系統(tǒng)中是否已經(jīng)安裝了該軟 件包;通過(guò)運(yùn)行包管理工具pkginfo來(lái)了解系統(tǒng)中已安裝的包。運(yùn)行 # pkginfo 可能有較長(zhǎng)的輸出,以至于需要多屏才能顯示完整,為方便閱讀,最好在后面加一管道(# pkginfo | more)。如果所需的包沒(méi)有安裝到系統(tǒng),執(zhí)行下面兩個(gè)命令來(lái)安裝(此處以包wget為例):# gzip –d wget-1.10.2-sol10-x86-local.gz //把包解開(kāi),解開(kāi)后原壓縮包自動(dòng)刪除,當(dāng)前目錄下生成文件wget-1.10.2-sol10-x86-local。
# pkgadd –d wget-1.10.2-sol10-x86-local //執(zhí)行后會(huì)有交互命令,請(qǐng)根據(jù)具體的環(huán)境做出選擇.在回答了包管理管理器若干問(wèn)題之后,一個(gè)軟件包就安裝到系統(tǒng)上,再運(yùn)行包管理命令 # pkginfo –l | grep <包名>查看詳細(xì)的安裝信息。從這個(gè)過(guò)程我們可以知道,安裝solaris包確實(shí)是很容易的事情,但筆者認(rèn)為,在安裝過(guò)程中,它會(huì)把解開(kāi)后的 文件復(fù)制到不同的目錄(位置),究竟都復(fù)制了那些文件到那些目錄,并不是一個(gè)容易弄清楚的。
2、二進(jìn)制源碼。二進(jìn)制源碼是通用的linux/unix軟件包安裝方法,也是管理員最?lèi)?ài)的安裝手段。相對(duì)于solaris包而言,二進(jìn)制源碼包的數(shù)量遠(yuǎn) 遠(yuǎn)大于前者(有很多GNU軟件并不提供solaris 包),這也是選擇二進(jìn)制源碼安裝的原因,當(dāng)然,用二進(jìn)制源碼安裝,使得整個(gè)操作更具靈活性。在這里我們以web服務(wù)器apache的安裝為例。
# gzip –d httpd-2.2.0.tar.gz
# tar xvf httpd-2.2.0.tar
# cd httpd-2.2.0
# ./configure –prefix=/usr/local/apache2 –enable-so //配置操作,具體的選項(xiàng)可以通過(guò)執(zhí)行命令# ./configure –help查看。此處指定了安裝apache的路徑及模塊的加載方式
# make //配置過(guò)程順利完成后,才可以繼續(xù)這個(gè)編譯過(guò)程。
# make install //同樣需要等到編譯操作(make)完成再進(jìn)行安裝,這一步是把文件及目錄復(fù)制到指定的安裝目錄。
這個(gè)例子是通用的linux/unix軟件安裝步驟,但不要認(rèn)為所以的二進(jìn)制源碼都是這樣的安裝操作(請(qǐng)注意:這只是一般情況),一個(gè)好的習(xí)慣就是:在把 下載的源碼包文件解壓成目錄后,打開(kāi)里面的文件README或INSTALL文本文件,就可能看到安裝軟件包的方法,至于更多細(xì)節(jié),可以登錄該軟件的發(fā)布 網(wǎng)站查詢(xún)相關(guān)文檔。在執(zhí)行配置操作時(shí),如果不指定安裝路徑的話,在安裝結(jié)束以后,文件會(huì)分散到系統(tǒng)目錄的各個(gè)角落(比如執(zhí)行腳本會(huì)復(fù)制到 /usr/sbin,配置文件可能會(huì)在目錄/etc中找到,等等),為了方便管理維護(hù),強(qiáng)烈建議配置時(shí)指定安裝目錄。
3、安裝腳本。大型的軟件為了方便用戶的安裝,往往提供一個(gè)安裝腳本,比如sybase、oracle等。這種安裝方法本身很簡(jiǎn)單,只需執(zhí)行這個(gè)安裝腳本而 已,接著安裝程序會(huì)跟用戶交互,比如指定安裝路徑等。不過(guò),有些軟件在執(zhí)行安裝前,需要配置環(huán)境變量諸如此類(lèi)的預(yù)處理,以滿足軟件安裝的特殊需求。就拿數(shù) 據(jù)庫(kù)服務(wù)器oracle 10g為例,在執(zhí)行安裝腳本前,就必須配置環(huán)境變量和更改內(nèi)核參數(shù)以及添加用戶等預(yù)處理操作。
軟件包的卸載。Solaris包:執(zhí)行命令 # pkgrm <package name>。二進(jìn)制源碼:直接刪除安裝目錄。
腳本方式安裝:卸載腳本或直接刪除安裝目錄。 /**
*@ the titlt about a Random example about choose 7 from 33
*@ the auther Nicky (EN) QuQiang(CH)
*@ the date 2006.9.1
**/
/** the rules
//一等獎(jiǎng):選中6個(gè)正選號(hào)及特別號(hào);
//二等獎(jiǎng):選中5個(gè)正選號(hào)及特別號(hào);
//三等獎(jiǎng):選中5個(gè)正選號(hào);
//四等獎(jiǎng):選中4個(gè)正選號(hào)及特別號(hào);
//五等獎(jiǎng):選中4個(gè)正選號(hào)或選中3個(gè)正選號(hào)及特別號(hào);
//六等獎(jiǎng):選中3個(gè)正選號(hào)。
**/
import java.util.*;
public class NotSameRandoml{
private static String transform;
private static String match="00";
private static int special;
//產(chǎn)生彩票主邏輯函數(shù)
private static void Nicky(int[] guess){
Random r = new Random(); //構(gòu)造偽隨機(jī)生成器
//某些映射實(shí)現(xiàn)可明確保證其順序,如 TreeMap 類(lèi);某些映射實(shí)現(xiàn)則不保證順序,如 HashMap 類(lèi)
Map map = new TreeMap(); //Map 接口的實(shí)現(xiàn)
int n = 0;
int nt = 1;
String[] temps=new String[7];
while(true){
n = r.nextInt(33)+1; //產(chǎn)生1~33的隨機(jī)數(shù)
//if( map.get(new Integer(n))!=null){
// nt = ((Integer)map.get(new Integer(n))).intValue();
//}
//避免了產(chǎn)生的隨機(jī)數(shù)字重復(fù)
if(map.containsValue(n)){
continue;
}
map.put(new Integer(nt),new Integer(n));//將指定的值與此映射中的指定鍵相關(guān)聯(lián)
if(map.size()==7){
break;
}
nt++;
}
Iterator it = map.keySet().iterator(); //返回此映射中包含的鍵的 set 視圖
for(int i=0;it.hasNext();i++){
Object o = it.next();
// 為了更符合現(xiàn)實(shí)中33選7,數(shù)字為01。。。2位
int temp=((Integer)map.get(o)).intValue();
if(temp>=1&&temp<10){
transform="0"+Integer.toString(temp);
match=match+" "+transform;
temps[i]=transform;
if(((Integer)o).intValue()==7){
special=temp;
System.out.println(""+transform+"為產(chǎn)生的特別中獎(jiǎng)中獎(jiǎng)號(hào)碼");
}else
System.out.println(""+transform+"為產(chǎn)生的第"+((Integer)o).intValue()+"個(gè)中獎(jiǎng)號(hào)碼");
}else{
temps[i]=Integer.toString(temp);
match=match+" "+temps[i];
if(((Integer)o).intValue()==7){
System.out.println(""+transform+"為產(chǎn)生的特別中獎(jiǎng)中獎(jiǎng)號(hào)碼");
}else
System.out.println(""+temp+"為產(chǎn)生的第"+((Integer)o).intValue()+"個(gè)中獎(jiǎng)號(hào)碼");
}
}
String creat=match.substring(3);
System.out.println("所產(chǎn)生的中獎(jiǎng)號(hào)碼串為:"+creat);
//System.out.println("對(duì)產(chǎn)生的中獎(jiǎng)號(hào)碼順序排序?yàn)?"+creats);
Sort(temps);
check(map,guess);
}
//實(shí)現(xiàn)排序,也可以調(diào)用方法,但是卻必須要解決Void問(wèn)題
private static void Sort(String[] temps) {
for(int i=0;i<temps.length;i++){
for(int j=i+1;j<temps.length;j++){
if(Integer.parseInt(temps[i])>Integer.parseInt(temps[j])){
String k;
k=temps[i];temps[i]=temps[j];temps[j]=k;
}
}
}
System.out.println("對(duì)產(chǎn)生的中獎(jiǎng)號(hào)碼順序排序?yàn)?");
for(int i=0;i<temps.length;i++){
System.out.print(temps[i]+" ");
}
System.out.println("\n");
}
//輸出結(jié)果類(lèi)別
private static void check(Map map ,int[] guess){
int flag=0;
for(int i=0;i<guess.length-1;i++){
if(map.containsValue(guess[i])){
flag++;
}
}
if(guess[guess.length-1]==special){
flag=flag+10;
}
switch(flag){
case 16: System.out.println("恭喜您中一等獎(jiǎng)");break;
case 15: System.out.println("恭喜您中二等獎(jiǎng)");break;
case 5: System.out.println("恭喜您中三等獎(jiǎng)");break;
case 14: System.out.println("恭喜您中四等獎(jiǎng)");break;
case 13: System.out.println("恭喜您中五等獎(jiǎng)");break;
case 4: System.out.println("恭喜您中五等獎(jiǎng)");break;
case 3: System.out.println("恭喜您中六等獎(jiǎng)");break;
default: System.out.println("謝謝參與,祝您下次中獎(jiǎng)");
}
}
//說(shuō)明
private static void usage(){
System.out.println("Usage:java Randomol program [the number you guess for the lucky nums.]");
System.out.println("\t And the nums. you must typed 7,else you will be cancel by the game rules");
System.out.println("\t The first 6 nums is your basic nums.,the last one is your special num.");
System.exit(0);
}
//主函數(shù)
public static void main(String []args){
if(args.length==0||args.length>7){
usage();
}//帶入?yún)?shù)
int[] guess=new int[7];
for(int i=0;i<args.length;i++){
guess[i]=Integer.parseInt(args[i]);
}
//判斷所輸入的號(hào)碼是否相同
List <Integer> ls= new ArrayList<Integer>();
for(int i=0;i<guess.length;i++){
if(ls.contains(guess[i])){
System.out.println("您所買(mǎi)的號(hào)碼不可以相同");
System.exit(0);
}else ls.add(guess[i]);
}
Nicky(guess);
System.exit(0);
}
}
| |||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
---|---|---|---|---|---|---|---|---|---|
24 | 25 | 26 | 27 | 28 | 29 | 30 | |||
1 | 2 | 3 | 4 | 5 | 6 | 7 | |||
8 | 9 | 10 | 11 | 12 | 13 | 14 | |||
15 | 16 | 17 | 18 | 19 | 20 | 21 | |||
22 | 23 | 24 | 25 | 26 | 27 | 28 | |||
29 | 30 | 31 | 1 | 2 | 3 | 4 |
常用鏈接
留言簿(10)
隨筆分類(lèi)(95)
- Data Structure && Algorithm (14)
- IBM Tech(8)
- No Category(11)
- Personal Comments(12)
- python(2)
- Simple Java(31)
- SUN Tech(17)
隨筆檔案(97)
- 2009年9月 (1)
- 2008年8月 (1)
- 2008年7月 (2)
- 2008年4月 (3)
- 2008年2月 (2)
- 2008年1月 (1)
- 2007年12月 (3)
- 2007年11月 (3)
- 2007年10月 (7)
- 2007年8月 (2)
- 2007年7月 (5)
- 2007年6月 (1)
- 2007年5月 (8)
- 2007年4月 (15)
- 2007年3月 (9)
- 2007年2月 (2)
- 2007年1月 (3)
- 2006年12月 (6)
- 2006年11月 (2)
- 2006年10月 (5)
- 2006年8月 (2)
- 2006年7月 (5)
- 2006年5月 (9)
文章檔案(10)
相冊(cè)
J2ME技術(shù)網(wǎng)站
java技術(shù)相關(guān)
mess
搜索
最新評(píng)論

- 1.?re: SWT JFACE .TreeViewer Expand事件及其節(jié)點(diǎn)處理方法[未登錄](méi)
-
@求助
非常感謝 解決了問(wèn)題 - --huhu
- 2.?re: The Fifth Discipline Peter M. Senge(彼得·圣潔)
-
@Scott
- --bc05002@gmail.com
- 3.?re: Java6 MUstang新特性總結(jié)(摘錄)
- Thanks for your sharing.I like it very much, thanks!
- --ed hardy
- 4.?re: F3(轉(zhuǎn)http://blogs.sun.com/chrisoliver/entry/f3)
- 評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
- --runescape gold
- 5.?re: ideas are just a multiplier of execution(copied)
- 評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
- --James07