亚洲国产精品一区,亚洲伊人色欲综合网,久久亚洲一区二区http://www.tkk7.com/stephen80/zh-cnSun, 11 May 2025 05:58:56 GMTSun, 11 May 2025 05:58:56 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 取得類似動(dòng)態(tài)語言的能力
6. 偏好無狀態(tài)的 函數(shù)


]]>
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/



]]>
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 從時(shí)序圖中可以看到,createNewIO()就是新建了一個(gè)com.mysql.jdbc.MysqlIO,利用 com.mysql.jdbc.StandardSocketFactory來創(chuàng)建一個(gè)socket。然后就由這個(gè)mySqlIO來與MySql服務(wù)器進(jìn)行握手(doHandshake()),這個(gè)doHandshake主要用來初始化與Mysql server的連接,負(fù)責(zé)登陸服務(wù)器和處理連接錯(cuò)誤。在其中會(huì)分析所連接的mysql server的版本,根據(jù)不同的版本以及是否使用SSL加密數(shù)據(jù)都有不同的處理方式,并把要傳輸給數(shù)據(jù)庫(kù)server的數(shù)據(jù)都放在一個(gè)叫做packet的 buffer中,調(diào)用send()方法往outputStream中寫入要發(fā)送的數(shù)據(jù)。


useServerPreparedStmts置為true的話,mysql驅(qū)動(dòng)可以通過PreparedStatement的子類ServerPreparedStatement來實(shí)現(xiàn)真正的PreparedStatement的功能




第一位表示數(shù)據(jù)包的開始位置,就是數(shù)據(jù)存放的起始位置,一般都設(shè)置為0,就是從第一個(gè)位置開始。第二和第三個(gè)字節(jié)標(biāo)識(shí)了這個(gè)數(shù)據(jù)包的大小,注意的是,這個(gè)大小是出去標(biāo)識(shí)的4個(gè)字節(jié)的大小,對(duì)于非最后一個(gè)數(shù)據(jù)包來說,這個(gè)大小都是一樣的,就是splitSize,也就是maxThreeBytes,它的值是 255 * 255 * 255。
最后一個(gè)字節(jié)中存放的就是數(shù)據(jù)包的編號(hào)了,從0開始遞增。
在標(biāo)識(shí)位設(shè)置完畢之后,就可以把255 * 255 * 255大小的數(shù)據(jù)從我們準(zhǔn)備好的待發(fā)送數(shù)據(jù)包中copy出來了,注意,前4位已經(jīng)是標(biāo)識(shí)位了,所以應(yīng)該從第五個(gè)位置開始copy數(shù)據(jù)

 # 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.代碼的可讀性和可維護(hù)性
2.最重要的一點(diǎn)是極大地提高了安全性,可以防止SQL注入

然后我又看了一些網(wǎng)上其他人的經(jīng)驗(yàn),基本和我的判斷一致,有兩點(diǎn)要特別提請(qǐng)大家注意:

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

