JUST DO IT ~

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



          TMD 到底什么是異常


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

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

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

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

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


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


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



           




          posted @ 2009-10-10 01:07 小高 閱讀(355) | 評論 (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 小高 閱讀(337) | 評論 (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 小高 閱讀(169) | 評論 (0)編輯 收藏


          時間

          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 小高 閱讀(375) | 評論 (0)編輯 收藏
          在啟動時關(guān)閉sendmail 服務(wù) [其它服務(wù)也一樣]
          posted by JianNeng in Opensource 在啟動時關(guān)閉sendmail- -

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

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

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

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

          chkconfig -levels 12345 sendmail off

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

          [root@oracle ~]# shutdown -h now

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

          2 .使用:

          定義一個委托: 和一個類一樣的

          delegatevoid Del (int x);

          或者

          delegatevoid Del (T x);

          定一個委托變量和賦值

          Main(){

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

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

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

          導(dǎo)航

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          統(tǒng)計

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關(guān)注的blog

          手冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 霞浦县| 泾阳县| 连州市| 辉县市| 闽清县| 平塘县| 崇信县| 淮南市| 电白县| 湖北省| 武城县| 吉木乃县| 尚义县| 平果县| 南华县| 渭南市| 阳西县| 沐川县| 广州市| 东乌珠穆沁旗| 黑水县| 贡觉县| 沂水县| 阿荣旗| 双牌县| 隆尧县| 南郑县| 泰顺县| 五家渠市| 霞浦县| 腾冲县| 金秀| 太康县| 革吉县| 隆德县| 陵川县| 休宁县| 浦东新区| 东安县| 寻甸| 库尔勒市|