隨筆-204  評(píng)論-90  文章-8  trackbacks-0
           
          ??????? 隨著春節(jié)的結(jié)束,新的一年就這樣在一身的疲憊中開(kāi)始了,回想過(guò)去的一年,我對(duì)軟件開(kāi)發(fā)這個(gè)行業(yè)有所理解,對(duì)我技術(shù)的成長(zhǎng)還算滿意,對(duì)待遇也算滿意,唯一不滿意的是我感覺(jué)在過(guò)去的一年我墮落了。回到租住的屋里從來(lái)不看書(shū),也不開(kāi)電腦,就是看電視,無(wú)聊的不行就做個(gè)飯,感覺(jué)是在吃老本啊!在這新的一年里有很多打算,報(bào)個(gè)英語(yǔ)班,學(xué)習(xí)日常用語(yǔ),在自己的技術(shù)方面再有所提高,就好了,奢望不多,但愿都能做好!
          posted @ 2007-02-26 10:54 一凡 閱讀(314) | 評(píng)論 (0)編輯 收藏
          方法一:Oracle的死鎖非常令人頭疼,總結(jié)了一些點(diǎn)滴經(jīng)驗(yàn)作為學(xué)習(xí)筆記

          1.查哪個(gè)過(guò)程被鎖
          查V$DB_OBJECT_CACHE視圖:

          SELECT?*?FROM?V$DB_OBJECT_CACHE?WHERE?OWNER='過(guò)程的所屬用戶'?AND?LOCKS!='0';

          2. 查是哪一個(gè)SID,通過(guò)SID可知道是哪個(gè)SESSION.
          查V$ACCESS視圖:

          SELECT?*?FROM?V$ACCESS?WHERE?OWNER='過(guò)程的所屬用戶'?AND?NAME='剛才查到的過(guò)程名';

          3. 查出SID和SERIAL#
          查V$SESSION視圖:

          SELECT?SID,SERIAL#,PADDR?FROM?V$SESSION?WHERE?SID='剛才查到的SID'

          查V$PROCESS視圖:

          SELECT?SPID?FROM?V$PROCESS?WHERE?ADDR='剛才查到的PADDR';

          4. 殺進(jìn)程
          (1).先殺ORACLE進(jìn)程:

          ALTER?SYSTEM?KILL?SESSION?'查出的SID,查出的SERIAL#';

          (2).再殺操作系統(tǒng)進(jìn)程:

          KILL?-9?剛才查出的SPID

          ORAKILL?剛才查出的SID?剛才查出的SPID
          方法二:
          經(jīng)常在oracle的使用過(guò)程中碰到這個(gè)問(wèn)題,所以也總結(jié)了一點(diǎn)解決方法:)
          1)查找死鎖的進(jìn)程:
          sqlplus?"
          /as?sysdba"
          SELECT?s.username,l.OBJECT_ID,l.SESSION_ID,s.SERIAL#,l.ORACLE_USERNAME,l.OS_USER_NAME,l.PROCESS?FROM?V$LOCKED_OBJECT?l,V$SESSION?S?WHERE?l.SESSION_ID=S.SID;?
          2)kill掉這個(gè)死鎖的進(jìn)程:
          alter?system?kill?session?‘sid,serial#’;??(其中sid=l.session_id)
          3)如果還不能解決,
          select?pro.spid?from?v$session?ses,v$process?pro?where?ses.sid=XX?and?ses.paddr=pro.addr;??
          ?其中sid用死鎖的sid替換。
          exit
          ps?
          -ef|grep?spid
          其中spid是這個(gè)進(jìn)程的進(jìn)程號(hào),kill掉這個(gè)Oracle進(jìn)程。?
          posted @ 2007-02-02 14:06 一凡 閱讀(5064) | 評(píng)論 (0)編輯 收藏

          首先對(duì)SimpleDateFormat有所了解,以下摘自java-doc中

          Letter??Date?or?Time?Component??Presentation??Examples??
          G??Era?designator??Text??AD??
          y??Year??Year??
          1996 ;? 96 ??
          M??Month?in?year??Month??July;?Jul;?
          07 ??
          w??Week?in?year??Number??
          27 ??
          W??Week?in?month??Number??
          2 ??
          D??Day?in?year??Number??
          189 ??
          d??Day?in?month??Number??
          10 ??
          F??Day?of?week?in?month??Number??
          2 ??
          E??Day?in?week??Text??Tuesday;?Tue??
          a??Am
          / pm?marker??Text??PM??
          H??Hour?in?day?(
          0 - 23 )??Number?? 0 ??
          k??Hour?in?day?(
          1 - 24 )??Number?? 24 ??
          K??Hour?in?am
          / pm?( 0 - 11 )??Number?? 0 ??
          h??Hour?in?am
          / pm?( 1 - 12 )??Number?? 12 ??
          m??Minute?in?hour??Number??
          30 ??
          s??Second?in?minute??Number??
          55 ??
          S??Millisecond??Number??
          978 ??
          z??Time?zone??General?time?zone??Pacific?Standard?Time;?PST;?GMT
          - 08 : 00 ??
          Z??Time?zone??RFC?
          822 ?time?zone?? - 0800 ??


          對(duì)中國(guó)人來(lái)說(shuō),普遍使用的是"yyyy-MM-dd"。

          貼出代碼:

          import ?java.util. * ;
          import ?java.text. * ;
          public ? class ?weekDay?
          {
          ?
          public ? static ? void ?main(String[]?args)?
          ?
          {
          ??
          // ?----------------------
          ??
          // 實(shí)現(xiàn)給定某日期,判斷是星期幾。
          ??
          // ------------------------
          ??SimpleDateFormat?formatYMD? = ? new ?SimpleDateFormat( " yyyy-MM-dd " );
          ??
          // formatYMD表示的是yyyy-MM-dd格式
          ??SimpleDateFormat?formatD? = ? new ?SimpleDateFormat( " E " );
          ??
          // "E"表示"day?in?week"
          ??Date?d? = ? null ;
          ??
          try
          ??
          {
          ???d?
          = ?formatYMD.parse( " 2005-11-8 " );
          ???
          // 將String?轉(zhuǎn)換為符合格式的日期
          ??}

          ??
          catch (Exception?e)
          ??
          {
          ???e.printStackTrace();
          ??}

          ??System.out.println(formatD.format(d));
          ??
          // 將日期中的day?of?week打印
          ??
          ??
          ??
          ??
          // ---------------------------
          ??
          // 測(cè)試一下一些想法,跟主題無(wú)關(guān)
          ??
          // Date在java.util中Date類
          ??
          // 原來(lái)java中1月用0代表,弄的測(cè)了半天
          ??
          // ---------------------------
          ??Date?testDate? = ? new ?Date();
          ??SimpleDateFormat?format1?
          = ? new ?SimpleDateFormat( " yyyy-MM-dd " );
          ??System.out.println(testDate);
          ??System.out.println(format1.format(testDate));
          ??System.out.println(testDate.getMonth());
          ??
          ??Calendar?cal?
          = ?Calendar.getInstance();
          ??cal.get(Calendar.MONTH);
          ??
          ?}


          }



          posted @ 2007-01-23 15:15 一凡 閱讀(2734) | 評(píng)論 (0)編輯 收藏
          請(qǐng)注意execute immediate strSql;
          create?or?replace?procedure?proc_myproc?as


          strSql?
          varchar(200);

          begin

          for?c_colName?in(select?t.column_name?
          ?????????????????
          from?user_tab_cols?t?
          ?????????????????
          where?t.table_name='TAB_TEST'?
          ?????????????????
          and?t.data_type?=?'NUMBER'
          )
          ??loop
          ????dbms_output.put_line(c_colName.Column_Name);
          ????strSql?:
          =?'update?tab_test?set?'?||?c_colName.Column_Name?||?'?=?0';
          ????dbms_output.put_line(strSql);
          ????
          ????
          execute?immediate?strSql;??
          ????
          commit;
          ??
          end?loop;
          ??dbms_output.put_line(
          'OK..');
          end;
          posted @ 2007-01-23 11:05 一凡 閱讀(623) | 評(píng)論 (0)編輯 收藏

          在彈出窗口中獲得或設(shè)置主窗口的任何值:
          打開(kāi)彈出窗口時(shí)用:showModalDialog(url, window, feathers)
          在彈出窗口中使用 window.dialogArguments 對(duì)象(即主窗口傳遞過(guò)來(lái)的 window 對(duì)象集),即可以獲得或者設(shè)置主窗口的值。

          具體實(shí)例:

          window.showModalDialog('areaAdd.jsp",window,'dialogWidth:245px;dialogHeight:210px;status:no;help:no;scroll:no;');

          其中window參數(shù)如果是需要頁(yè)面間傳值就必須要,否則可為空。父子頁(yè)面之間通訊也需要該參數(shù)。主頁(yè)面的iframe名稱為areaIframe,子頁(yè)面名稱為areaAdd,父頁(yè)面通知子頁(yè)面刷新用:areasIframe.location.href='areaIframe.jsp'。子頁(yè)面通知父頁(yè)面刷新使用:window.dialogArguments.areasIframe.areasReload();其中areasReload()是子頁(yè)面中的javascript方法

          注意 iframe 的屬性必須使用前綴 document.all 訪問(wèn),例如 document.all.iframeId.marginWidth。

          posted @ 2007-01-17 15:37 一凡 閱讀(1683) | 評(píng)論 (1)編輯 收藏
          摘自springside論壇

          一、
          經(jīng)過(guò)N多試驗(yàn),終于自己把這個(gè)問(wèn)題搞定了。

          網(wǎng)上關(guān)于C3P0在spring中的配置,幾乎沒(méi)有完全正確的(至少我還沒(méi)發(fā)現(xiàn))。查了c3p0的文檔,又試驗(yàn)過(guò)N次。得出如下配置是正確的:


          <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"? ?destroy-method="close">
          ? ?? ?? ?<property name="driverClass"><value>${jdbc.driverClassName}</value></property>
          ? ?? ?? ?<property name="jdbcUrl"><value>${jdbc.url}</value></property>? ?? ?? ?? ?? ?
          ? ?? ?? ?<property name="user"><value>${jdbc.username}</value></property>
          ? ?? ?? ?<property name="password"><value>${jdbc.password}</value></property>
          ? ?? ?? ?
          ? ?? ?? ?<property name="minPoolSize"><value>1</value></property>
          ? ?? ?? ?<property name="maxPoolSize"><value>20</value></property>
          ? ?? ?? ?<property name="maxIdleTime"><value>1800</value></property>
          ? ?? ?? ?<property name="acquireIncrement"><value>2</value></property>
          ? ?? ?? ?<property name="maxStatements"><value>0</value></property>
          ? ?? ?? ?<property name="initialPoolSize"><value>2</value></property>
          ? ?? ?? ?<property name="idleConnectionTestPeriod"><value>1800</value></property>
          ? ?? ?? ?<property name="acquireRetryAttempts"><value>30</value></property>
          ? ?? ?? ?<property name="breakAfterAcquireFailure"><value>true</value></property>
          ? ?? ?? ?<property name="testConnectionOnCheckout"><value>false</value></property>
          ? ?? ?? ?
          ? ?? ?? ?<!--
          ? ?? ?? ?? ?<property name="properties">
          ? ?? ?? ? <props>? ?? ?? ?? ???
          ? ?? ?? ?? ???<prop key="c3p0.minPoolSize">1</prop>
          ? ?? ?? ?? ???<prop key="c3p0.maxPoolSize">10</prop>
          ? ?? ?? ?? ???<prop key="c3p0.maxIdleTime">1800</prop>? ?? ?? ?? ???
          ? ?? ?? ?? ???<prop key="c3p0.acquireIncrement">2</prop>
          ? ?? ?? ?? ???<prop key="c3p0.maxStatements">0</prop>
          ? ?? ?? ?? ?? ?? ???<prop key="c3p0.initialPoolSize">2</prop>
          ? ?? ?? ?? ???<prop key="c3p0.idleConnectionTestPeriod">1800</prop>
          ? ?? ?? ?? ???<prop key="c3p0.acquireRetryAttempts">30</prop>
          ? ?? ?? ?? ???<prop key="c3p0.breakAfterAcquireFailure">true</prop>
          ? ?? ?? ?? ???<prop key="c3p0.testConnectionOnCheckout">true</prop>
          ? ?? ?? ?? ???<prop key="user">root</prop>
          ? ?? ?? ?? ???<prop key="password">999999</prop>
          ? ?? ?? ?? ???
          ? ?? ?? ? </props>
          ? ?? ?? ?</property>
          ? ?? ???-->? ?? ?
          </bean>

          <!-- Hibernate SessionFactory -->
          <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
          ??<property name="dataSource" ref="dataSource"/>
          ??<property name="mappingDirectoryLocations">
          ? ?? ?<list>
          ? ?<value>classpath:/com/licaionline/domain/</value>
          ? ?? ?</list>
          ??</property>
          ??<property name="hibernateProperties">
          ? ?<props>
          ? ? <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
          ? ???<prop key="hibernate.show_sql">true</prop>
          ? ? <prop key="hibernate.generate_statistics">true</prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.connection.release_mode">auto</prop>? ?? ?? ?? ?? ?? ?? ?
          ? ?? ?? ?? ?? ? <prop key="hibernate.autoReconnect">true</prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
          ? ?? ?? ?? ?? ? <!--
          ? ? <prop key="hibernate.useUnicode"></prop>
          ? ? <prop key="hibernate.characterEncoding"></prop>
          ? ? <prop key="hibernate.default-lazy-init"></prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</prop>? ???
          ? ? -->
          ? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???
          ? ?? ?? ?? ?? ? <!--
          ? ?? ?? ?? ?? ? <prop key="hibernate.c3p0.acquire_increment">2</prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.c3p0.idle_test_period">1800</prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.c3p0.timeout">1800</prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.c3p0.max_size">30</prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.c3p0.min_size">2</prop>
          ? ?? ?? ?? ?? ? <prop key="hibernate.c3p0.max_statements">50</prop>
          ? ? -->? ?? ?? ?
          ? ?</props>
          ??</property>




          注意:注釋掉的那些,都是錯(cuò)誤的。網(wǎng)上流行的,基本上跟注釋掉的那些差不多。配錯(cuò)了,并無(wú)異常,還是能正常使用。但是所作的配置不起作用。


          二、
          起作用的,是datasource里面的這一句:
          <property name="maxIdleTime"><value>1800</value></property>

          這兒設(shè)置成每隔1800秒就掃描一次,檢查一下空閑的鏈接。所以,用戶基本上不會(huì)得到空閑的鏈接了。

          如果再不放心,
          <property name="testConnectionOnCheckout"><value>false</value></property>
          這兒設(shè)置成true。每次連接之前,都要測(cè)一下。但是這樣會(huì)影響效率。


          三、

          解決的方法有3種:

          增加wait_timeout的時(shí)間。
          減少Connection pools中connection的lifetime。
          測(cè)試Connection pools中connection的有效性。
          當(dāng)然最好的辦法是同時(shí)綜合使用上述3種方法,下面就DBCP和C3P0分別做一說(shuō)明,假設(shè)wait_timeout為默認(rèn)的8小時(shí)

          DBCP增加以下配置信息:

          //set to 'SELECT 1'? ?
          validati? ?
          //set to 'true'? ?
          testWhileIdle = "true"? ???
          //some positive integer? ?
          timeBetweenEvictionRunsMillis = 3600000? ?
          //set to something smaller than 'wait_timeout'? ?
          minEvictableIdleTimeMillis = 18000000? ?
          //if you don't mind a hit for every getConnection(), set to "true"? ?
          test? ?

          C3P0增加以下配置信息:

          //set to 'SELECT 1'? ?? ?
          preferredTestQuery = 'SELECT 1'? ???
          //set to something much less than wait_timeout, prevents connections from going stale? ?
          idleConnectionTestPeriod = 18000? ?? ?
          //set to something slightly less than wait_timeout, preventing 'stale' connections from being handed out? ?
          maxIdleTime = 25000? ???
          //if you can take the performance 'hit', set to "true"? ?
          testConnectionOnCheckout = true? ???

          更多的配置信息大家可以查看C3P0文檔,Connector/J文檔,以及DBCP的文檔。

          posted @ 2007-01-10 15:33 一凡 閱讀(4122) | 評(píng)論 (10)編輯 收藏
          set ?echo? off ;
          set ?pagesize? 50000 ;
          spool?d:\failuretotal
          - 2007 .txt;
          select ? * ? from ?tab;
          spool?
          off ;
          posted @ 2007-01-10 13:05 一凡 閱讀(226) | 評(píng)論 (0)編輯 收藏
          ?????? ?從昨天開(kāi)始我的工作算是理順了,各種程序都運(yùn)行正常了,可以輕松幾天,哈哈,真舒服啊!
          ??????? 剛來(lái)這個(gè)公司的時(shí)候,軟件什么都沒(méi)有,都是重新做,可是忙壞了,經(jīng)過(guò)三個(gè)月的努力算是小有成績(jī)了,下一步看能不能把portal的概念應(yīng)用到我的統(tǒng)計(jì)平臺(tái)中,過(guò)兩天試試.......... 廢話幾句,沒(méi)什么好寫的
          posted @ 2006-12-29 11:48 一凡 閱讀(312) | 評(píng)論 (0)編輯 收藏
          There are two solutions:
          - install GDI+
          http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/gdiplus/gdiplus.asp
          or
          -start Eclipse with "eclipse.exe -vmargs -DR31ENHANCE=false". This will not
          use any of the new SWT 3.1 functionalities, and so doesnt' require GDI+.

          posted @ 2006-12-21 11:59 一凡 閱讀(284) | 評(píng)論 (0)編輯 收藏
          # !/bin/sh
          dttime = `date? -- date? " 1?days?ago " ? " +%Y-%m-%d " `
          echo?
          " Starting?smg_cmpp3?smg_empp2?logs?get "
          sftp?ihandy@
          192.168 . 1.225 ? << EOF
          cd?
          / home / ihandy / smgagent / smg_cmpp3 / logs
          lcd?
          / home / ihandy / log - smg / cmpp3
          get?
          " *deliver.$dttime.* "
          get?
          " *submit.$dttime.* "
          get?
          " *report.$dttime.* "
          cd?
          / home / ihandy / smgagent / smg_empp2 / logs
          lcd?
          / home / ihandy / log - smg / empp2
          get?
          " *deliver.$dttime.* "
          get?
          " *submit.$dttime.* "
          get?
          " *report.$dttime.* "
          EOF
          exit
          實(shí)現(xiàn)這個(gè)功能要在FTP服務(wù)器上設(shè)置自動(dòng)登錄,才能實(shí)現(xiàn)
          posted @ 2006-12-07 10:31 一凡 閱讀(661) | 評(píng)論 (2)編輯 收藏
          僅列出標(biāo)題
          共21頁(yè): First 上一頁(yè) 13 14 15 16 17 18 19 20 21 下一頁(yè) 
          主站蜘蛛池模板: 威远县| 东明县| 高平市| 林芝县| 红桥区| 重庆市| 台山市| 新安县| 墨玉县| 东丰县| 马鞍山市| 龙门县| 定兴县| 长兴县| 南安市| 宜州市| 奉节县| 古蔺县| 安化县| 郯城县| 中牟县| 福安市| 清镇市| 衡东县| 大连市| 峨边| 定结县| 巫山县| 甘南县| 城固县| 津市市| 孙吴县| 米林县| 锡林浩特市| 温州市| 巴南区| 托克逊县| 木兰县| 滕州市| 德保县| 富民县|