2.即便PreparedStatement不能提高性能,在少數(shù)使用時(shí)甚至?xí)档托剩匀粦?yīng)該使用PreparedStatement!因?yàn)槠渌? 處實(shí)在是太大了!當(dāng)然,當(dāng)SQL查詢比較復(fù)雜時(shí),可能PreparedStatement好處會(huì)更大,只是我沒有測(cè)試,不敢肯定。

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





]]>
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 支持,很棒。



]]>
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

  • 避免對(duì)shared_ptr所管理的對(duì)象的直接內(nèi)存管理操作,以免造成該對(duì)象的重釋放
    shared_ptr并不能對(duì)循環(huán)引用的對(duì)象內(nèi)存自動(dòng)管理(這點(diǎn)是其它各種引用計(jì)數(shù)管理內(nèi)存方式的通病)。

  • 不要構(gòu)造一個(gè)臨時(shí)的shared_ptr作為函數(shù)的參數(shù)。
    如下列代碼則可能導(dǎo)致內(nèi)存泄漏:
    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

    ]]>
    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 其實(shí)沒有.h也能很好的工作,但是當(dāng)你發(fā)現(xiàn)一個(gè)外部鏈接的函數(shù)或外部變量,需要許多份

    聲明,因?yàn)閏++這種語言,在使用函數(shù)和變量的時(shí)候,必須將他聲明,為何要聲明?聲明之后才

    知道他的規(guī)格,才能更好的發(fā)現(xiàn)不和規(guī)格的部分.你別妄想一個(gè)編譯單元,會(huì)自動(dòng)從另一個(gè)

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

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

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


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

    用#include包含進(jìn)去便可.以后需要修改,也只是修改一份內(nèi)容.


    請(qǐng)注意不要濫用.h,.h里面不要寫代碼,.h不是.cpp的倉(cāng)庫(kù),什么都塞到里面.

    如果在里面寫代碼,當(dāng)其他.cpp包含他的時(shí)候,就會(huì)出現(xiàn)重復(fù)定義的情況,

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

    然后你發(fā)現(xiàn)b.cpp需要用到a.cpp里面的一個(gè)函數(shù),就很高興的將a.h包含進(jìn)來.

    注意,#include并不是什么申請(qǐng)指令,他就是將指定的文件的內(nèi)容,原封不動(dòng)的拷貝

    進(jìn)來.


    這時(shí)候?qū)嶋H上a.cpp和b.cpp都有一個(gè)func()函數(shù)的定義.

    如果這個(gè)函數(shù)是內(nèi)部鏈接static的話,還好,浪費(fèi)了一倍空間;

    如果是extern,外部鏈接(這個(gè)是默認(rèn)情況),那么根據(jù)在同一個(gè)程序內(nèi)不可出現(xiàn)

    同名函數(shù)的要求,連接器會(huì)毫不留情給你一個(gè)連接錯(cuò)誤!

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





    ]]>
    整理軟件架構(gòu)相關(guān)的知識(shí)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
    軟件設(shè)計(jì)思想的發(fā)展邏輯,大致是提高抽象程度 ,separation of concern 程度。
        fn(design )=  fn1(abstraction )+ fn2(separation of concern).

    由于大規(guī)模數(shù)據(jù)處理時(shí)代的來臨,下一代設(shè)計(jì)范式的重點(diǎn):
    1.    將是如何提高distributed(--concurrent) programing 的抽象程度 和 separation of concern 程度。
    2.    dsl ,按照以上的公式,也確實(shí)是一個(gè)好的方向。
    十二.    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





    ]]>
    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






    ]]>
    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


     










    ]]>
    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 大致上是:過程式、面向?qū)ο蟆⒔M件、面向服務(wù)。
    未來呢?我忘記了,抑或是 dsl ?

    我以往也沒有自己的認(rèn)識(shí),不過,最近我有自己的看法

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


    由于大規(guī)模數(shù)據(jù)處理時(shí)代的來臨,下一代設(shè)計(jì)范式的重點(diǎn):

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

    對(duì)于英文詞語的使用,是因?yàn)椋蚁敫鼙磉_(dá)我的意思,不至于誤解。見諒。
    歡迎批評(píng)指正!

    ]]>
    主站蜘蛛池模板: 亚洲欧洲在线播放| 国产精品偷伦视频免费观看了| 日本一道一区二区免费看| 乱淫片免费影院观看| 久久精品a亚洲国产v高清不卡 | aaa毛片免费观看| 亚洲欧洲日产国码www| 免费一级做a爰片性色毛片| 暖暖免费日本在线中文| 亚洲综合色一区二区三区| 在线日韩日本国产亚洲| 人成午夜免费视频在线观看| 一级毛片免费观看不收费| 亚洲国产精品线观看不卡| 亚洲国产天堂久久综合| 欧洲黑大粗无码免费| A级毛片成人网站免费看| 国产精品亚洲专区在线观看| 国产aⅴ无码专区亚洲av麻豆| 亚洲精品免费在线| 亚洲国产免费综合| 午夜在线a亚洲v天堂网2019| 亚洲AV永久无码区成人网站| 日韩激情淫片免费看| 色欲国产麻豆一精品一AV一免费| 狼色精品人妻在线视频免费| 亚洲人妖女同在线播放| 国产亚洲精久久久久久无码77777| 亚洲第一成年免费网站| 久久免费视频观看| 日日躁狠狠躁狠狠爱免费视频| 亚洲乱码一二三四区麻豆| 国产精品亚洲精品日韩已满| 免费又黄又爽又猛的毛片| 中国在线观看免费高清完整版| 精品国产一区二区三区免费| 一级成人a做片免费| WWW亚洲色大成网络.COM | 亚洲精品国产精品乱码不卡√ | 亚洲mv国产精品mv日本mv| 水蜜桃亚洲一二三四在线 |