當幸福來敲門

          我就會牢牢抓住!
          隨筆 - 50, 文章 - 3, 評論 - 8, 引用 - 0
          數據加載中……

          2012年6月15日

          需求工程師的工作內容

          1.和業務部門 、客戶溝通(溝通是整個需求設計到開發使用為止);
          2.學習業務;
          3.有意識聽速求(客戶最急需的),也就是優先級問題;
          4.搜集需求,整合,提煉,完成分析;(考慮周全找關聯 找核心)
          5.編寫需求產品文檔(文字和圖列、流程圖等相結合)
          6.掌握相關工具;(比如visio/axure)
          7.文檔系統講解(講解對象:開發和測試)
          8.驗證開發完后的產品(驗證結束后再測試);
          9.用戶培訓(需求工程師主持);
          10.了解相關系統(了解整個業務面 而不是 內部的功能點);

          注意:數據表設計中盡量存可分析的信息代碼;

          posted @ 2014-03-05 15:23 wyx 閱讀(208) | 評論 (0)編輯 收藏

          面試題積累

          1. struts1和struts2的區別
          2. hibernate和ibatis的區別
          3. json和xml的區別
          4. ajax的原理
          5. ajax和iframe嵌套有什么區別
          6. gbk utf8 iso-8859-1都是多少字節
          7. extjs和jquery的區別
          8. js從前端如何解決跨域問題
          9. 單例模式的優點,工廠模式的原理
          10. spring的mvc模式
          11. jdk1.7新功能
          12. 為什么會出現亂碼

          posted @ 2014-03-04 15:35 wyx 閱讀(236) | 評論 (0)編輯 收藏

          Hibernate 查詢有關in的查詢

          http://www.iteye.com/problems/74892

          List<Integer> ids = new ArrayList<Integer>();
          ids.add(3);
          ids.add(4);
          ids.add(5);
          Query query=session.createQuery(from document where id in (:ids)); 
          query.setParameterList("ids", ids);
          query.list();

          posted @ 2013-11-18 17:42 wyx 閱讀(634) | 評論 (0)編輯 收藏

          用hibernate插入數據保證插入數據ID同步 ,插入之后返回對象

          public FDataReport addFDataReport(FDataReport datareport);//數據新錄入返回對象,對應的就會把ID也返回

          posted @ 2013-11-04 17:43 wyx 閱讀(259) | 評論 (0)編輯 收藏

          關于登錄界面 記住用戶名和密碼的一段代碼

          Cookie cookies[]=request.getCookies();
              Cookie stCookie=null;
              String password=null;
              String passwordvalue=null;
              String usernamevalue=null;
              String cookiename = null;
              String nameandpassword[]=new String[3];
              if (cookies != null) {
             for (int i = 0; i < cookies.length; i++) {
              stCookie = cookies[i];
              cookiename = stCookie.getName();
              if (cookiename!=null && cookiename.equalsIgnoreCase("db_password")) {
               passwordvalue = stCookie.getValue();
               password = passwordvalue;//.substring(8, passwordvalue.length()-3);
               nameandpassword[1] = password.trim();
              }
              if (cookiename!=null && cookiename.equalsIgnoreCase("db_username")) {
               usernamevalue = stCookie.getValue();
               nameandpassword[0] = usernamevalue.trim();
              }
              }
           }





          <body>
          <p>
                 <label for="LoginName">
                  用戶名 / 郵箱:
                 </label>
                 <input class="text" type="text" id="LoginName" name="LoginName"
                  value="<%=nameandpassword[0]==null?"":nameandpassword[0] %>" />
                </p>
                <p>
                 <label for="Password">
                  密碼:
                 </label>
                 <input class="text" type="password" value="<%=nameandpassword[1]==null?"":nameandpassword[1] %>" name="Password" id="Password" />
                </p>


          </body>

          posted @ 2013-11-01 15:08 wyx 閱讀(318) | 評論 (0)編輯 收藏

          form表單提交兩次原因

          昨天做用戶注冊,添加用戶時候總是提交兩次
          最后才找到原因 提交表單的按鈕就是設置成button的了 但是名稱是submitButton也不可以 所以修改下按鈕名稱就可以了?。?!
          ⊙﹏⊙b汗

          posted @ 2013-10-18 09:21 wyx 閱讀(431) | 評論 (0)編輯 收藏

          關于安全問題——用戶中心

          1.當用戶操作用戶中心的信息,編碼獲取用戶對象應該是通過該用戶登錄保存的session或者cookie獲得,
          而不是通過用戶ID獲得(否則當有人知道通過ID傳值,容易輕易修改掉其他用戶的信息)

          2.前臺下載也需要通過后臺處理 放置業內人士知道下載文件真實地址,獲得大量數據信息

          posted @ 2013-09-04 17:13 wyx 閱讀(213) | 評論 (0)編輯 收藏

          FCKeditor 取值

          《轉自http://blog.sina.com.cn/s/blog_5f66526e0100kf6b.html

          主要步驟:

          第一步:導入需要的js文件(根據實際情況修改相應路徑)
          <script src="js/jquery.js" type=text/javascript></script>   
          <script src="fckeditor/fckeditor.js" type="text/javascript"></script>
          第二步:初始化(根據實際情況修改相應路徑)   

          sBasePath    = '/duotunkf/fckeditor/' ;#編輯器所在文件夾;
          oFCKeditor    = new FCKeditor('content') ;
          oFCKeditor.BasePath = sBasePath ;
          oFCKeditor.Value = 'test' ;
          oFCKeditor.ToolbarSet = 'Basic' ;
          oFCKeditor.Create() ;

          其中content為頁面你所綁定的textArea的id或name

          第三步:取值

          var oEditor = FCKeditorAPI.GetInstance('content');  
          editorValue = oEditor.GetHTML();  
          第四步:賦值(更新的時候先把原有的值賦給textarea)

          var oEditor = FCKeditorAPI.GetInstance('content');  
          oEditor.SetHTML("value"); 

           

          下面是本人寫的一個賦值測試程序,供大家參考。源碼如下:

          <html>
           <head>

               <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                  <script src="js/jquery-1.3.2.min.js"></script>
                  <script src="fckeditor/fckeditor.js"></script>
                  <script>
                  $(document).ready(function(){
                    $("#test").click(function(){
              var oEditor = FCKeditorAPI.GetInstance('content');  
              oEditor.SetHTML($("#test option:selected" ).text());
              });
            });
                  </script>
           </head>
           <body>
            
            <form action="" method="post">
                  <script>
                      sBasePath    = '/duotunkf/fckeditor/' ;#編輯器所在文件夾;
                      oFCKeditor   = new FCKeditor('content') ;
                      oFCKeditor.BasePath = sBasePath ;
                      oFCKeditor.Value = 'test' ;
                      oFCKeditor.ToolbarSet = 'Basic' ;
                      oFCKeditor.Create() ;
            </script>
             <br>
                      <label for="test">
                <select name="test" size="4" id="test">
                  <option value="1">i.點擊這里改變編輯器的值</option>
                  <option value="2">ii.點擊這里改變編輯器的值</option>
                  <option value="3">iii.點擊這里改變編輯器的值</option>
                     </select>
                    </label>
            </form>
           </body>
          </html>


          posted @ 2013-07-31 14:19 wyx 閱讀(189) | 評論 (0)編輯 收藏

          關于數據表建設的int 和 number varchar和nvarchar的區別


          提交了,剛才修正了一些問題;一主鍵需要設置number類型同時告訴擴充到10
          管華(管華) 10:44:15
          你剛才是int類型,,int最大是到6萬多吧,,如果你設置這個,意味著到時你到6萬多的會員后,系統出問題,插入不進去了,到時你還得改;
          管華(管華) 10:45:46
          第二,你用的是字符VARCHAR2類型,這個;類型在oracle里不太好,會持久化占用一部分空間,比如你設置的VARCHAR2(1000),他不管你里面有沒有數據,都會占用這1000個字符的空間;因此需要改為NVARCHAR2 ,他是自適應,當你沒存儲值,他不占據空間


          另外根據有些字段,比如人名  name  NVARCHAR2(20)分配20個字符就可了,分配500個,會浪費多余的空間同時使得系統慢碎片多;因此根據實際情況,酌情分配

          posted @ 2013-07-12 10:49 wyx 閱讀(342) | 評論 (0)編輯 收藏

          sql語句特殊字符處理

          update tc_report t set xlsfile='ChinaLivestock'||chr(38)||'FeedWeeklyMarketReport20130703.doc' where t.xlsfile like 'China Livestock & Feed Weekly Market Report 20130703%'

          posted @ 2013-07-04 10:36 wyx 閱讀(275) | 評論 (0)編輯 收藏

          Tomcat修改文件重啟問題

          將tomcat下的bin\startup.bat下的文件打開后,最下面有一句話  call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%,,復制我這個替換你那個,保存后,即可實現不重啟就編譯java

          posted @ 2013-07-01 11:32 wyx 閱讀(181) | 評論 (0)編輯 收藏

          JavaBean中打印信息到JSP頁面

          http://blog.csdn.net/sclxf/article/details/4654080

          posted @ 2013-05-16 17:47 wyx 閱讀(169) | 評論 (0)編輯 收藏

          JS 獲得系統當前時間和未來一周時間

          例子:

          function getDate(day){
             var zdate=new Date();
             var sdate=zdate.getTime()-(1*24*60*60*1000);
             var edate=new Date(sdate-(day*24*60*60*1000)).format("yyyy-MM-dd");
             return edate;
          }

           function changevalue(obj){
                 alert(obj);
                 var a = getDate(+7);
                 var b = getDate(+31);
                 if(obj=="8"){
                 document.getElementById("enddate").value=b;
                 }else{
                 document.getElementById("enddate").value=a;
                 }
           }

          posted @ 2013-05-08 15:54 wyx 閱讀(386) | 評論 (0)編輯 收藏

          轉換PDF遇到的問題java.lang.UnsatisfiedLinkError: no jcom in java.library.path

          java.lang.UnsatisfiedLinkError: no jcom in java.library.path
          將 jcom.dll 文件放在  C:\WINDOWS\system32 和jdk的bin   目錄下

          posted @ 2013-04-10 16:14 wyx 閱讀(428) | 評論 (0)編輯 收藏

          BUG 調試 加入斷點但是跳轉時候沒有走

          設置問題  Debug model選中

          posted @ 2013-04-03 15:34 wyx 閱讀(206) | 評論 (0)編輯 收藏

          投研項目 文檔 總結

          1.下載模塊:年鑒、研究報告、企業榜單和行業數據(需要權限控制)
          2.FTP使用:

          posted @ 2013-03-27 11:09 wyx 閱讀(274) | 評論 (0)編輯 收藏

          2013-03-13 項目開發 總結 連載記錄

          1.針對不同類型跳轉不同的action方法 除了使用JS以外  還可以 使用參數獲得參數例如method=....不同值來跳轉像不同的方法
          例子:分國別 (method="showCountryList")  分地區(method="showAreaList")  
                  后臺 String method = request.getParameter("method");
                       request.setAttribute("method", method);
              if (method != null && method.equals("showCountryList")) {
               return showCountryList(map, form, request, response);//分國別
             } else if (method != null && method.equals("showAreaList")) {
               return showAreaList(map, form, request, response);//分地區
             }
          2.Jsp........記得使用IFram嵌套
          <iframe width="100%" height="800" class="share_self"  frameborder="0" scrolling="no" src="/tyreportAction.do?method=lookReportInfo&bid=${record.bid } "></iframe>
           總結:思維要活躍些  往往一個問題有很多種解決方法的

          posted @ 2013-03-13 09:38 wyx 閱讀(182) | 評論 (0)編輯 收藏

          大文本值CLOB取值 和 存值

          存值
           Clob  organdetail =Hibernate.createClob(request.getParameter("organdetail").equals("")?"":request.getParameter("organdetail").trim());// 機構簡介
             取值 顯示JSP
          <%=ToolsCommon.Clob2String(institutions.getOrgandetail())==null?"":ToolsCommon.Clob2String(institutions.getOrgandetail())%>


           public static String Clob2String(java.sql.Clob clob) {
            String s1 = "";
            char ac[] = new char[200];

            if (clob == null)
             return null;
            java.io.Reader reader = null;
            int i;
            try {
             reader = clob.getCharacterStream();
             while ((i = reader.read(ac, 0, 200)) != -1)
              s1 = s1 + new String(ac, 0, i);
            } catch (Exception exception1) {
             // throw new java.sql.SQLException(exception1.getMessage());
             System.out.println(exception1.toString());
            }

            finally {
             try {
              reader.close();
             } catch (Exception _ex) {
             }
            }
            return s1;

           }

          posted @ 2013-02-28 10:20 wyx 閱讀(365) | 評論 (0)編輯 收藏

          Java 刪除文件夾 和 文件 集合

          《此文拷貝自http://kxjhlele.iteye.com/blog/323657

          1,驗證傳入路徑是否為正確的路徑名(Windows系統,其他系統未使用)


          // 驗證字符串是否為正確路徑名的正則表達式
          private static String matches = "[A-Za-z]:\\\\[^:?\"><*]*";
          // 通過 sPath.matches(matches) 方法的返回值判斷是否正確
          // sPath 為路徑字符串

          2,通用的文件夾或文件刪除方法,直接調用此方法,即可實現刪除文件夾或文件,包括文件夾下的所有文件


              /**
               *  根據路徑刪除指定的目錄或文件,無論存在與否
               *@param sPath  要刪除的目錄或文件
               *@return 刪除成功返回 true,否則返回 false。
               */
              public boolean DeleteFolder(String sPath) {
                  flag = false;
                  file = new File(sPath);
                  // 判斷目錄或文件是否存在
                  if (!file.exists()) {  // 不存在返回 false
                      return flag;
                  } else {
                      // 判斷是否為文件
                      if (file.isFile()) {  // 為文件時調用刪除文件方法
                          return deleteFile(sPath);
                      } else {  // 為目錄時調用刪除目錄方法
                          return deleteDirectory(sPath);
                      }
                  }
              }

          3,實現刪除文件的方法,

              /**
               * 刪除單個文件
               * @param   sPath    被刪除文件的文件名
               * @return 單個文件刪除成功返回true,否則返回false
               */
              public boolean deleteFile(String sPath) {
                  flag = false;
                  file = new File(sPath);
                  // 路徑為文件且不為空則進行刪除
                  if (file.isFile() && file.exists()) {
                      file.delete();
                      flag = true;
                  }
                  return flag;
              }

          4,實現刪除文件夾的方法,

              /**
               * 刪除目錄(文件夾)以及目錄下的文件
               * @param   sPath 被刪除目錄的文件路徑
               * @return  目錄刪除成功返回true,否則返回false
               */
              public boolean deleteDirectory(String sPath) {
                  //如果sPath不以文件分隔符結尾,自動添加文件分隔符
                  if (!sPath.endsWith(File.separator)) {
                      sPath = sPath + File.separator;
                  }
                  File dirFile = new File(sPath);
                  //如果dir對應的文件不存在,或者不是一個目錄,則退出
                  if (!dirFile.exists() || !dirFile.isDirectory()) {
                      return false;
                  }
                  flag = true;
                  //刪除文件夾下的所有文件(包括子目錄)
                  File[] files = dirFile.listFiles();
                  for (int i = 0; i < files.length; i++) {
                      //刪除子文件
                      if (files[i].isFile()) {
                          flag = deleteFile(files[i].getAbsolutePath());
                          if (!flag) break;
                      } //刪除子目錄
                      else {
                          flag = deleteDirectory(files[i].getAbsolutePath());
                          if (!flag) break;
                      }
                  }
                  if (!flag) return false;
                  //刪除當前目錄
                  if (dirFile.delete()) {
                      return true;
                  } else {
                      return false;
                  }
              }

          5,main() 方法


              public static void main(String[] args) {

                  HandleFileClass hfc = new HandleFileClass();
                  String path = "D:\\Abc\\123\\Ab1";
                  boolean result = hfc.CreateFolder(path);
                  System.out.println(result);
                  path = "D:\\Abc\\124";
                  result = hfc.DeleteFolder(path);
                  System.out.println(result);

              }


          main() 方法只是做了一個簡單的測試,建立文件夾和文件都是本地建立,情況考慮的應該很全面了,包括文件夾包含文件夾、文件。文件的不同情況…………

           

          實現沒有問題,可以正確刪除文件夾和文件。

           

          對于其他類型文件的操作繼續學習…………




          posted @ 2013-01-18 15:58 wyx 閱讀(304) | 評論 (0)編輯 收藏

          JFreechar

          http://www.aygfsteel.com/amigoxie/archive/2007/09/30/149765.html

          posted @ 2012-12-26 15:51 wyx 閱讀(194) | 評論 (0)編輯 收藏

          orcle修改屬性字段 并且保留原有值

          1.原字段類型是字符串 使用“||”連接
          update table1 set num = substr(num,0,instr(num,'-'))||(substr(num,instr(num,'-')+1) +9) 
          2.原字段是數字 使用+連接
          UPDATE table1SET num = num+10 
          3.截取 update tc_report t set xlsfile=substr(xlsfile,6) where xlsfile like '%uku\%'

          posted @ 2012-11-12 10:20 wyx 閱讀(337) | 評論 (0)編輯 收藏

          form表單 修改 多選框默認選中

          1.放到HashMap中
            String varsort=exp.getVarsort();
             String vars[]=null;
             HashSet setvar = new HashSet();
             if(varsort!=null&&!varsort.trim().equals("")){
              vars=varsort.substring(0,varsort.length()-1).split(",");
              for(int i=0;i<vars.length;i++){
               setvar.add(vars[i].trim());
              }
             }
          2. contains比較是否包含
          <% if(varsorts!=null&&varsorts.size()>0){
                     for(int j=0;j<varsorts.size();j++){
                      TDictionarys td=varsorts.get(j);
                      %>
                   <input type="checkbox" value="<%=td.getDataid() %>" <%if(setvar.contains(String.valueOf(td.getDataid()).trim())){out.print("checked");} %> onclick="getBreeds()" name="varsort" id="varsort" />
                   <label for="checkbox" class="font12">
                   <%=td.getName() %>
                      </label>
                      <%
                     }
                    }
                   %>
                  

          posted @ 2012-09-21 18:03 wyx 閱讀(1330) | 評論 (1)編輯 收藏

          頁面級緩存處理

          前提  列表走了數據庫查詢
          1.引入架包  <%@ taglib uri="oscache" prefix="cache"%>
          2.包含要緩存的部分
          <cache:cache key="dbnewscache" time="3600">  
                  <%List<Article> list=new CmsByMysql().getNews(); %>
                    <c:forEach var="cu" items="<%=list%>">
                         <li>
                    <a href="${cu.url}">${cu.titleContent} </a>
                      </li>
                    </c:forEach>
          </cache:cache>

          posted @ 2012-09-21 17:25 wyx 閱讀(229) | 評論 (0)編輯 收藏

          Ifram 父子頁面 JS調用

          <iframe marginwidth="0" framespacing="0" marginheight="0" frameborder="0"
          name="uploadframe" id="uploadframe" src="c.html" scrolling="no" width="100" height="100" ></iframe>
          如想在c.html 中寫一些代碼去改變parent.html 中的一些內容,以下代碼可作為參考:

          1、parent.window.frames 可返回parent.html 中所有的iframe;返回結果應該是一個數組,用parent.window.frames[iframeId]可得到iframeId;

          2、用parent.document.getElementById('xxxx')可得到父里的xxxx,并改變相應的值,例如:parent.document.getElementById('xxxx').className = 'test';

          3、如果我想在父中再創建一個元素,直接用parent.appendChild(yyyy)在firefox中是可以的,但在IE(最起碼IE6)是不行的; 所以,要把創建這個動作放在父中來完成,在子中調用;

           parent.document.getElementById("pinming").innerHTML = retText2;

          posted @ 2012-07-24 15:29 wyx 閱讀(717) | 評論 (0)編輯 收藏

          jquery目錄樹 js實現 目錄數插件

          2011-07-13 10:07

          jQuery 目錄樹插件介紹——ligerTree

           

           

          一,簡介 

          ligerTree的功能列表:

          1,支持本地數據和服務器數據(配置data或者url)

          2,支持原生html生成Tree

          3,支持動態獲取增加/修改/刪除節點

          4,支持大部分常見的事件

          5,支持獲取選中行等常見的接口方法

           

          二,第一個例子

          引入庫文件

          遵循LigerUI系列插件的設計原則(插件盡量單獨),ligerTree是一個單獨的插件,也就是說只需要引入plugins/ligerTree.js和樣式css文件就可以使用(當然必須先引入jQuery),在這個例子中,我把tree用到的樣式和圖片分離了出來,有興趣的朋友可以下載來看看

            

          <script src="lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
          <link href="lib/ligerUI/skins/Aqua/css/ligerui-tree.css" rel="stylesheet" type="text/css"/>
          <script src="lib/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>

          加入HTML

            

          <ul id="tree1">
          <li>
          <span>節點1</span>
          <ul>
          <li>
          <span>節點1.1</span>
          <ul>
          <li><span>節點1.1.1</span></li>
          <li><span>節點1.1.2</span></li>
          </ul>
          </li>
          <li><span>節點1.2</span></li>
          </ul>
          </li>
          </ul>

          調用ligerTree

          <table style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-style: initial !important; border-color: initial !important; outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 1em !important; min-height: inherit !important; border-collapse: collapse !important; background-position: initial initial !important; background-repeat: initial initial !important; "><td style="font-size: 1em !important; margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0.5em !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: initial !important; border-style: initial !important; border-color: initial !important; outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: top !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; min-height: inherit !important; border-left-style: none !important; border-left-color: initial !important; color: rgb(0, 0, 0) !important; background-position: initial initial !important; background-repeat: initial initial !important; ">$("#tree1").ligerTree();

          效果圖

          三,常用場景

          場景一:不使用復選框: 

          $("#tree2").ligerTree({ checkbox: false });

          場景二:不使用復習框和圖標: 

          $("#tree3").ligerTree({ checkbox: false, parentIcon: null, childIcon: null });

          效果如圖:

          ?

          append(parentNode, newdata)增加節點集合clear()清空collapseAll()全部節點都折疊demotion(treenode)降級為葉節點級別expandAll()全部節點都展開getChecked()獲取選擇的行(復選框)getData()獲取樹的數據源getParentTreeItem(treenode, level)獲取父節點getSelected()獲取選擇的行hasChildren(treenode)是否包含子節點 loadData(node, url, param)加載數據remove(node)刪除節點upgrade(treenode)升級為父節點級別

          posted @ 2012-07-04 16:59 wyx 閱讀(2100) | 評論 (1)編輯 收藏

          讀取 文本 文件內容 FileInputStream 亂碼處理

            StringBuffer content = new StringBuffer();
          //  FileInputStream fis = null;
          //  byte[] b = new byte[2048];
          //  try {
          //    if(lang!=null&&lang.trim().equals("10")){
          //     fis = new FileInputStream(passwordTemplatePath);
          //     }else if(lang!=null&&lang.trim().equals("20")){
          //      fis = new FileInputStream(passwordTemplateEnPath);
          //     }else if(lang!=null&&lang.trim().equals("30")){
          //      fis = new FileInputStream(passwordTemplateChinaEnPath);
          //     }
          //     int m = 0;
          //   while ((m = fis.read(b)) != -1) {
          //    content.append(new String(b, 0, m));
          //   }
          //passwordTemplatePath 文本 文件地址
            BufferedReader br = null;
            try {
              if(lang!=null&&lang.trim().equals("10")){
                   br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplatePath), "utf-8"));
                }else if(lang!=null&&lang.trim().equals("20")){
                 br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplateEnPath), "utf-8"));
               }else if(lang!=null&&lang.trim().equals("30")){
                  br =  new BufferedReader(new InputStreamReader(new FileInputStream(passwordTemplateChinaEnPath), "utf-8"));
                }
              String s = null;
              while ((s = br.readLine()) != null) {
              content.append(s);
             }
            } catch (Exception e) {
             e.printStackTrace();
            } finally {
             try {
              br.close();
             } catch (IOException e) {
              e.printStackTrace();
             }
            }

          posted @ 2012-06-26 17:15 wyx 閱讀(2123) | 評論 (2)編輯 收藏

          線程等待問題處理

          class MyThread implements Runnable {
          @Override
          public void run() {
            System.out.println("1、進入run()方法休眠");
            try {
             System.out.println("2、線程休眠20秒");
             Thread.sleep(20000);//這里休眠20秒
             System.out.println("3、線程正常休眠完畢");
            } catch (InterruptedException e) {
             System.out.println("4、線程發生異常休眠被中斷");
             return;//返回方法調用處
            }
            System.out.println("5、線程正常結束run()方法體");
          }
          }
          public class InterruptDemo {

          public static void main(String[] args) {
            MyThread mt = new MyThread();
            Thread t = new Thread(mt,"線程A");
            t.start();//啟動線程
          //========================================================
            try {
             Thread.sleep(2000);  //保證線程至少執行2秒
            } catch (InterruptedException e) {
             e.printStackTrace();
            }
          //========================================================
            t.interrupt();//中斷線程
          }
          }

          posted @ 2012-06-21 15:21 wyx 閱讀(207) | 評論 (0)編輯 收藏

          "Mon Dec 28 00:00:00 CST 2008"的格式字符串轉換 yyyy-MM-dd 格式

          public static void main(String[] args)
           {
             try {
                java.util.Date date;
                // 首先設置"Mon Dec 28 00:00:00 CST 2008"的格式,用來將其轉化為Date對象
                DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US);

                //將已有的時間字符串轉化為Date對象
                date = df.parse("Tue Jun 19 00:00:00 CST 2012");// 那天是周一
                // 創建所需的格式
                df = new SimpleDateFormat("yyyy-MM-dd");
                String str = df.format(date);// 獲得格式化后的日期字符串
                System.err.println(str);// 打印最終結果
               } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
               }


           }

          posted @ 2012-06-19 16:12 wyx 閱讀(6996) | 評論 (1)編輯 收藏

          JAVA開發者最常去的25個英文網站 (轉載http://handawei.iteye.com/blog/675034)

        1. http://www.infoq.com/ - Info IT新聞
        2. http://www.apache.org/ - Apache基金會
        3. http://www.springsource.org/ - 廣大Java開發者喜愛的Spring
        4. http://www.hibernate.org/ - 開源ORM框架
        5. http://sourceforge.net/ - 開源技術的集結地
        6. http://www.javaalmanac.com – Java開發者年鑒一書的在線版本. 要想快速查到某種Java技巧的用法及示例代碼, 這是一個不錯的去處.
        7. http://www.onjava.com – O’Reilly的Java網站. 每周都有新文章.
        8. http://java.sun.com – 官方的Java開發者網站 – 每周都有新文章發表.
        9. http://www.developer.com/java – 由Gamelan.com 維護的Java技術文章網站.
        10. http://www.java.net – Sun公司維護的一個Java社區網站.
        11. http://www.builder.com – Cnet的Builder.com網站 – 所有的技術文章, 以Java為主.
        12. http://www.ibm.com/developerworks/java – IBM的Developerworks技術網站; 這是其中的Java技術主頁.
        13. http://www.javaworld.com – 最早的一個Java站點. 每周更新Java技術文章.
        14. http://www.devx.com/java – DevX維護的一個Java技術文章網站.
        15. http://www.fawcette.com/javapro – JavaPro在線雜志網站.
        16. http://www.sys-con.com/java – Java Developers Journal的在線雜志網站.
        17. http://www.javadesktop.org – 位于Java.net的一個Java桌面技術社區網站.
        18. http://www.theserverside.com – 這是一個討論所有Java服務器端技術的網站.
        19. http://www.jars.com – 提供Java評論服務. 包括各種framework和應用程序.
        20. http://www.jguru.com – 一個非常棒的采用Q&A形式的Java技術資源社區.
        21. http://www.javaranch.com – 一個論壇,得到Java問題答案的地方,初學者的好去處。
        22. http://www.ibiblio.org/javafaq/javafaq.html – comp.lang.java的FAQ站點 – 收集了來自comp.lang.java新聞組的問題和答案的分類目錄.
        23. http://java.sun.com/docs/books/tutorial/ – 來自SUN公司的官方Java指南 – 對于了解幾乎所有的java技術特性非常有幫助.
        24. http://www.javablogs.com – 互聯網上最活躍的一個Java Blog網站.
        25. http://java.about.com/ – 來自About.com的Java新聞和技術文章網站.
        26. posted @ 2012-06-15 15:44 wyx 閱讀(207) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 玉田县| 新乡市| 东丽区| 大竹县| 乌拉特后旗| 开鲁县| 漳平市| 普格县| 金昌市| 彩票| 定襄县| 海南省| 邛崃市| 英超| 民和| 遂平县| 蒙阴县| 松滋市| 邻水| 沭阳县| 孝义市| 天气| 晴隆县| 金乡县| 吉林省| 阜康市| 武冈市| 永济市| 聊城市| 秦皇岛市| 栾城县| 潍坊市| 叶城县| 五寨县| 鹿邑县| 双流县| 博乐市| 陕西省| 兴安盟| 永清县| 建德市|