JUST DO IT ~

          我只想當(dāng)個(gè)程序員



          TMD 到底什么是異常


          程序按照預(yù)期的流程運(yùn)行..正常態(tài)
          出現(xiàn)未預(yù)計(jì)到的情況..比如網(wǎng)線斷了gddg...文件打開失敗...
          這個(gè)時(shí)候 程序是繼續(xù)執(zhí)行 還是 其他的選擇 或者 退出app ....

          實(shí)際的情況是 有可能可以恢復(fù),從業(yè)務(wù)角度出發(fā)..我可以重新試圖連接...可以重新打開文件或者換一個(gè)文件 或者重新創(chuàng)建一個(gè)新的文件....
          只要不是致命的問題..通常是可以恢復(fù)的...沒必要退出app...

          如果你不捕獲 網(wǎng)絡(luò)斷開或者文件無法打開的 異常 ...那么為什么程序退出了呢...因?yàn)槟銢]有告訴你的程序 如果出錯(cuò)了應(yīng)該怎么辦...sun 規(guī)避風(fēng)險(xiǎn),你出錯(cuò)了,可能下一步要錯(cuò)誤的扣除你工資,為了解除這種不確定執(zhí)行的巨大風(fēng)險(xiǎn)...那么就把你app shutdown了....

          如果你有catch 對(duì)于程序來說 你有防備 出現(xiàn)異常的準(zhǔn)備...那么真到了異常 那么就看你異常的處理流程 是否奏效....

          異常體系....瞎扯淡...就是幾個(gè)異常類的繼承關(guān)系(虛擬機(jī)內(nèi)部異常,用戶定義異常 ...).....還能有什么 .
          無非是 根據(jù)不同的出錯(cuò)類型來 包裝異常...給這個(gè)這種類型的異常 或者 這類問題取一個(gè)名字....
          當(dāng)你沒看堆棧信息的時(shí)候大概可以 判斷一下 問題再那里而已.....


          異常來跳轉(zhuǎn) 程序是因?yàn)?無法預(yù)期異常后下步該如何執(zhí)行 所以跳轉(zhuǎn)...
          異常是比較消耗系統(tǒng)資源的.


          .net 為什么沒有主動(dòng)要求你 拋出異常....
          因?yàn)?net的主要架構(gòu)師 再設(shè)計(jì).net時(shí)候看到了 很多程序員 一層一層的拋出異常只在最底層  main中截獲異常....
          那么大量的函數(shù)都是 throws 其實(shí)根本無意義....所以他再設(shè)計(jì)的時(shí)候就沒有采取和java 相同的方式 .



           




          posted @ 2009-10-10 01:07 小高 閱讀(371) | 評(píng)論 (2)編輯 收藏

          片段 "


           public LocationInfo(Type callerStackBoundaryDeclaringType)
            {
             // Initialize all fields
             m_className = NA;
             m_fileName = NA;
             m_lineNumber = NA;
             m_methodName = NA;
             m_fullInfo = NA;

          #if !NETCF
             if (callerStackBoundaryDeclaringType != null)
             {
              try
              {
               StackTrace st = new StackTrace(true);
               int frameIndex = 0;

               // skip frames not from fqnOfCallingClass
               while (frameIndex < st.FrameCount)
               {
                StackFrame frame = st.GetFrame(frameIndex);
                if (frame != null && frame.GetMethod().DeclaringType == callerStackBoundaryDeclaringType)
                {
                 break;
                }
                frameIndex++;
               }

               // skip frames from fqnOfCallingClass
               while (frameIndex < st.FrameCount)
               {
                StackFrame frame = st.GetFrame(frameIndex);
                if (frame != null && frame.GetMethod().DeclaringType != callerStackBoundaryDeclaringType)
                {
                 break;
                }
                frameIndex++;
               }

               if (frameIndex < st.FrameCount)
               {
                // now frameIndex is the first 'user' caller frame
                StackFrame locationFrame = st.GetFrame(frameIndex);

                if (locationFrame != null)
                {
                 System.Reflection.MethodBase method = locationFrame.GetMethod();

                 if (method != null)
                 {
                  m_methodName =  method.Name;
                  if (method.DeclaringType != null)
                  {
                   m_className = method.DeclaringType.FullName;
                  }
                 }
                 m_fileName = locationFrame.GetFileName();
                 m_lineNumber = locationFrame.GetFileLineNumber().ToString(System.Globalization.NumberFormatInfo.InvariantInfo);

                 // Combine all location info
                 m_fullInfo =  m_className + '.' + m_methodName + '(' + m_fileName + ':' + m_lineNumber + ')';

                }
               }
              }
              catch(System.Security.SecurityException)
              {
               // This security exception will occur if the caller does not have
               // some undefined set of SecurityPermission flags.
               LogLog.Debug("LocationInfo: Security exception while trying to get caller stack frame. Error Ignored. Location Information Not Available.");
              }
             }
          #endif
            }





          posted @ 2009-10-01 00:02 小高 閱讀(345) | 評(píng)論 (0)編輯 收藏
          C# Preprocessor Directives
          http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx

          #if

          #else

          #elif

          #endif

          #define

          #undef

          #warning

          #error

          #line

          #region

          #endregion

          #pragma

          #pragma warning

          #pragma checksum



          #if NETCF

          Console.WriteLine(message);

          //System.Diagnostics.Debug.WriteLine(message);

          #else

          Console.Error.WriteLine(message);

          Trace.WriteLine(message);

                          System.Diagnostics.Debug.

          #endif


          posted @ 2009-09-30 13:05 小高 閱讀(171) | 評(píng)論 (0)編輯 收藏


          時(shí)間

          select
          trunc(86400*
            (to_date('2009-1-1 23:15:01','yyyy-mm-dd hh24:mi:ss') -
           to_date('2009-1-1 23:10:00','yyyy-mm-dd hh24:mi:ss'))
           )
          from dual ;

          posted @ 2009-09-12 09:19 小高 閱讀(381) | 評(píng)論 (0)編輯 收藏
          在啟動(dòng)時(shí)關(guān)閉sendmail 服務(wù) [其它服務(wù)也一樣]
          posted by JianNeng in Opensource 在啟動(dòng)時(shí)關(guān)閉sendmail- -

          對(duì)其他的服務(wù)可以采取同樣的措施。 

            而對(duì)于那些不是從inetd啟動(dòng)的服務(wù),則通過命令來關(guān)閉,例如需要關(guān)閉sendmail服務(wù),則:

          /etc/rc.d/init.d/sendmail stop

            然后再設(shè)置其不在系統(tǒng)啟動(dòng)時(shí)啟動(dòng):

          chkconfig -levels 12345 sendmail off

          [root@oracle xinetd.d]# chkconfig --level 123456  sendmail off
          [root@oracle xinetd.d]# 
          linux 關(guān)機(jī) 

          [root@oracle ~]# shutdown -h now

          posted @ 2009-09-07 08:22 小高 閱讀(901) | 評(píng)論 (0)編輯 收藏
               摘要: plsql developer plsql 調(diào)試無法 ..包沒加入所有的函數(shù)的定義到 包頭文件定義.   閱讀全文
          posted @ 2009-08-25 20:18 小高| 編輯 收藏
               摘要: 為什么log4j 顯示行號(hào)
          (2) 建立一個(gè)Throwable的對(duì)象來取得當(dāng)前運(yùn)行堆棧的快照...Throwable.fillInStackTrace();
          (3) 從拋出的Throwable對(duì)象中,來分析出當(dāng)前l(fā)og信息的行號(hào)...  閱讀全文
          posted @ 2009-08-18 20:21 小高 閱讀(675) | 評(píng)論 (0)編輯 收藏
               摘要: 其實(shí),很簡(jiǎn)單,并不是因?yàn)橄到y(tǒng)打了補(bǔ)丁的問題,而是因?yàn)閂S 2008打了補(bǔ)丁,導(dǎo)致沒法刪除,可以在“添加/刪除程序”面板中,選中上方的“顯示更新”,然后找到VS 2008,下面多多少少會(huì)掛了幾個(gè)更新或者補(bǔ)丁,全部先刪掉,然后再刪VS 2008,熟悉的維護(hù)界面又回來了,輸入序列號(hào),OK,正常使用~~~  閱讀全文
          posted @ 2009-07-17 14:31 小高 閱讀(2088) | 評(píng)論 (2)編輯 收藏
               摘要: lsnrctl services  閱讀全文
          posted @ 2009-02-26 20:47 小高 閱讀(3816) | 評(píng)論 (1)編輯 收藏
               摘要: sqlplus Xdmp/Xdmp@127.0.0.1:1521/Xdmp
          SQL> conn sys/oracle @itmp_rac as sysdba  閱讀全文
          posted @ 2009-02-24 16:04 小高 閱讀(1699) | 評(píng)論 (3)編輯 收藏
               摘要: 左連接 .如果一邊的沒有記錄, nvl (右邊,0) 否則會(huì)造成整列無法,無數(shù)據(jù).

          select d.crunit_ - nvl( a.stkamt_ ,0)
          from dl_fundetf d ,
          (select c.stkcode_, c.exchgcode_,c.stkamt_ ,c.stkcost_
          from acc_proflstk c
          where 1=1
          and c.fundid_ = '55'
          and c.cellid_ = '50001'
          and c.proflid_ = '080724113732'
          ) a
          where 1=1
          and d.exchgcode_ = 'SH'
          and d.fundid_ = '510051'
          and a.exchgcode_ (+)= d.exchgcode_
          and a.stkcode_ (+)= d.fundid_   閱讀全文
          posted @ 2009-02-10 15:07 小高 閱讀(817) | 評(píng)論 (0)編輯 收藏
               摘要: 1.作用: 屏蔽方法名 ,靈活性動(dòng)態(tài)性函數(shù)指針

          2 .使用:

          定義一個(gè)委托: 和一個(gè)類一樣的

          delegatevoid Del (int x);

          或者

          delegatevoid Del (T x);

          定一個(gè)委托變量和賦值

          Main(){

          Del d = obj.DoWork; 實(shí)例方法或者靜態(tài)方法都可以

          }
            閱讀全文
          posted @ 2009-02-01 11:06 小高 閱讀(244) | 評(píng)論 (0)編輯 收藏
               摘要:   閱讀全文
          posted @ 2008-12-04 16:31 小高 閱讀(252) | 評(píng)論 (0)編輯 收藏
               摘要:   閱讀全文
          posted @ 2008-11-04 21:52 小高 閱讀(181) | 評(píng)論 (0)編輯 收藏
               摘要: 檢查客戶機(jī)器上的輸入法區(qū)域設(shè)置。如果默認(rèn)輸入法不是中文,則先調(diào)用一下方法,切換到中文。
          Top

            閱讀全文
          posted @ 2008-10-22 20:02 小高 閱讀(481) | 評(píng)論 (0)編輯 收藏
          僅列出標(biāo)題
          共20頁(yè): First 上一頁(yè) 10 11 12 13 14 15 16 17 18 下一頁(yè) Last 

          導(dǎo)航

          <2025年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          統(tǒng)計(jì)

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關(guān)注的blog

          手冊(cè)

          搜索

          積分與排名

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 涿鹿县| 汉源县| 北海市| 麦盖提县| 谢通门县| 徐州市| 乌恰县| 普定县| 碌曲县| 西林县| 肇庆市| 夏津县| 宜宾市| 仪征市| 犍为县| 乐亭县| 彝良县| 常熟市| 蚌埠市| 乐至县| 青铜峡市| 遂平县| 阿克苏市| 万山特区| 黔南| 调兵山市| 宜川县| 桃园市| 灵寿县| 开鲁县| 高清| 黄龙县| 枣庄市| 登封市| 泰州市| 宁远县| 浠水县| 察隅县| 兰溪市| 甘洛县| 张家界市|