国产精品热久久无码av,久久无码人妻精品一区二区三区,久久婷婷五月综合97色一本一本http://www.shnenglu.com/tangxinfa/category/5923.html開發(fā)者之旅zh-cnTue, 28 Feb 2012 09:34:50 GMTTue, 28 Feb 2012 09:34:50 GMT60node.js tipshttp://www.shnenglu.com/tangxinfa/articles/nodejs_tips.html唐新發(fā)唐新發(fā)Sat, 18 Feb 2012 04:25:00 GMThttp://www.shnenglu.com/tangxinfa/articles/nodejs_tips.htmlhttp://www.shnenglu.com/tangxinfa/comments/165904.htmlhttp://www.shnenglu.com/tangxinfa/articles/nodejs_tips.html#Feedback0http://www.shnenglu.com/tangxinfa/comments/commentRss/165904.htmlhttp://www.shnenglu.com/tangxinfa/services/trackbacks/165904.htmlQ. 在項(xiàng)目根目錄下執(zhí)行sudo npm link xxx即可。


唐新發(fā) 2012-02-18 12:25 發(fā)表評論
]]>
Protocol Buffer學(xué)習(xí)筆記http://www.shnenglu.com/tangxinfa/articles/87022.html唐新發(fā)唐新發(fā)Sun, 07 Jun 2009 15:02:00 GMThttp://www.shnenglu.com/tangxinfa/articles/87022.htmlhttp://www.shnenglu.com/tangxinfa/comments/87022.htmlhttp://www.shnenglu.com/tangxinfa/articles/87022.html#Feedback0http://www.shnenglu.com/tangxinfa/comments/commentRss/87022.htmlhttp://www.shnenglu.com/tangxinfa/services/trackbacks/87022.htmlProtocol Buffer,這個(gè)東西基本上附合我的要求,可以序列化成高效的二進(jìn)制格式,如果能夠提供序列化成文本(如:XML)的功能,會便于調(diào)試。
手冊上有一段話初看讓人疑惑:
Protocol Buffers and O-O Design Protocol buffer classes are basically dumb data holders (like structs in C++); they don't make good first class citizens in an object model. If you want to add richer behaviour to a generated class, the best way to do this is to wrap the generated protocol buffer class in an application-specific class. Wrapping protocol buffers is also a good idea if you don't have control over the design of the .proto file (if, say, you're reusing one from another project). In that case, you can use the wrapper class to craft an interface better suited to the unique environment of your application: hiding some data and methods, exposing convenience functions, etc. You should never add behaviour to the generated classes by inheriting from them. This will break internal mechanisms and is not good object-oriented practice anyway.
大意是不要從它生成的Message類進(jìn)行派生,以便加入一些行為函數(shù),而應(yīng)該采用包裝(wrap)的方式,說白了就是組合(在你的類中放一個(gè)生成的Message類成員變量)。通過查看郵件列表,載錄以下詳細(xì)解釋:
 *如果進(jìn)行派生,那么你的類中會混入Protocol Buffer生成的一些方法,而這些方法將來還可能會變化,
 這就意味著你的類將依賴Protocol Buffer的實(shí)現(xiàn)。用設(shè)計(jì)相關(guān)的術(shù)語就是:你繼承了實(shí)現(xiàn),你把業(yè)務(wù)和數(shù)據(jù)混在了一起。


唐新發(fā) 2009-06-07 23:02 發(fā)表評論
]]>
gsoap學(xué)習(xí)筆記http://www.shnenglu.com/tangxinfa/articles/78344.html唐新發(fā)唐新發(fā)Mon, 30 Mar 2009 02:37:00 GMThttp://www.shnenglu.com/tangxinfa/articles/78344.htmlhttp://www.shnenglu.com/tangxinfa/comments/78344.htmlhttp://www.shnenglu.com/tangxinfa/articles/78344.html#Feedback0http://www.shnenglu.com/tangxinfa/comments/commentRss/78344.htmlhttp://www.shnenglu.com/tangxinfa/services/trackbacks/78344.html  它們是自動實(shí)現(xiàn)了的函數(shù)。
  stub由client使用,skeleton由server在收到請求時(shí)自動調(diào)用。
  考慮最基本的通信:client->network->server
  在network的兩個(gè)邊界分別就是stub和skeleton
  gsoap通過生成stub和skeleton,讓我們的client只需調(diào)用一下stub函數(shù),而server只需要實(shí)現(xiàn)skeleton函數(shù)內(nèi)部調(diào)用的對應(yīng)的處理函數(shù)。


唐新發(fā) 2009-03-30 10:37 發(fā)表評論
]]>
log4cxx使用心得http://www.shnenglu.com/tangxinfa/articles/log4cxx_tips.html唐新發(fā)唐新發(fā)Tue, 17 Jun 2008 02:01:00 GMThttp://www.shnenglu.com/tangxinfa/articles/log4cxx_tips.htmlhttp://www.shnenglu.com/tangxinfa/comments/53660.htmlhttp://www.shnenglu.com/tangxinfa/articles/log4cxx_tips.html#Feedback0http://www.shnenglu.com/tangxinfa/comments/commentRss/53660.htmlhttp://www.shnenglu.com/tangxinfa/services/trackbacks/53660.html
  • 簡介
apache出品必屬精品。正宗c++日志庫,與log4j一脈相承。
http://logging.apache.org/log4cxx/index.html
  • 下載、編譯、安裝
