Django絕對簡明手冊
http://wiki.woodpecker.org.cn/moin/DjangoZipManual
Django 是一個高級 Python web framework,它鼓勵快速開發和干凈的、MVC設計。它包括一個模板系統,對象相關的映射和用于動態創建管理界面的框架。Django遵守BSD版權。
Javascript 絕對簡明手冊
http://wiki.woodpecker.org.cn/moin/jsInAWordJavascript和C++,Java,Python一樣是一種博大精深的編程語言.
Docbook美化Css完美版,Css就在Css文件夾中
點擊下載
Docbook用來生成文檔不錯,不過寫起來太煩.
幸好http://wiki.woodpecker.org.cn/的wiki可以把wiki文檔轉換為Docbook的代碼,而寫Wiki格式的文檔就舒服多了.
我做了這個Css是為了讓Docbook生成的文檔讀起來舒服一點
大家可以配合CDBE(Chinese DocBook Environment(CDBE)
)使用,寫文檔也很享受:)
http://manual.vingel.com/docs/data/20051013100319/index.html
Boost.Asio是利用當代C++的先進方法,跨平臺,異步I/O模型的C++網絡庫
現在完成了的小節
?? 1. 網絡庫:VC2005注意
?? 2. 同步Timer
?? 3. 異步Timer
?? 4. 回調函數的參數
?? 5. 成員函數作為回調函數
?? 6. 多線程回調同步
文章見
http://wiki.woodpecker.org.cn/moin/Boost文章是用wiki寫的,有不妥大家可以直接改正,謝謝。
找算法,有數據庫
GOOGLE上的算法太多太雜,
在專門的數據庫中找就方便多了.
我在學校是可以全文下載的.
http://portal.acm.org/portal.cfm
ACM(Association for Computing Machinery,美國計算機學會)創立于1947年,目前提供的服務遍及100余個國家,會員人數達80,000多位專業人士,并于1999年起開始提供電子數據庫服務――ACM Digital Library全文數據庫。ACM Digital Library全文數據庫,收錄了美國計算機協會(Association for Computing Machinery)的各種電子期刊、會議錄、快報等文獻,由iGroup Asia Pacific Ltd代理。2002年10月21日iGroup公司在清華大學圖書館建立了鏡像服務器。目前,我校可以訪問國內站點和美國主站點。
http://ieeexplore.ieee.org
IEEE/IEE Electronic Library(IEL)數據庫提供美國電氣電子工程師學會(IEEE)和英國電氣工程師學會(IEE)出版的229種期刊、8739種會議錄、1646種標準的全文信息。
????? IEEE和IEE是世界知名學術機構。IEL數據庫包含了二者的所有出版物,其內容計算機、自動化及控制系統、工程、機器人技術、電信、運輸科技、聲學、納米、新材料、應用物理、生物醫學工程、能源、教育、核科技、遙感等許多專業領域位居世界第一或前列。
????? IEL更新速度很快,一般每周更新一次,每月增加25,000篇最新文獻。而且,每年IEEE還會有新的出版物加入到IEL中去。
一道據說是Google的面試題
題目:有一個整數n,寫一個函數f(n),返回0到n之間出現的"1"的個數。比如f(13)=6 ; f(11)=4,算出f(n)=n的n(如f(1)=1)?
我用python寫了一份代碼,還改寫了一份c++代碼
python源代碼
def count(i):
"""count form 0 to this number contain how many 1
1.you shoul know pow(10,n)-1 contain 1 number is n*pow(10,n-1)
2.use 32123 for example:
from 10000 to 32123 the first digit contain 1 number is 1(0000-9999) = pow(10,4) ,
and from 10000 to 30000 the rest digit contain 1 number is ( firstDigit*4*pow(10,4-1) )
so count(32123)=pow(10,4)+( firstDigit*4*pow(10,4-1) ) + count(2123)
print count(1599985)
1599985
print count(8)
1
"""
if i==0:
return 0
if 9>=i>=1:
return 1
digit=len(str(i))
firstDigit=int(str(i)[0])
if firstDigit>1:
now=pow(10,digit-1)
else:
now=int(str(i)[1:])+1
now+=(digit-1)*pow(10,digit-2) * firstDigit
return now+count(int(str(i)[1:]))
def little(i):
count_i=count(i)
if i<count_i:
#i reduce 1 , count_i at most reduce 9 ,
#so you at least reduce (count_i-i)/(9-1) to reach i==count_i
#用位數更快
if (count_i-i)/8>1:
return i-(count_i-i)/8
if i>count_i:
#i reduce 1 , count_i at least reduce 0 , so you at least reduce (i-count_i) to reach i==count_i
return count_i
return i-1
def run(i=10*10**(10-1)):
while i>0:
# print i,'=>i-count_i= ',i-count(i)
if i==count(i):
print i,','
i=little(i)
def fastrun(t=10*10**(10-1)):
"""This just list out all this king of element :) But it is fastest and most useful"""
all=[1, 199981, 199982, 199983, 199984, 199985, 199986, 199987, 199988, 199989, 199990, 200000, 200001, 1599981, 1599982, 1599983, 1599984, 1599985, 1599986, 1599987, 1599988, 1599989, 1599990, 2600000, 2600001, 13199998, 35000000, 35000001, 35199981, 35199982, 35199983, 35199984, 35199985, 35199986, 35199987, 35199988, 35199989, 35199990, 35200000, 35200001, 117463825, 500000000, 500000001, 500199981, 500199982, 500199983, 500199984, 500199985, 500199986, 500199987, 500199988, 500199989, 500199990, 500200000, 500200001, 501599981, 501599982, 501599983, 501599984, 501599985, 501599986, 501599987, 501599988, 501599989, 501599990, 502600000, 502600001, 513199998, 535000000, 535000001, 535199981, 535199982, 535199983, 535199984, 535199985, 535199986, 535199987, 535199988, 535199989, 535199990, 535200000, 535200001, 1111111110]
for i in all:
if(t>=i):
print i
print "first test with run() to:111111111"
run(111111111)
print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
print "2st test with run() to:10^10"
run()
print '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>'
print "3st test with fastrun() to:10^10 , Fastest!!!"
fastrun()
C++代碼
-------------------------------------------------------------------------------
#include <cmath>
#include <iostream>
using namespace std;
unsigned long long mypow(int a,int b)
{
unsigned long long sum=1;
for(int i=0;i<b;i++)
sum*=a;
return sum;
}
unsigned long long count(unsigned long long i){
/*
count form 0 to this number contain how many 1
1.you shoul know pow(10,n)-1 contain 1 number is n*pow(10,n-1)
2.use 32123 for example:
from 10000 to 32123 the first digit contain 1 number is 1(0000-9999) = pow(10,4) ,
and from 10000 to 30000 the rest digit contain 1 number is ( firstDigit*4*pow(10,4-1) )
so count(32123)=pow(10,4)+( firstDigit*4*pow(10,4-1) ) + count(2123)
*/
if(i==0)return 0;
if(9>=i and i>=1)return 1;
int digit=1;
unsigned long long firstDigit=i;
while(firstDigit>=10){
firstDigit/=10;
++digit;
}
unsigned long long now;
unsigned long long rest=static_cast<unsigned long long int>(i-(firstDigit*mypow(10,digit-1)));
if(firstDigit>1)now=static_cast<unsigned long long int>(mypow(10,digit-1));
else{now=rest+1;}
now+=static_cast<unsigned long long int>((digit-1)*mypow(10,digit-2) * firstDigit);
return (now+count(rest));
}
unsigned long long little(unsigned long long i)
{
unsigned long long count_i=count(i);
if(i<count_i){
//i reduce 1 , count_i at most reduce 9 , so you at least reduce
//用位數更快
(count_i-i)/(9-1) to reach i==count_i
if ((count_i-i)/8>1)return i-(count_i-i)/8;
}
if(i>count_i){
//i reduce 1 , count_i at least reduce 0 , so you at least reduce (i-count_i) to reach i==count_i
return count_i;
}
return i-1;
}
void run(unsigned long long i=pow(10.0f,10)){
while (i>0){
// print i,'=>i-count_i= ',i-count(i)
if(i==count(i))cout<<i<<"=>"<<count(i)<<'\n';
i=little(i);
}
cout<<"run() finished\n\n";
}
void fastrun(unsigned long long t=pow(10.0f,10)){
//This just list out all this king of element :) But it is fastest and most useful
const unsigned long long all[]={1, 199981, 199982, 199983, 199984, 199985, 199986, 199987, 199988, 199989, 199990, 200000, 200001, 1599981, 1599982, 1599983, 1599984, 1599985, 1599986, 1599987, 1599988, 1599989, 1599990, 2600000, 2600001, 13199998, 35000000, 35000001, 35199981, 35199982, 35199983, 35199984, 35199985, 35199986, 35199987, 35199988, 35199989, 35199990, 35200000, 35200001, 117463825, 500000000, 500000001, 500199981, 500199982, 500199983, 500199984, 500199985, 500199986, 500199987, 500199988, 500199989, 500199990, 500200000, 500200001, 501599981, 501599982, 501599983, 501599984, 501599985, 501599986, 501599987, 501599988, 501599989, 501599990, 502600000, 502600001, 513199998, 535000000, 535000001, 535199981, 535199982, 535199983, 535199984, 535199985, 535199986, 535199987, 535199988, 535199989, 535199990, 535200000, 535200001, 1111111110};
for(int i=0;i!=83;++i){
if(t>=all[i])cout<<all[i]<<'\n';
}
cout<<"fastrun() finished\n\n";
}
int main(int argc, char *argv[])
{
for(;;)
{
unsigned long long i;
cout<<"please input a number:";
cin>>i;
cout<<"run():\n";
run(i);
cout<<"fastrun():\n";
fastrun(i);
}
system("PAUSE");
return EXIT_SUCCESS;
}
摘要: http://wiki.woodpecker.org.cn/moin/PyAbsolutelyZipManual最新版
PyAbsolutelyZipManual
Python 絕對簡明手冊 -- zsp007@gmail.com ::-- ZoomQuiet [2006-09-15 04:35:33]
Py2.5 絕對簡明手冊
...
閱讀全文
Bjam簡明教程
Bjam是Boost中一部分,但可以單獨下載,我個人覺得比make方便.
單獨下載地址
http://sourceforge.net/project/showfiles.php?group_id=7586&package_id=80982
單獨下載Bjam后,設置環境變量BOOST_BUILD_PATH到解壓目錄.
然后要在中user-config.jam選擇編譯器(就是把注釋去掉),
比如
# Configure gcc (default version)
# using gcc ;
改為
# Configure gcc (default version)
using gcc ;
在Jamroot文件中可以定義要編譯的文件和輸出的文件名的target.
如:
exe hello : hello.cpp ;
exe hello2 : hello.cpp ;
可以只編譯特定的target,如
bjam hello2
bjam可以選擇編譯版本,如
bjam debug release
bjam release
可以清理指定的版本/target
bjam --clean debug release
bjam --clean hello2
可以指定一些編譯方式
bjam release inlining=off debug-symbols=on
可以指定保含頭文件的目錄
exe hello
: hello.cpp
: <include>boost <threading>multi
;
可以為整個工程指定頭文件
project
: requirements <include>/home/ghost/Work/boost <threading>multi
;
exe hello : hello.cpp ;
exe hello2 : hello.cpp ;
Boost.Asio 0.37教程 Timer.1(翻譯自Boost.Asio 0.37的文檔)
原文http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/
翻譯:張沈鵬 http://blog.csdn.net/zuroc or http://www.shnenglu.com/zuroc
Timer.1 - 同步Timer
本章介紹asio如何在定時器上進行阻塞等待(blocking wait).
實現,我們包含必要的頭文件.
所有的asio類可以簡單的通過include "asio.hpp"來調用.
#include <iostream>
#include <boost/asio.hpp>
此外,這個示例用到了timer,我們還要包含Boost.Date_Time的頭文件來控制時間.
#include <boost/date_time/posix_time/posix_time.hpp>
使用asio至少需要一個boost::asio::io_service對象.該類提供了訪問I/O的功能.我們首先在main函數中聲明它.
int main()
{
boost::asio::io_service io;
下一步我們聲明boost::asio::deadline_timer對象.這個asio的核心類提供I/O的功能(這里更確切的說是定時功能),總是把一個io_service對
象作為他的第一個構造函數,而第二個構造函數的參數設定timer會在5秒后到時(expired).
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
這個簡單的示例中我們演示了定時器上的一個阻塞等待.就是說,調用boost::asio::deadline_timer::wait()的在創建后5秒內(注意:不是等待
開始后),timer到時之前不會返回任何值.
一個deadline_timer只有兩種狀態:到時,未到時.如果boost::asio::deadline_timer::wait()在到時的timer上調用,會立即return.
t.wait();
最后,我們輸出理所當然的"Hello, world!"來演示timer到時了.
std::cout << "Hello, world!\n";
return 0;
}
完整的代碼:
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main()
{
boost::asio::io_service io;
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
t.wait();
std::cout << "Hello, world!\n";
return 0;
}
Boost.Asio 0.37簡介(翻譯自Boost.Asio 0.37的文檔的首頁)
原文:http://asio.sourceforge.net/boost_asio_0_3_7/libs/asio/doc/
翻譯:張沈鵬 http://blog.csdn.net/zuroc or http://www.shnenglu.com/zuroc
Boost.Asio是利用當代C++的先進方法,跨平臺,異步I/O模型的C++網絡庫.
入門
這個教程介紹了客戶端-服務器端的一些基本概念,同時給出了一個示例的小程序.
小程序可以啟示Boost.Asio在復雜程序中的應用.
附注
Boost.Asio的大部分功能沒有必要編譯Boost中的其他庫,僅僅需要它們的頭文件.然而read_until和async_read_until的重載需要Boost.Regex庫(注意:MSVC 或 Borland C++的用戶需要在用戶設置中加入-DBOOST_ALL_NO_LIB來防止與Boost.Date_Time和Boost.Regex的自動鏈接)
需要OpenSSL才可以啟用SSL支持,但Asio的其他部分不需要它.
已經測試的平臺和編譯器:
* Win32 using Visual C++ 7.1 and Visual C++ 8.0.
* Win32 using Borland C++Builder 6 patch 4.
* Win32 using MinGW.
* Win32 using Cygwin. (__USE_W32_SOCKETS must be defined.)
* Linux (2.4 or 2.6 kernels) using g++ 3.3 or later.
* Solaris using g++ 3.3 or later.
* Mac OS X 10.4 using g++ 3.3 or later.
* QNX Neutrino 6.3 using g++ 3.3 or later.
原理:
Boost.Asio可以讓程序員用C++的程序體系取代那種需要使用system底層操作的網絡編程.特別的值得注意的是,Boost.Asio試圖解決一下一些問題.
*可移植性.
庫可以支持并提供一系列常用操作系統的一致行為.
*可測量性:
庫允許并鼓勵開發者在網絡編程中檢測成百或成千并發的連接數.庫在各個平臺的實現要用這種機制來最優的實現這種可測量性.
*效率:
庫要支持 分散-聚合I/O(scatter-gather I/O) 之類的技術,允許協議的 最小量(minimise) 的數據交換.
*伯克利(Berkeley) sockets模型:
該模型的API被廣泛的采用和理解,被許多文獻介紹.其他程序語言通常使用類似網絡API的接口.
*易用:
降低新手使用該工具的入門障礙,勝于框架和模式.也就是說,試圖最簡化前端的學習,僅僅需要理解一些基本規則和指導方針.此外,庫的用戶僅需要理解使用到的特定函數.
*可以作為進一步抽象的基礎:
庫應該允許其他庫的開發者進行更高層的抽象,比如:實現常用的協議Http.
盡管當前的Boost.Asio的實現主要關注的是網絡,但異步I/O可以被擴展到其他系統資源,比如 文件.
由boost網絡庫說起...
文末這篇Email是2006-03-22的,而今天已經2006-8-5日了,我看到asio的soureforge的主頁上說.
20 June 2006 - asio version 0.3.7 (development) released.
This release includes major interface changes arising out of the Boost review of asio.
The asio library was accepted into Boost and will appear in a future Boost release.
不過Boost release到現在還是
boost 1.33.1 December 5, 2005.
asio不知道還要等到什么時候才在Boost release放出,真是望穿秋水啊.
C++0x標準也是這樣,等就一個字.
由此而觀,國外C++社區真是小心謹慎,穩定第一,在他們的理念中C++更類似于一件藝術品.反觀Java,.Net的日新月異,可以說是功能第一,方便第二,速度第三.商業與學院的區別真是不辨自明.
而在我的理念中,對于面向普通桌面用戶(不是專業/行業軟件)的由于功能的類似(即使你有一個很有創意的軟件,不出幾天就會有軟件的翻版),界面和速度可能就是生存的關鍵.對與C++的Gui這一塊,我感覺是極端不適應(也許是我水平太差),幸而firefox和Google的一些小程序提供有了一種新的界面思路:一個后臺服務+一個微型web服務器+網頁界面.利用Ajax技術可以寫出很好界面來(我寫了一個默寫單詞軟件網頁界面的試驗品,兼容firefox和IE6,下載地址:
http://groups.google.com/group/go2program/browse_thread/thread/5ee588253b70df77
中的附件 source.rar
)
所有在cpp@codingnow.com中高人的指點下我知道了asio.從而有了上面這些感慨.
下面是我翻譯的關于宣布asio成為boost一員的Email,這是我第一次逐字逐句的翻譯.水平有限(6級沒過),望多指教.
原文:Jeff Garland
翻譯:張沈鵬 http://blog.csdn.net/zuroc or http://www.shnenglu.com/zuroc
大家好-
我很高興的宣布asio(注:網絡庫)正式成為boost庫的一員.正如其他Boost庫的審查一樣,asio的審查產生了許多的討論,觀點和爭辯.評價歸結于贊美,包括在工程中成功運用的例子,嚴肅的(庫結構)設計方面的意見.公平的說,在我看來,asio是了一個通用,可靠的庫,已經可以被加入Boost庫--提供了開發者強烈要求的關鍵領域的應用.
當然,一如往常,asio還談不上完美--不少關鍵性的問題這次審評并沒有考慮.在此我僅列舉審評中許多的意見中的一部分:
- 修正動態內存分配的問題
- 更改接口以在運行時ipv4和ipv6的無縫切換
- 改進以適應強類型的socket接口(????什么意思,請高手指教)
Chris已經獲知了大量關于動態內存分的配解決方案,并且我會就接口和其他方面的問題在Boost的郵件列表上進行跟蹤討論以期能盡善盡美.
其他可以作為進一步增強重要的改進包括:
- 盡可能減少c風格的接口
- 和iostream進一步的整合
- 性能優化
- 改進文檔(不要成為Boost w/o this one //???怎么翻譯)
Chris has a much longer list of changes garnered from the review and is well on his way to addressing many of them.
Chris有著一個更長的針對審評意見的改進計劃表,同時他與建議者有著很好的連續.
注意,有幾個討論是關于性能的,這是asio所涉及領域的核心問題.其中一個就是上面提到的動態內存分配.一般而言,審評者對此的期望很高.然而,在審評討論之后,在我的印象中許多開發者發現asio只要改進內存分配,它的表現就已經足夠勝任重要的工程.(但)我希望Chris在開發asio余下的時間里,可以采納審評者的一些其他方面的性能意見.
再一次我為Boost社區延遲公布審評結果而抱歉.這次推遲完全是由于我的時間安排問題,與asio無關.再次感謝所有的審評者的貢獻,尤其向Chris為Boost添加asio而作出的巨大努力致敬.
原文:
From: Jeff Garland
All -
I'm pleased to announce that asio has been accepted into Boost. As usual with a Boost review, the asio review generated plenty of discussion, issues, and controversy. Comments ranged from high praise,including success stories of projects in production, to serious design concerns and issues. On balance, in my judgment, asio provides a generally solid library that is ready for inclusion into the Boost library -- providing key functionality in an area that developers have a strong need.
Of course, like anything else, asio is not perfect -- a number of key issues were uncovered during the review. In terms of required changes I'm only going to cite a few:
- Fixes to dynamic memory allocation issues
- Interface changes to support ipv4 and ipv6 seamlessly at runtime
- Improvements to support strongly typed socket interfaces
Chris has communicated a couple possible solutions to the memory allocation issue and I'll ask that the interface and other changes for this issue continue to be discussed on the Boost list so consensus can be achieved on the best resolution.
Other key improvements that should be explored as future enhancements include:
- Possible removal of some of the c-style interfaces
- Exploration of higher level iostream integrations
- Performance improvements
- Improved documentation (wouldn't be Boost w/o this one)
Note that there were several threads and discussions about performance,which is particularly critical for the domain covered by asio. One of the performance issues is the dynamic memory allocation issue cited above. In general, the reviewers have extremely high expectations here. However, after reviewing the discussion and library it's my belief that
many developers will find asio performance sufficient to build significant projects with only the memory allocation changes. I expect Chris will be able to address some of the other performance issues cited by reviewers in asio over time.
Once again I'll apologize to the Boost community for the delay in the review results. The delay was entirely due to my own personal scheduling issues and should not reflect on asio in any way. Thanks again to all the reviewers for their effort and especially to Chris for his tremendous effort in bringing asio to Boost!
Jeff