亚洲va在线va天堂va四虎,亚洲av乱码中文一区二区三区,久久综合亚洲色HEZYO社区http://www.tkk7.com/stephen80/zh-cnSun, 11 May 2025 05:56:45 GMTSun, 11 May 2025 05:56:45 GMT60c++ difference from javahttp://www.tkk7.com/stephen80/archive/2010/02/03/311784.html西津渡西津渡Wed, 03 Feb 2010 03:43:00 GMThttp://www.tkk7.com/stephen80/archive/2010/02/03/311784.htmlhttp://www.tkk7.com/stephen80/comments/311784.htmlhttp://www.tkk7.com/stephen80/archive/2010/02/03/311784.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/311784.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/311784.html 1. take charge of object management , negotiate ownershiop ,use scoped_ptr,
   not to transfer other's ownership
2. use c++ template to express seperation corncern ,such as (static)polymorphy and policy
3. disable copy constructor and assign operator by yourself
4. polymorphy by pointer
5. 使用 template ,macro 取得類似動態語言的能力
6. 偏好無狀態的 函數


西津渡 2010-02-03 11:43 發表評論
]]>
mysql best practicehttp://www.tkk7.com/stephen80/archive/2010/01/05/308270.html西津渡西津渡Tue, 05 Jan 2010 05:38:00 GMThttp://www.tkk7.com/stephen80/archive/2010/01/05/308270.htmlhttp://www.tkk7.com/stephen80/comments/308270.htmlhttp://www.tkk7.com/stephen80/archive/2010/01/05/308270.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/308270.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/308270.html

Myisam is preferred without transaction and little update(delete)

Big than 4G datafile can user Myisam merge table.

InnoDB with auto_increment primary key is preferred.

Few storage process

Guess: 20m records max per table , 500G data max per tablespace , 256 tables per database (may problem)

Use prepared statement and  batch

Optimize Your Queries For the Query Cache

// query cache does NOT work
$r = mysql_query("SELECT username FROM user WHERE signup_date >= CURDATE()");
 
// query cache works!
$today = date("Y-m-d");
$r = mysql_query("SELECT username FROM user WHERE signup_date >= '$today'");

EXPLAIN Your SELECT Queries

LIMIT 1 When Getting a Unique Row

Index and Use Same Column Types for Joins

Do Not ORDER BY RAND()

Avoid SELECT *

t is a good habit to always specify which columns you need when you are doing your SELECT’s.

Use ENUM over VARCHAR

Use NOT NULL If You Can

Store IP Addresses as UNSIGNED INT (?)

Fixed-length (Static) Tables are Faster

Vertical Partitioning

Vertical Partitioning is the act of splitting your table structure in a vertical manner for optimization reasons.

Example 1: You might have a users table that contains home addresses, that do not get read often. You can choose to split your table and store the address info on a separate table. This way your main users table will shrink in size. As you know, smaller tables perform faster.

Example 2: You have a “last_login” field in your table. It updates every time a user logs in to the website. But every update on a table causes the query cache for that table to be flushed. You can put that field into another table to keep updates to your users table to a minimum.

But you also need to make sure you don’t constantly need to join these 2 tables after the partitioning or you might actually suffer performance decline.

Split the Big DELETE or INSERT Queries

If you have some kind of maintenance script that needs to delete large numbers of rows, just use the LIMIT clause to do it in smaller batches to avoid this congestion.

Smaller Columns Are Faster

Use an Object Relational Mapper

f you do not need the time component, use DATE instead of DATETIME.

Consider horizontally spitting many-columned tables if they contain a lot of NULLs or rarely used columns.

Be an SQL programmer who thinks in sets, not procedural programming paradigms

InnoDB can’t optimize SELECT COUNT(*) queries. Use counter tables! That’s how to scale InnoDB.

Prefer MM with hive

refer :

http://blog.tuvinh.com/top-20-mysql-best-practices/



西津渡 2010-01-05 13:38 發表評論
]]>
mysql jdbc driver code browserhttp://www.tkk7.com/stephen80/archive/2009/12/30/307741.html西津渡西津渡Wed, 30 Dec 2009 04:41:00 GMThttp://www.tkk7.com/stephen80/archive/2009/12/30/307741.htmlhttp://www.tkk7.com/stephen80/comments/307741.htmlhttp://www.tkk7.com/stephen80/archive/2009/12/30/307741.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/307741.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/307741.html 從時序圖中可以看到,createNewIO()就是新建了一個com.mysql.jdbc.MysqlIO,利用 com.mysql.jdbc.StandardSocketFactory來創建一個socket。然后就由這個mySqlIO來與MySql服務器進行握手(doHandshake()),這個doHandshake主要用來初始化與Mysql server的連接,負責登陸服務器和處理連接錯誤。在其中會分析所連接的mysql server的版本,根據不同的版本以及是否使用SSL加密數據都有不同的處理方式,并把要傳輸給數據庫server的數據都放在一個叫做packet的 buffer中,調用send()方法往outputStream中寫入要發送的數據。


