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

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

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

    斷點

    每天進步一點點!
    posts - 174, comments - 56, trackbacks - 0, articles - 21

    1、(背景:以前在做系統查詢的時候,要顯示系統當天時間以及下一天,當前時間很容易寫出,可下一天不會寫,下面是自己試著寫的一個。)
    function tomorrow(){
         var date = new Date();
         var year = date.getYear(); //取得當前年份命令
         var month = date.getMonth() 1;
         var day = date.getDate();
         var dateStr=null;
         if(year%4==0 && year%100!=0 || year%400==0){ //為閏年
          if(month==1||month==3||month==5||month==7||month==8||month==10){
           if(day==31){
            month = month 1;
            if(month < 10){ month ='0' month ; }
            dateStr = year "-" month "-" "01" ;
           }else if(day!=31){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }else if(month==4||month==6||month==9||month==11){
           if(day==30){
            month=month 1;
            if(month < 10){ month ='0' month ; }
            dateStr = year "-" month "-" "01" ;
           }else if(day!=30){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }else if(month==12){
           if(day==31){month="01";dateStr = year 1 "-" month "-" "01" ;}
           else if(day!=31){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }else if(month==2){
           if(day==29){month="03";dateStr = year "-" month "-" "01" ;}
           else if(day!=29){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }
         }else { //非閏年
          if(month==1||month==3||month==5||month==7||month==8||month==10){
           if(day==31){
            month=month 1;
            if(month < 10){ month ='0' month ; }
            dateStr = year "-" month "-" "01" ;
           }else if(day!=31){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }else if(month==4||month==6||month==9||month==11){
           if(day==30){
            month=month 1;
            if(month < 10){ month ='0' month ; }
            dateStr = year "-" month "-" "01" ;
           }else if(day!=30){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }else if(month==12){
           if(day==31){month="01"; dateStr = year 1 "-" month "-" "01" ;}
           else if(day!=31){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }else if(month==2){
           if(day==28){month="03";dateStr = year "-" month "-" "01" ;}
           else if(day!=28){
            day = day 1;
            if(month < 10){ month ='0' month ; }
            if(day < 10){ day ='0' day ; }
            dateStr = year "-" month "-" day ;}
          }
           }
         alert(dateStr); //為了方便查看結果才加上去的
    }

    2、自己寫的特容易出錯,調用js自帶的函數,使產生的對象自加一,很好的控制了2008-10-32、undefined 、null的產生。
    function nextdate(){
    var date = new Date();
    var b = date.getDate();
    b += 1;
    date.setDate(b);
    var year = date.getYear(); //取得當前年份命令
    var month = date.getMonth()+1;
    var day = date.getDate();
    if(month < 10){ month ='0'+ month ; }
    if(day < 10){ day ='0'+ day ; }
    var dateStr = year+ "-"+ month+"-"+day ;
    alert(dateStr);


    posted @ 2009-05-09 17:24 斷點 閱讀(38) | 評論 (0)

    posted @ 2010-01-14 21:28 斷點 閱讀(536) | 評論 (0)編輯 收藏

    1、
    string=string.replace(/-/g, "/");
    替換字符串中的-為 /。
    g 為global,全文查找出現的所有 pattern ;如果沒有這個參數只替換第一個。

    2、
    Date.parse(dateVal)
    其中必選項 dateVal 是一個包含以諸如 "Jan 5, 1996 08:47:00" 的格式表示的日期的字符串,或者是一個從 ActiveX(R) 對象或其他對象中獲取的 VT_DATE 值。

    說明
    parse 方法返回一個整數值,這個整數表示 dateVal 中所包含的日期與 1970 年 1 月 1 日午夜之間相間隔的毫秒數。
    parse 方法是 Date 對象的一個靜態方法。正因為它是一個靜態方法,它是通過下面例子中所示的方法被調用的,而不是作為一個已創建 Date 對象的一個方法被調用。

     

    下面是個例子:
    var dateBgn = Date.parse(bgnStr.replace(/-/g, "/"));


    posted @ 2009-05-09 17:05 斷點 閱讀(13) | 評論 (0)

    posted @ 2010-01-14 21:26 斷點 閱讀(215) | 評論 (0)編輯 收藏

    parseInt 方法,返回由字符串轉換得到的整數。

    parseInt(numString, [radix])

    參數
    numString 必選項。要轉換為數字的字符串。
    radix 可選項。在 2 和 36 之間的表示 numString 所保存數字的進制的值。如果沒有提供,則前綴為 '0x' 的字符串被當作十六進制,前綴為 '0' 的字符串被當作八進制。所有其它字符串都被當作是十進制的。

    說明
    parseInt 方法返回與保存在 numString 中的數字值相等的整數。如果 numString 的前綴不能解釋為整數,則返回 NaN(而不是數字)。

    例子如下:
    var endDay = parseInt(endStr.substring(8,10),10);
     
    posted @ 2009-05-09 16:25 斷點 閱讀(33) | 評論 (0) 

    posted @ 2010-01-14 21:25 斷點 閱讀(242) | 評論 (0)編輯 收藏

    Microsoft Script Editor,這個程序是Microsoft Office 2003 里的一部分,如果安裝時選擇了Microsoft Office-->Office工具-->“HTML源文件編輯”的話,
    這個冬冬就安裝在:C:\Program Files\Microsoft Office\Office11\MSE7.exe

    Microsoft Script Editor是很好的js調試工具。使用:右鍵選擇瀏覽器的屬性,進入“高級”,把“禁用腳本調試(Internet Explorer)”和“禁用腳本調試(其他)”前的勾去掉,同時在要調試的js處加上debugger即可使用。

    posted @ 2008-12-17 17:48 斷點 閱讀(175) | 評論 (0)

    posted @ 2010-01-14 21:24 斷點 閱讀(914) | 評論 (0)編輯 收藏

    19:02:31,843 INFO  [ServerImpl] Starting JBoss (Microcontainer)...
    19:02:31,843 INFO  [ServerImpl] Release ID: JBoss [Morpheus] 5.0.0.GA (build: SVNTag=JBoss_5_0_0_GA

    date=200812041714)
    19:02:31,843 INFO  [ServerImpl] Bootstrap URL: null
    19:02:31,843 INFO  [ServerImpl] Home Dir: E:\jboss-5.0.0.GA
    19:02:31,843 INFO  [ServerImpl] Home URL: file:/E:/jboss-5.0.0.GA/
    19:02:31,843 INFO  [ServerImpl] Library URL: file:/E:/jboss-5.0.0.GA/lib/
    19:02:31,843 INFO  [ServerImpl] Patch URL: null
    19:02:31,843 INFO  [ServerImpl] Common Base URL: file:/E:/jboss-5.0.0.GA/common/
    19:02:31,843 INFO  [ServerImpl] Common Library URL: file:/E:/jboss-5.0.0.GA/common/lib/
    19:02:31,843 INFO  [ServerImpl] Server Name: JBoss
    19:02:31,843 INFO  [ServerImpl] Server Base Dir: E:\jboss-5.0.0.GA\server
    19:02:31,843 INFO  [ServerImpl] Server Base URL: file:/E:/jboss-5.0.0.GA/server/
    19:02:31,843 INFO  [ServerImpl] Server Config URL: file:/E:/jboss-5.0.0.GA/server/JBoss/conf/
    19:02:31,843 INFO  [ServerImpl] Server Home Dir: E:\jboss-5.0.0.GA\server\JBoss
    19:02:31,843 INFO  [ServerImpl] Server Home URL: file:/E:/jboss-5.0.0.GA/server/JBoss/
    19:02:31,843 INFO  [ServerImpl] Server Data Dir: E:\jboss-5.0.0.GA\server\JBoss\data
    19:02:31,843 INFO  [ServerImpl] Server Library URL: file:/E:/jboss-5.0.0.GA/server/JBoss/lib/
    19:02:31,843 INFO  [ServerImpl] Server Log Dir: E:\jboss-5.0.0.GA\server\JBoss\log
    19:02:31,859 INFO  [ServerImpl] Server Native Dir: E:\jboss-5.0.0.GA\server\JBoss\tmp\native
    19:02:31,859 INFO  [ServerImpl] Server Temp Dir: E:\jboss-5.0.0.GA\server\JBoss\tmp
    19:02:31,859 INFO  [ServerImpl] Server Temp Deploy Dir: E:\jboss-5.0.0.GA\server\JBoss\tmp\deploy
    19:02:34,468 INFO  [ServerImpl] Starting Microcontainer, bootstrapURL=file:/E:/jboss-

    5.0.0.GA/server/JBoss/conf/bootstrap.xml
    Failed to boot JBoss:
    java.lang.RuntimeException: Error unmarshalling file:/E:/jboss-5.0.0.GA/server/JBoss/conf/bootstrap.xml
     at org.jboss.bootstrap.xml.BootstrapParser.parse(BootstrapParser.java:60)
     at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:129)
     at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:394)
     at org.jboss.Main.boot(Main.java:209)
     at org.jboss.Main$1.run(Main.java:547)
     at java.lang.Thread.run(Thread.java:595)
    Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: file:/E:/jboss-

    5.0.0.GA/server/JBoss/conf/bootstrap.xml
     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:177)
     at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:119)
     at org.jboss.bootstrap.xml.BootstrapParser.parse(BootstrapParser.java:53)
     ... 5 more
    Caused by: java.io.FileNotFoundException: E:\jboss-5.0.0.GA\server\JBoss\conf\bootstrap.xml
     at org.jboss.net.protocol.file.FileURLConnection.connect(FileURLConnection.java:105)
     at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:112)
     at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
     at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
     at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
     at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
     at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:173)19:02:35,015 INFO 

    [ServerImpl] Runtime shutdown hook called, forceHalt: true

     ... 7 more
    19:02:35,078 INFO  [ServerImpl] Shutdown complete
    Shutdown complete
    Halting VM

     

    解決方法:在MyEclipse中的應用服務器中,選中JBoss,將其Server name配置改為default即可。



    posted @ 2009-11-28 17:06 斷點 閱讀(85) | 評論 (0)

    posted @ 2010-01-14 21:22 斷點 閱讀(791) | 評論 (0)編輯 收藏

    我在Jboss5.0下開發MessageDrivenBean時,遇到了一個小錯誤,提示如下:
    javax.naming.NameNotFoundException: QueueConnectionFactory not bound
     at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
     at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
     at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
     at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     
    產生這個錯誤,主要是因為在Jboss5.0下找不到QueueConnectionFactory。我登陸jboss5.0的
    http://localhost:8090/jmx-console/,在這個jboss/service=JNDIView/list/Global JNDI Namespace下查找,只有ConnectionFactory

    因此解決辦法有了,把發送消息的java類中的QueueConnectionFactory修改一下即可,如下:
    QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup
    ("QueueConnectionFactory");
    改為-->
    QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");

    OK,搞定!


    posted @ 2009-03-27 17:56 斷點 閱讀(618) | 評論 (3)

    posted @ 2010-01-14 21:21 斷點 閱讀(694) | 評論 (1)編輯 收藏

    昨天試了一下把mysql的數據源配置mysql-ds.xml放在jboss下面跑,成功了;后來我想那oracle數據源配置oracle-ds.xml也可以在jboss下面跑了。我就試了一下, 在啟動Eclipse時報以下錯誤:

    11:04:48,078 INFO  [SettingsFactory] JDBC driver: Oracle JDBC driver, version: 9.2.0.1.0
    11:04:48,125 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#ztf state=Create
    javax.persistence.PersistenceException: [PersistenceUnit: ztf] Unable to build EntityManagerFactory
     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
     at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
     at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:311)
    Caused by: org.hibernate.HibernateException: unknown Oracle major version [0]
     at org.hibernate.dialect.DialectFactory$1.getDialectClass(DialectFactory.java:173)
     at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:88)
     at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:62)
    11:04:48,265 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS

    FOR DETAILS):

    *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

    jboss.j2ee:jar=EntityBean.jar,name=PersonServiceBean,service=EJB3
     -> <UNKNOWN jboss.j2ee:jar=EntityBean.jar,name=PersonServiceBean,service=EJB3>{Described:** UNRESOLVED Demands

    'persistence.unit:unitName=#ztf' **}

    *** CONTEXTS IN ERROR: Name -> Error

    persistence.unit:unitName=#ztf -> org.hibernate.HibernateException: unknown Oracle major version [0]

    <UNKNOWN jboss.j2ee:jar=EntityBean.jar,name=PersonServiceBean,service=EJB3> -> ** UNRESOLVED Demands

    'persistence.unit:unitName=#ztf' **

    11:04:48,453 INFO  [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8090

    出現這個問題,接著在網上google了一下,在http://forum.hibernate.org/viewtopic.php?p=2373597下找到了答案。
    我出現的問題已解決,如下:
    1.persistence.xml下<jta-data-source>的數據源配置為java:/ztfDS。
    2.在persistence.xml下<properties>加入SQL方言<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>


    jboss下數據源的配置,分以下幾種情況:
    1.選擇的是mysql-ds.xml,此文件相應位置設為 <jndi-name>ztfDS</jndi-name>,那么在persistence.xml中相應設置為<jta-data-source>java:ztfDS</jta-data-source>。
    2.選擇的是oracle-ds.xml,此文件相應位置設為<jndi-name>ztfDS</jndi-name>,那么在persistence.xml中相應設置為<jta-data-source>java:/ztfDS</jta-data-source>。



    posted @ 2009-03-26 12:43 斷點 閱讀(1001) | 評論 (0)

    posted @ 2010-01-14 21:20 斷點 閱讀(1545) | 評論 (0)編輯 收藏

    eclipse中jboss啟動時提示:
    Server JBoss v5.0 at localhost was unable to start within 50 seconds. If the server
    requires more time, try increasing the timeout in the server editor.

     

    解決辦法:
    修改 workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml文件。
    <servers>

    <server hostname="localhost" id="JBoss v5.0 at localhost" name="JBoss v5.0 at
    localhost" runtime-id="JBoss v5.0" server-type="org.eclipse.jst.server.generic.jboss5"
    server-type-id="org.eclipse.jst.server.generic.jboss5" start-timeout="1000" stop-
    timeout="15" timestamp="0">
    <map jndiPort="1099" key="generic_server_instance_properties" port="8090"
    serverAddress="127.0.0.1" serverConfig="default"/>
    </server>
    </servers>
    把 start-timeout="50" 改為  start-timeout="1000"
    重啟eclipse就可以了。

    其它原因:
    我的是因為先前把端口號改為8090,而忽略其他地方的修改,這次我把
    C:\jboss-5.0.0.GA\server\default\deploy\jbossweb.sar里面下的server.xml下的相應處也改過
    來了即protocol="HTTP/1.1" port="8090"。重啟eclipse就可以了,否則Eclipse老在那里work building。


    posted @ 2009-03-20 12:36 斷點 閱讀(1329) | 評論 (5)

    posted @ 2010-01-14 21:18 斷點 閱讀(218) | 評論 (0)編輯 收藏

    數據源可以減少數據庫連接對象的創建數量,來提升系統運行性能。

    在C:\jboss-5.0.0.GA\docs\examples\jca下有各種數據源配置模板。

    數據源的文件命名包含-ds,如:mysql-ds.xml。

    以mysql為例:
    1.數據源參數的修改。
    可以在mysql-ds.xml里配置數據庫的可用連接數:
    <min-pool-size>0</min-pool-size>
    <max-pool-size>20</max-pool-size>

    2.數據源的部署。
    mysql的連接驅動文件mysql-connector-java-5.0.4-bin.jar拷貝到 jboss的C:\jboss-5.0.0.GA\server\default\lib中。

    3.數據源的發布。
    把mysql-ds.xml拷貝到C:\jboss-5.0.0.GA\server\default\deploy下,完成發布。
    此時在jboss的Console下顯示如下:
    Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=itDS' to JNDI name 'java:itDS'。

    注意:在jboss下,數據源可以動態的發布,所以我們修改完mysql-ds.xml里的參數并保存,jboss可以對它進行部署。


    posted @ 2009-03-26 10:01 斷點 閱讀(192) | 評論 (0)

    posted @ 2010-01-14 21:18 斷點 閱讀(232) | 評論 (0)編輯 收藏

    EJB3.0應用需要運行在JDK1.5以上版本。
    EJB3.0應用需要運行在EJB容器里,JavaEE應用服務器包含Web容器和EJB容器。

    EJB3.0應用需要以下版本的JavaEE應用服務器:
    Jboss(4.2.x以上版本)
    Weblogic(10以上版本)

    注意:Tomcat目前只是Web容器,它不能運行EJB應用。

    jboss的下載頁面為 http://www.jboss.org/jbossas/downloads/

    如果是JDK1.5版本,可選擇jboss-5.0.0.GA.zip
    如果是JDK6.0版本,可選擇jboss-5.0.0.GA-jdk6.zip

    下載后直接解壓縮文件即可完成安裝,點擊C:\jboss-5.0.0.GA\bin下的run.bat,啟動完成后在瀏覽器中輸入http://localhost:8080/即可以看見JBoss頁面。

    添加環境變量:
    1.在“系統變量”里添加JBOSS_HOME變量,值為Jboss的安裝路徑,
    如:JBOSS_HOME   C:\jboss-5.0.0.GA
    2.為了方便jboss的命令,需要把jboss的bin目錄添加到系統Path路徑里,
    : Path                ;%JBOSS_HOME%\bin


    posted @ 2009-03-19 10:38 斷點 閱讀(1693) | 評論 (0)

    posted @ 2010-01-14 21:17 斷點 閱讀(367) | 評論 (0)編輯 收藏

    僅列出標題
    共18頁: First 上一頁 10 11 12 13 14 15 16 17 18 下一頁 
    主站蜘蛛池模板: 亚洲精品视频免费看| 亚洲国产一成久久精品国产成人综合| 99久久国产热无码精品免费| 亚洲AV无码一区二区三区DV| 亚洲人配人种jizz| 我的小后妈韩剧在线看免费高清版| 久久亚洲AV成人无码| 亚洲w码欧洲s码免费| 日日噜噜噜噜夜夜爽亚洲精品| 国产大陆亚洲精品国产| 无码精品国产一区二区三区免费| 尤物永久免费AV无码网站| 亚洲人成网站免费播放| 久久精品无码专区免费东京热| 国产免费黄色大片| 亚洲欧洲日产国产最新| 青青操免费在线视频| 嫩草视频在线免费观看| 亚洲资源在线视频| av无码国产在线看免费网站| 国产亚洲玖玖玖在线观看| 91在线老王精品免费播放| 亚洲在成人网在线看| 日本高清免费网站| 一级毛片免费全部播放| 免费少妇a级毛片人成网| 国产黄在线观看免费观看不卡| 国产∨亚洲V天堂无码久久久| aaa毛片免费观看| 亚洲第一成年男人的天堂| a级毛片免费播放| 91天堂素人精品系列全集亚洲| 国语成本人片免费av无码| 人妻无码中文字幕免费视频蜜桃| 日本免费人成黄页网观看视频| 人人公开免费超级碰碰碰视频 | 亚洲日本成本人观看| 亚洲一区二区三区在线播放| 免费视频精品一区二区| 亚洲av片劲爆在线观看| 免费无遮挡无码视频网站|