打算安裝到${HOME}/libs目錄下:
cd ~/libs
wget http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.4.tar.bz2
tar xjvf apr-1.4.4.tar.bz2
cd apr-1.4.4
./configure --prefix=${HOME}/libs && make && make install
cd ..
wget http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.3.11.tar.bz2
tar xjvf apr-util-1.3.11.tar.bz2
cd apr-util-1.3.11
./configure --prefix=${HOME}/libs --with-apr=${HOME}/libs && make && make install
cd ..
wget http://apache.etoak.com//logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz
tar xzvf
apache-log4cxx-0.10.0.tar.gz
cd apache-log4cxx-0.10.0
./configure --with-charset=utf-8 --prefix=${HOME}/libs --with-apr=${HOME}/libs --with-apr-util=${HOME}/libs && make && make install


  • 使用例子
hello.cpp:
#include?"log4cxx/logger.h"
#include?
"log4cxx/propertyconfigurator.h"

static?log4cxx::LoggerPtr?logger(log4cxx::Logger::getLogger("hello"));

int?main(int?argc,?char?*argv[])
{
????????log4cxx::PropertyConfigurator::configure(
"./log4cxx_hello.properties");
??????? LOG4CXX_INFO(logger,?
"你好,log4cxx!");
????????
return?0;
}

log4cxx_hello.properties:
log4j.rootLogger=debug,?R

log4j.appender.stdout
=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout
=org.apache.log4j.PatternLayout

#?Pattern?to?output?the?caller's?file?name?and?line?number.
log4j.appender.stdout.layout.ConversionPattern
=%5p?[%t]?(%F:%L)?-?%m%n

log4j.appender.R
=org.apache.log4j.RollingFileAppender
log4j.appender.R.File
=./hello.log

log4j.appender.R.MaxFileSize
=100KB
#?Keep?one?backup?file
log4j.appender.R.MaxBackupIndex
=10

log4j.appender.R.layout
=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern
=%5p?%c?[%t]?(%F:%L)?-?%m%n

g++ -o hello hello.cpp -I${HOME}/libs/include ${HOME}/libs/lib/liblog4cxx.a ${HOME}/libs/lib/libaprutil-1.a ${HOME}/libs/lib/libapr-1.a? -lexpat -lpthread

  • 注意事項(xiàng)
1,配置的MaxBackupIndex不得過大,log4cxx編譯時(shí)限制了它的大小(大概十多個(gè)),一個(gè)日志文件寫滿后會重命名所有已有的日志文件,
這個(gè)限制避免性能問題,可以通過設(shè)置大一點(diǎn)的MaxFileSize來保存更多日志,否則就要在編譯時(shí)改大一點(diǎn)了。
參考:http://objectmix.com/apache/684503-urgent-log4cxx-large-window-sizes-not-allowed.html

  • 使用技巧
1,決定配置文件的格式(xml,property)。以使用相應(yīng)的配置器(Configurator)裝入配置文件。
???? xml雖較property格式繁鎖,支持的配置面更全,而property格式的配置文件使用更簡單,容易在網(wǎng)上找到現(xiàn)成的配置文件。
2,logger命名。
???? logger名稱反映了軟件模塊,如果有代表軟件模塊的類,則在類中包含以該類類名命名的logger對象,該模塊功能相關(guān)代碼通過該logger進(jìn)行日志記錄。
另外可將logger對象作為全局變量,方便使用,特別是當(dāng)軟件模塊較松散,并無對應(yīng)的封裝類時(shí)。
3,在代碼中適當(dāng)?shù)胤胖萌罩敬a。引用適當(dāng)?shù)娜罩緦ο螅瑢θ罩具M(jìn)行適當(dāng)分級。
4,余下的工作就是修改配置文件,對日志進(jìn)行控制了。
  使用配置文件的好處就是可以方便地配置日志而不需要修改源代碼,可以在配置文件中方便配置日志過濾、格式、日志目的地。

  • 體驗(yàn)
  之前產(chǎn)品中用到的是log4cplus,但是常常有寫日志崩潰的情況出現(xiàn),使用log4cxx正是用于解決該崩潰。


唐新發(fā) 2008-06-17 10:01 發(fā)表評論
]]>
久久免费视频1| 狠狠人妻久久久久久综合蜜桃| 99久久久精品免费观看国产| 久久久久人妻精品一区三寸蜜桃| 亚洲综合精品香蕉久久网| 午夜精品久久久久久| 久久精品国产一区| 91精品国产乱码久久久久久| 亚洲精品乱码久久久久久蜜桃图片| 久久无码一区二区三区少妇| 99久久国产亚洲高清观看2024| 久久夜色tv网站| 久久国产高清字幕中文| 2021久久精品国产99国产精品| 久久精品天天中文字幕人妻| 久久亚洲美女精品国产精品| 亚洲AV日韩精品久久久久久| 久久久久人妻精品一区| 97久久超碰国产精品旧版| 波多野结衣中文字幕久久| 国产精品99久久精品| 欧美久久精品一级c片片| 中文字幕一区二区三区久久网站| 久久免费高清视频| 九九久久精品无码专区| 亚洲一级Av无码毛片久久精品| 中文精品99久久国产 | 色婷婷噜噜久久国产精品12p | 久久婷婷五月综合97色 | 一本色道久久88精品综合| 亚洲国产精品久久久天堂| 久久99国内精品自在现线| 青青国产成人久久91网| 中文字幕精品无码久久久久久3D日动漫 | 久久久久国色AV免费看图片 | 久久精品无码一区二区日韩AV| 久久精品女人天堂AV麻| 色婷婷久久综合中文久久蜜桃av| 精品久久香蕉国产线看观看亚洲 | 久久久国产视频| 久久精品国产亚洲AV高清热|