1. 避免對shared_ptr所管理的對象的直接內存管理操作,以免造成該對象的重釋放
            shared_ptr并不能對循環引用的對象內存自動管理(這點是其它各種引用計數管理內存方式的通病)。

          2. 不要構造一個臨時的shared_ptr作為函數的參數。
            如下列代碼則可能導致內存泄漏:
            void test()
            {
                foo(boost::shared_ptr<implementation>(new    implementation()),g());
            }
            正確的用法

            void test()
            {
                boost::shared_ptr<implementation> sp    (new implementation());
                foo(sp,g());
            }
          3. Employee boss("Morris, Melinda", 83000);

            Employee* s = &boss;

            This is usually not a good idea. As a rule of thumb, C++ pointers should only refer to objects allocated wth new.


          copy:http://www.diybl.com/course/3_program/c++/cppjs/20090403/163770.html
          posted @ 2009-10-27 18:54 西津渡 閱讀(299) | 評論 (0)編輯 收藏
           
          抄錄備忘:
          其實沒有.h也能很好的工作,但是當你發現一個外部鏈接的函數或外部變量,需要許多份

          聲明,因為c++這種語言,在使用函數和變量的時候,必須將他聲明,為何要聲明?聲明之后才

          知道他的規格,才能更好的發現不和規格的部分.你別妄想一個編譯單元,會自動從另一個

          編譯單元那里得到什么信息,知道你是如何定義這個函數的.

              所以說,只要使用到該函數的單元,就必須寫一份聲明在那個.cpp里面,這樣是不是很麻煩,

          而且,如果要修改,就必須一個一個修改.這真讓人受不了.


          .h就是為了解決這個問題而誕生,他包含了這些公共的東西.然后所有需要使用該函數的.cpp,只需要

          用#include包含進去便可.以后需要修改,也只是修改一份內容.


          請注意不要濫用.h,.h里面不要寫代碼,.h不是.cpp的倉庫,什么都塞到里面.

          如果在里面寫代碼,當其他.cpp包含他的時候,就會出現重復定義的情況,

          比如將函數func(){printf};放到頭文件a.h,里面還有一些a.cpp需要的聲明等;

          然后你發現b.cpp需要用到a.cpp里面的一個函數,就很高興的將a.h包含進來.

          注意,#include并不是什么申請指令,他就是將指定的文件的內容,原封不動的拷貝

          進來.


          這時候實際上a.cpp和b.cpp都有一個func()函數的定義.

          如果這個函數是內部鏈接static的話,還好,浪費了一倍空間;

          如果是extern,外部鏈接(這個是默認情況),那么根據在同一個程序內不可出現

          同名函數的要求,連接器會毫不留情給你一個連接錯誤!

          http://www.cnblogs.com/shelvenn/archive/2008/02/02/1062446.html



          posted @ 2009-10-27 11:13 西津渡 閱讀(195) | 評論 (0)編輯 收藏
           
           一.    Perspective and Metaphor

          Platform
          Kernel
          Framework
          二.    Philosophy and discipline
          Be aware of context
          Extreme maintenance
          Be pragmatic
          Extreme abstract: Program to an interface (abstraction), not an implementation
            
          Extreme separation of concerns
          Extreme readability
          Testability
          No side effect
          Do not repeat yourself
          三.    Principle
          DIP ,dependency inversion of control
          OCP , open close
          LSP , liskov substitute
          ISP , interface segregation
          SRP , single responsibility
          LKP, Lease knowledge principle
          四.    design pattern
          Construction
          Behavior
          Structure

          五.    anti-pattern、bad smell
          Long method
          Diverse change
              Repeated code
              Talk to stranger
              Pre optimize
          六.    algorithms
           nLongN
           Divided and conqueror
           

          七.    architecture
          Hierarchal
          Pipes and filter
          Micro kernel
          Broker
          Black Board
              Interpreter
             
          八.    Distributed & concurrent
          What to concurrent

          Scalability
              Stretch key dimensions to see what breaks
          九.    languages
          Ruby
          Erlang
          assemble
          C
          C++
          Java
          Python
          Scala

          Be ware of different program paradigms.
          十.    Performance
           Minimize remote calls and other I/O
           Speed-up data conversion
           release resource as soon as possible 

          十一.    architectures' future
          軟件設計思想的發展邏輯,大致是提高抽象程度 ,separation of concern 程度。
              fn(design )=  fn1(abstraction )+ fn2(separation of concern).

          由于大規模數據處理時代的來臨,下一代設計范式的重點:
          1.    將是如何提高distributed(--concurrent) programing 的抽象程度 和 separation of concern 程度。
          2.    dsl ,按照以上的公式,也確實是一個好的方向。
          十二.    Reference
          <art agile software development>
          <prerefactor>
          <design patterns>
          <beautiful architecture>
          <refactor>
          <pattern oriented software architecture>
          <extreme software development>
          <beautiful code>
          <patterns for parallel programming>
          <java concurrent programming in practice>
          <java performance tuning>
          <the definite guide to hadoop>
          <greenplum>
          <DryadLINQ>
          <software architecture in practice>
          <97 things architecture should known>
          http://en.wikipedia.org/wiki/Programming_paradigm



          posted @ 2009-10-16 13:13 西津渡 閱讀(2093) | 評論 (0)編輯 收藏
           
          拷貝
          mingliu.ttc  simsun.ttf  SURSONG.TTF  tahomabd.ttf  tahoma.ttf  verdanab.ttf  verdanai.ttf  verdana.ttf  verdanaz.ttf

           #mv simsun.ttc /usr/share/fonts/local/simsun.ttf
          #cd /usr/share/fonts/local/
          sudo mkfontscale
          sudo mkfontdir

          sudo fc-cache
          cp fonts.scale fonts.dir
          sudo chmod 755 *
          sudo chkfontpath --add /usr/share/fonts/local/

          #/etc/init.d/xfs restart
          查檢是否安裝成功

          fc-list |grep Sim

           NSimSun:style=Regular
          SimSun:style=Regular
          SimSun\-PUA:style=Regular




          posted @ 2009-08-14 17:48 西津渡| 編輯 收藏
           
          experience learned.

          1. first think algorithm before concurrent
          2. first solve top problem
          3. memory can be problem with huge data processing
          4.  not to use refletion frequently
          5. prefering strategy that can optimize both cpu and memory .

          technical
          1. thread synchronizing is how to queuing
             be sure to use "while(!Thread.currentThread.isInterupted())

          2. prefer high level  synchronizing facility to low level methodology such as await,notify

          3. dedicated sorter is much faster


           








          posted @ 2009-07-22 18:07 西津渡 閱讀(152) | 評論 (0)編輯 收藏
           
          以前聽過用友的牛人關于軟件設計范型的時代劃分,記得不太準確,不過基本上是業界公認的。
          大致上是:過程式、面向對象、組件、面向服務。
          未來呢?我忘記了,抑或是 dsl ?

          我以往也沒有自己的認識,不過,最近我有自己的看法

          軟件設計思想的發展邏輯,大致是提高抽象程度 ,seperation of concern 程度。
              fn(design )=  fn1(abstraction )+ fn2(seperation of concern).


          由于大規模數據處理時代的來臨,下一代設計范式的重點:

          1. 將是如何提高concurrent programing 的抽象程度 和 seperation of concern 程度。
          2. 至于dsl ,我研究不多,不過,按照以上的公式,也確實是一個好的方向。

          對于英文詞語的使用,是因為,我想更能表達我的意思,不至于誤解。見諒。
          歡迎批評指正!
          posted @ 2009-07-13 12:33 西津渡 閱讀(1227) | 評論 (1)編輯 收藏
           
              只有注冊用戶登錄后才能閱讀該文。閱讀全文
          posted @ 2009-07-10 13:40 西津渡 閱讀(1019) | 評論 (6)編輯 收藏
           
          最近看的東西,備忘。
          Dryad
          DryadLinq
          GreenPlum。

          技術上看:
           Dryad 牛
           
          商業上看,
            只有microsoft(Dryad),oracle (?),ibm (?)

            其他的cloud data engine 似乎難免被收購宿命,一如bea 。。。。etc .
            ?google (Sawzall) ?amazon
            ?hadoop ,pig

          中國:
            ?友友系統
           




          posted @ 2009-05-26 20:02 西津渡 閱讀(163) | 評論 (0)編輯 收藏
           
          Saas business

          一.    chain
              customer : operator :application :feature: platform .
             
          二.    operator
          三.    application
              office
              erp
              mall
              game
          四.    feature

              search engine
              monitor system
              security
              dynamic language
              special db system
              special file system
          五.    platform
              virtual computing resource system
              cloud file system
              cloud db system
              cloud os

          六.    chance
              big fish or small fish should find their way to survive.
          posted @ 2009-05-22 18:34 西津渡 閱讀(147) | 評論 (0)編輯 收藏
           
               摘要:   閱讀全文
          posted @ 2009-05-19 20:20 西津渡 閱讀(1465) | 評論 (0)編輯 收藏
          僅列出標題
          共11頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 Last 
           
          主站蜘蛛池模板: 长岛县| 周至县| 兴城市| 湖北省| 泽州县| 镇安县| 化隆| 卓尼县| 镇巴县| 梁河县| 颍上县| 界首市| 宁强县| 丰都县| 金堂县| 磴口县| 山阳县| 扎鲁特旗| 九江市| 长海县| 泸溪县| 五家渠市| 定陶县| 马尔康县| 江源县| 琼海市| 玉树县| 大安市| 巴彦县| 五莲县| 铜山县| 滦平县| 临海市| 乐平市| 桐庐县| 浦东新区| 泊头市| 裕民县| 金堂县| 信丰县| 乃东县|