useServerPreparedStmts置為true的話,mysql驅動可以通過PreparedStatement的子類ServerPreparedStatement來實現真正的PreparedStatement的功能




第一位表示數據包的開始位置,就是數據存放的起始位置,一般都設置為0,就是從第一個位置開始。第二和第三個字節標識了這個數據包的大小,注意的是,這個大小是出去標識的4個字節的大小,對于非最后一個數據包來說,這個大小都是一樣的,就是splitSize,也就是maxThreeBytes,它的值是 255 * 255 * 255。
最后一個字節中存放的就是數據包的編號了,從0開始遞增。
在標識位設置完畢之后,就可以把255 * 255 * 255大小的數據從我們準備好的待發送數據包中copy出來了,注意,前4位已經是標識位了,所以應該從第五個位置開始copy數據

 # packetToSend = compressPacket(headerPacket, HEADER_LENGTH,    
#                 splitSize, HEADER_LENGTH); 

LoadBalancingConnectionProxy
package java.lang.reflect 。 proxy .


http://developer.51cto.com/art/200907/137823.htm

http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-implementation-notes.html

PreparedStatements are implemented by the driver, as MySQL does not have a prepared statement feature. Because of this, the driver does not implement getParameterMetaData() or getMetaData() as it would require the driver to have a complete SQL parser in the client.

Starting with version 3.1.0 MySQL Connector/J, server-side prepared statements and binary-encoded result sets are used when the server supports them.


但這是不是說PreparedStatement沒用呢?不是的,PreparedStatement有其他的好處:
1.代碼的可讀性和可維護性
2.最重要的一點是極大地提高了安全性,可以防止SQL注入

然后我又看了一些網上其他人的經驗,基本和我的判斷一致,有兩點要特別提請大家注意:

1.并不是說PreparedStatement在所有的DB上都不會提高效率,PreparedStatement需要服務器端的支持,比如在 Oracle上就會有顯著效果。上面說的測試都是在MySQL上測試的,我找到了一個MySQL架構師的帖子,比較明確地說明了MySQL不支持 PreparedStatement。

2.即便PreparedStatement不能提高性能,在少數使用時甚至會降低效率,但仍然應該使用PreparedStatement!因為其他好 處實在是太大了!當然,當SQL查詢比較復雜時,可能PreparedStatement好處會更大,只是我沒有測試,不敢肯定。

3.既然PreparedStatement不能提高效率,那PreparedStatement Pool也就沒有必要了。但可以看到每次新建Connection的開銷實在很大,因此Connection Pool絕對必要。





