<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 97,  comments - 93,  trackbacks - 0
     
    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.
    1 Attribute personAttribute=directory.getAttributes(personName).get("email");
    2 String email = (String)personAttribute.get();
    (Recently,finding that blogjava can help us format our code,that's perfect,but if can max the editor area which will enhance the function and coursely be better:).)
    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)
    1 Printer printer =(Printer)namespace.lookup(printerName);
    2 printer.print(document);

    posted @ 2007-04-08 15:10 wqwqwqwqwq 閱讀(470) | 評論 (0)編輯 收藏

    //*******************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,則將字節寫入文件末尾處,而不是寫入文件開始處
            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);
       }
    }

    posted @ 2007-04-05 10:01 wqwqwqwqwq 閱讀(872) | 評論 (1)編輯 收藏

    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);
       }
    }

    posted @ 2007-04-05 08:13 wqwqwqwqwq 閱讀(482) | 評論 (0)編輯 收藏
    These days I want to review some java classes and post them,cos i come to realize that i hava been coming to forget some of them, my god,Katrina,....:) it's really the sound,and u ? ...regarding MVC,cos be delayed, and may be will better.

    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.

    posted @ 2007-04-04 21:32 wqwqwqwqwq 閱讀(477) | 評論 (0)編輯 收藏
    U may come across model view controller desigh pattern.It was first introduced by  Trygve Reenskaug. More details,MVC can be broken down into three elements.
    <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.
    <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.
    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.

    ....Next,may be the two days after tomorrow ,I ll give a real example to explain this schema in details.......
    posted @ 2007-03-26 23:16 wqwqwqwqwq 閱讀(435) | 評論 (0)編輯 收藏
    這幾天忙忙亂亂的,也沒顧及這個blog,其實說句實話,自己也好幾天沒在研究技術的東西了,只是在看看IBM的一些個產品,哎~所以今天還是沒打算寫寫技術,只是來post自己這幾天的一些瑣瑣碎碎。還算高興的事情是自己的小隊伍獲得了國際數學建模競賽2等獎,雖然不是很理想,但自己還是滿足了,畢竟帶的娘子(當然是除了我了)隊伍實力不是很強,況且大過年的我原來的伙伴早飛回溫暖的南方了。其實我本身早厭倦了那種比賽,不過還是比較欣賞美國人的精明和對中國人明知故犯的無奈,也許吧,其實還是要慶祝一下自己的最后一次這種競賽...
    這周學校組織無償獻血,雖然我并不在乎學校不給什么所謂的補償,我也不會因為獻血怎么怎么的就有所目的,只是感覺這種行為還算是對社會作出了一點貢獻。最嶇奇的是導員居然不讓我獻血,當然他的勸告算能讓我接受,但是自己還是很固執的感覺,無奈的導員也只好應下了。哎~我這個人真是經不起別人的勸告發現,在好些個朋友的“嚇唬”下,終于作出了心虛的妥協...哎~,不過也算給我的母親一個很好的交代了。
    不說這些令人掃興的話題了,還有一件好事,就是跟我關系很鐵的一個老師有了21個月的小寶寶,其實他才告訴我的,還是在網上。不過早應該猜到了,因為這幾天就發現他“不誤正業”,整天不在辦公室,往家里一個勁的跑,不過在這里,雖然他不會知道,還是祝愿他博士論文順利通過吧,雙喜臨門...
    想早些休息了,Good night&& Good dream.
    posted @ 2007-03-22 23:18 wqwqwqwqwq 閱讀(443) | 評論 (0)編輯 收藏
    剛剛看看過魯豫有約的兩期節目,是采訪的年輕輕但身價過億的李想、高燃、戴志和茅侃侃。其實,我并不因為他們的年輕或是很有錢,而感到任何詫異,但自己卻很欣常他們各自所持有的信念和創業過程中對資金的運營勇氣,我真的不知道隨著他們事業的增長、社會的變更,他們還是否會是浪潮的寵兒、是否會和原來一樣,對待更多的運營資本同樣的保持清醒地頭腦,但我還是很祝福他們...

    看過之后,我的感觸很深,在這個社會上,或許是因為隨著一個人學歷的漸漸增長,他也會變得懶惰,因為他再也不會像社會地位很卑微的人一樣為生計擔心,我本也相信,人在骨子里是懶惰的。其實,我自己也曾想過,以后能找個比較大的外企工作,幾年之后一個月拿個幾W塊就ok了,然后就是一輩子平平淡淡的生活...:),或許我的思想還不夠先進吧。他們的經歷,也讓我重新思考,說句實話,其實他們并沒什么,只是在坎坷的社會中,為了自己的信念堅持了下來,并一直做到了現在。我想我也該在為別人打工的同時,定位自己的目標,并堅定的追求。高燃是我很佩服的一個人,完全是因為他的執著,無論是他考清華、追GirlFriend 還是去找投資人,最后到辦好公司。人的天賦很重要,但我還是更喜歡執著...
    posted @ 2007-03-18 23:32 wqwqwqwqwq 閱讀(634) | 評論 (2)編輯 收藏
    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.

     


     


    posted @ 2007-03-17 07:36 wqwqwqwqwq 閱讀(168) | 評論 (0)編輯 收藏
    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.
    posted @ 2007-03-16 12:19 wqwqwqwqwq 閱讀(466) | 評論 (0)編輯 收藏
    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.
       
    posted @ 2007-03-12 11:01 wqwqwqwqwq 閱讀(611) | 評論 (0)編輯 收藏
    僅列出標題
    共10頁: First 上一頁 2 3 4 5 6 7 8 9 10 下一頁 
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567




    常用鏈接

    留言簿(10)

    隨筆分類(95)

    隨筆檔案(97)

    文章檔案(10)

    相冊

    J2ME技術網站

    java技術相關

    mess

    搜索

    •  

    最新評論

    閱讀排行榜

    校園夢網網絡電話,中國最優秀的網絡電話
    主站蜘蛛池模板: 国产亚洲人成在线影院| 久久免费区一区二区三波多野| 国产一级淫片a视频免费观看| 尤物视频在线免费观看| 亚洲一区二区三区四区在线观看 | 三级网站在线免费观看| 久久久久久亚洲精品成人| 日韩成人免费视频播放| a级毛片免费完整视频| 亚洲熟女乱色一区二区三区 | 亚洲日韩国产精品乱-久| 国产啪亚洲国产精品无码| 蜜桃AV无码免费看永久| 特级毛片A级毛片100免费播放| 亚洲综合无码一区二区| 亚洲国产av一区二区三区| 蜜桃AV无码免费看永久| 黄 色一级 成 人网站免费| 亚洲人成网站色在线观看| 国产亚洲精品精华液| 免费永久国产在线视频| 99爱在线精品免费观看| 9久热精品免费观看视频| 亚洲欧美成人一区二区三区| 亚洲AV无码久久精品成人| 亚洲AV成人潮喷综合网| 97在线观看永久免费视频| 国产午夜精品理论片免费观看 | 激情无码亚洲一区二区三区| 亚洲一本综合久久| 精品国产香蕉伊思人在线在线亚洲一区二区 | 久久亚洲中文字幕无码| 亚洲视频一区在线观看| 亚洲欧美日韩中文字幕在线一区| 久久精品国产精品亚洲艾| 亚洲国产精品自产在线播放| 在线观看免费大黄网站| 亚洲综合色视频在线观看| 毛片免费视频在线观看| 污视频在线免费观看| a在线观看免费视频|