西津渡 2009-12-30 12:41 發表評論
]]>
current vimrchttp://www.tkk7.com/stephen80/archive/2009/10/29/300152.html西津渡西津渡Thu, 29 Oct 2009 03:42:00 GMThttp://www.tkk7.com/stephen80/archive/2009/10/29/300152.htmlhttp://www.tkk7.com/stephen80/comments/300152.htmlhttp://www.tkk7.com/stephen80/archive/2009/10/29/300152.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/300152.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/300152.html set autoindent
set smartindent
set ignorecase
syntax enable
set wrap
set showmatch
set foldmarker={{{,}}}
set tabstop=4
set shiftwidth=4
set ruler
set expandtab
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
set nobackup
setlocal noswapfile
set bufhidden=hide
syntax on
set tags=./tags,~/apsara/tags
set path+=/usr/include/c++/**,~/apsara/include/**
filetype plugin on
filetype indent on
autocmd filetype java,c,cpp setlocal textwidth=100
set pastetoggle=<F7>

nmap <F2>  :set nonumber!<CR>
nmap <F8>  :TlistToggle<CR>
imap <F11> <C-x><C-p>
map <F12>  :!ctags -R --c++-kinds=+p --fields=+iaS --exclude=build --extra=+q .<CR>
map <F6> :w<CR>
imap <F6> <ESC>:w<CR>a
map <F3> /<C-R><C-W><CR>

有 c support 支持,很棒。



西津渡 2009-10-29 11:42 發表評論
]]>
c++ 指針 ,shared_ptrhttp://www.tkk7.com/stephen80/archive/2009/10/27/299960.html西津渡西津渡Tue, 27 Oct 2009 10:54:00 GMThttp://www.tkk7.com/stephen80/archive/2009/10/27/299960.htmlhttp://www.tkk7.com/stephen80/comments/299960.htmlhttp://www.tkk7.com/stephen80/archive/2009/10/27/299960.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/299960.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/299960.html

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

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

    void test()
    {
        boost::shared_ptr<implementation> sp    (new implementation());
        foo(sp,g());
    }
  • 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

    西津渡 2009-10-27 18:54 發表評論
    ]]>
    c++ 的linkage http://www.tkk7.com/stephen80/archive/2009/10/27/299895.html西津渡西津渡Tue, 27 Oct 2009 03:13:00 GMThttp://www.tkk7.com/stephen80/archive/2009/10/27/299895.htmlhttp://www.tkk7.com/stephen80/comments/299895.htmlhttp://www.tkk7.com/stephen80/archive/2009/10/27/299895.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/299895.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/299895.html 其實沒有.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





    西津渡 2009-10-27 11:13 發表評論
    ]]>
    整理軟件架構相關的知識http://www.tkk7.com/stephen80/archive/2009/10/16/architecture.html西津渡西津渡Fri, 16 Oct 2009 05:13:00 GMThttp://www.tkk7.com/stephen80/archive/2009/10/16/architecture.htmlhttp://www.tkk7.com/stephen80/comments/298553.htmlhttp://www.tkk7.com/stephen80/archive/2009/10/16/architecture.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/298553.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/298553.html
    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





    西津渡 2009-10-16 13:13 發表評論
    ]]>
    linux 安裝字體http://www.tkk7.com/stephen80/archive/2009/08/14/291185.html西津渡西津渡Fri, 14 Aug 2009 09:48:00 GMThttp://www.tkk7.com/stephen80/archive/2009/08/14/291185.html 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






    西津渡 2009-08-14 17:48 發表評論
    ]]>
    java performance http://www.tkk7.com/stephen80/archive/2009/07/22/287892.html西津渡西津渡Wed, 22 Jul 2009 10:07:00 GMThttp://www.tkk7.com/stephen80/archive/2009/07/22/287892.htmlhttp://www.tkk7.com/stephen80/comments/287892.htmlhttp://www.tkk7.com/stephen80/archive/2009/07/22/287892.html#Feedback0http://www.tkk7.com/stephen80/comments/commentRss/287892.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/287892.html
    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


     










    西津渡 2009-07-22 18:07 發表評論
    ]]>
    software architecture's futurehttp://www.tkk7.com/stephen80/archive/2009/07/13/286540.html西津渡西津渡Mon, 13 Jul 2009 04:33:00 GMThttp://www.tkk7.com/stephen80/archive/2009/07/13/286540.htmlhttp://www.tkk7.com/stephen80/comments/286540.htmlhttp://www.tkk7.com/stephen80/archive/2009/07/13/286540.html#Feedback1http://www.tkk7.com/stephen80/comments/commentRss/286540.htmlhttp://www.tkk7.com/stephen80/services/trackbacks/286540.html 大致上是:過程式、面向對象、組件、面向服務。
    未來呢?我忘記了,抑或是 dsl ?

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

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


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

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

    對于英文詞語的使用,是因為,我想更能表達我的意思,不至于誤解。見諒。
    歡迎批評指正!

    西津渡 2009-07-13 12:33 發表評論
    ]]>
    主站蜘蛛池模板: 国产a v无码专区亚洲av| 妞干网在线免费观看| 国产亚洲美女精品久久久| 免费夜色污私人影院网站| 免费在线观看黄网| 一级毛片试看60分钟免费播放| 国产yw855.c免费视频| 老司机午夜精品视频在线观看免费 | 91视频精品全国免费观看| 在线亚洲精品福利网址导航| 国色精品va在线观看免费视频| 久久精品国产亚洲麻豆| 免费人成毛片动漫在线播放| 亚洲视频在线观看地址| 日本高清在线免费| 亚洲AV无码AV日韩AV网站| 亚洲AV成人潮喷综合网| 国产免费久久久久久无码| 亚洲天天在线日亚洲洲精| 亚洲一区二区免费视频| 亚洲中文字幕乱码AV波多JI | 免费福利网站在线观看| 亚洲另类无码一区二区三区| 亚洲国产精品狼友中文久久久| a高清免费毛片久久| 久久久久亚洲精品天堂| 在线免费观看污网站| 深夜免费在线视频| 亚洲av丰满熟妇在线播放| 日韩不卡免费视频| 一二三四在线观看免费中文在线观看| 精品国产香蕉伊思人在线在线亚洲一区二区 | 妞干网免费视频在线观看| 一个人免费观看视频在线中文| 图图资源网亚洲综合网站| 在线观看无码的免费网站| 国产美女视频免费观看的网站 | 国产电影午夜成年免费视频| 曰批全过程免费视频免费看 | 最近中文字幕大全免费版在线 | 国产亚洲一区二区手机在线观看|