自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 资源 (25)
  • 收藏
  • 关注

原创 Python idioms, 2 of n

1) Don't do trivial assignment in __init__ of the classDon't:class Foo(object):     def __init__(self):        self.attr1 = 0        self.attr2 = ''        self.attr3 = []        self.at

2012-09-26 09:36:06 1324

原创 Python performance 1 of n

If you would like to improve the running performance of Python, try1) Use profile/cProfile to benchmark your program, find the possible hotspot, switch to correct data structure to solve problem etc

2012-09-25 22:43:34 495

原创 Python idioms, 1 of n

Pythonic way to solve problems .1) Sort character in a strings = 'hello'''.join(sorted(s))2) Sort listtable = [(1, 'john', 23), \         (2, 'tom', 13), \         (3, 'lucy', 25), \

2012-09-25 22:35:17 1346

原创 smart pointers - C++11, 15 of n

The smart pointers provided by C++11 is straight forward enough. So just providing the interface here for reference.1) shared_ptr2) weak_ptrLow level interfaces3) unique_ptr

2012-09-24 15:26:03 1258

原创 clock and time - C++11, 14 of n

C++11 provides chrono library to deal with clock and time.1) Durationsstd::chrono::duration twentySeconds(20);std::chrono::duration> halfAMinute(0.5);std::chrono::duration> oneMillisecond(1);

2012-09-24 14:39:40 3829

原创 ratio - C++11, 13 of n

C++11 provides ratio lib to specify compile-time fractions and to perform compile-time arithmetic with them.1) The definitiontemplate class ratio {public:    typedef ratio type;    stati

2012-09-23 21:33:21 1991

原创 Concurrency 5, atomics - C++11, 12 of n

1) The high level interfacesFootnote: compare_exchange_strong's implementation pseudocode :bool compare_exchange_strong (T& expected, T desired){    if (this->load() == expected) {

2012-09-23 16:48:19 1352

原创 Concurrency 4, condition_variable - C++11, 11 of n

1) condition_variableCalled without the predicate, both wait_for() and wait_until() return the following enumeration class values:std::cv_status::timeout if the absolute timeout happenedstd:

2012-09-23 15:56:24 1632

原创 Concurrency 3, mutex and lock - C++11, 10 of n

1) The mutex and lock2) The lock_guard3) The unique_lock4)  call_onceclass X {private:    mutable std::once_flag initDataFlag;    void initData() const;public:    data getDat

2012-09-23 15:20:17 1597

原创 Concurrency 2, thread and promise - C++11, 9 of n

1) Low level interfaces:std::thread(launch::async, ...)std::promise, it enables you to provide the data (by using one of its set_...() functions) and All member functions that set the value or e

2012-09-23 10:57:10 2272

原创 Concurrency 1, async and future - C++11, 8 of n

1) High level interfaces:async() provides an interface to let a piece of functionality, a callable object run in the background as a separate thread, if possible.Class futureExample:#inclu

2012-09-23 10:20:49 2227

原创 Random - C++11, 7 of n

Since C++11, the C++ standard library provides a random-number library. The library provides many well-known distributions, and in addition, it provides multiple engines, which are the sources of rand

2012-09-18 11:48:47 2984

原创 IO Stream

1) The class hierarchy. basic_stringbuf is the heart of the IOStream of STLDesign: The IOStream library is designed with a rigid separation of responsibilities.(a) The classes derived from basic

2012-09-16 18:59:09 1184

原创 Regex - C++11, 6 of n

1) Raw stringR"delim(...)delim", where delim is a character sequence of at most 16 basic characters except the backslash, whitespace and parentheses.2) Note regex algorithm is greedy3) Main in

2012-09-16 18:19:04 4642 4

原创 string - C++11, 5 of n

(1) Gotchasin C++98, string literals, such as 'hello', was changed to const char*. Sticktly speaking, the original type of a literal such as 'hello' is const char[6]. But this type automatically con

2012-09-16 11:21:55 1817

原创 Case ignore compare strings

Solution 1: strcasecmp#include // for strcasecmp#include strcasecmp(s1.c_str(), s2.c_str())Solution 2: equal algorithm +lambda#include #include #include equal(s1.cbegin(), s1.cend()

2012-09-15 20:12:20 1416

原创 Remove elements while looping the containers

Gotchas: When removing elements from containers, be careful not to saw off the branch on which you are sitting.There is a big danger that you will remove an element to which your iterator is refer

2012-09-15 10:01:07 530

原创 Function Adapters and Binders - C++11, 4 of n

A function adapter is a function object that enables the composition of function objects with each other, with certain values, or with special functions.Function adaptors provided by C++11.1) Th

2012-09-14 23:05:33 1249

原创 Predicates

Gotchas (Effective STL also mentions this gotcha):1) Predicates should be always stateless.2) The operator() member function should be always constclass Nth { // function object that returns t

2012-09-14 22:17:48 569

原创 iterator adaptors - stream iterators

A stream iterator is an iterator adapter that allows you to use a stream as a source or destination of algorithms. In particular, an istream iterator can be used to read elements from an input strea

2012-09-14 15:51:25 700

原创 iterator adaptors - insert iterators

Three different insert iteratorsThe trick Operations:Implementations of insert iterators usually use the following two-step trick:1) Operator * is implemented as a no-op that simply return

2012-09-14 11:30:51 452

原创 operator [] for map and multimap

Gotchas:1) When calling operator [] with a key (index) which doesn't exist in the map, a new key-value  pair gets inserted into the map automatically.std::map coll; // empty mapcout ("hello", 0)

2012-09-14 10:36:38 399

原创 URL Escape characters

2012-09-14 10:10:44 646

原创 urllib in Python 3

urllib/urllib2 in Python 2 have been cleaned up and consolidated in Python 3.Request submodule diagram

2012-09-06 15:37:16 548

原创 shared_ptr enable_shared_from_this - C++11, 3 of n

#include struct S: enable_shared_from_this{};Don't do this:S *p = new S;shared_ptr sp2 = p->shared_from_this();  // throws std::bad_weak_refDo this:shared_ptr p(new S);shared_ptr s

2012-09-03 00:14:36 1446

MPEG-4 ISO 标准 ISO/IEC14496-3 part3

MPEG-4 ISO 标准 ISO/IEC14496-3,因为文件太大,需分三卷压缩上传,这是第三部分,研究MPEG-4的朋友耐心下载

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-3 part2

MPEG-4 ISO 标准 ISO/IEC14496-3,因为文件太大,需分三卷压缩上传,这是第一部分,研究MPEG-4的朋友耐心下载

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-3 part1

MPEG-4 ISO 标准 ISO/IEC14496-3,因为文件太大,需分三卷压缩上传,这是第一部分,研究MPEG-4的朋友耐心下载

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-15

MPEG-4 ISO 标准 ISO/IEC14496-15,研究MPEG-4的朋友必备

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-14

MPEG-4 ISO 标准 ISO/IEC14496-14,研究MPEG-4的朋友必备

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-12

MPEG-4 ISO 标准 ISO/IEC14496-12,研究MPEG-4的朋友必备

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-6

MPEG-4 ISO 标准 ISO/IEC14496-6,研究MPEG-4的朋友必备

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-5

MPEG-4 ISO 标准 ISO/IEC14496-5,研究MPEG-4的朋友必备

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-1 2004 third edition

MPEG-4 ISO 标准 ISO/IEC14496-2,研究MPEG-4的朋友必备

2009-02-26

MPEG-4 ISO 标准 ISO/IEC14496-2

MPEG-4 ISO 标准 ISO/IEC14496-2文档,研究MPEG-4的朋友必备

2009-02-26

用TCP/IP进行网际互联(卷1).part1

网络编程的经典书籍,强烈推荐。三卷都上传了,请下载的朋友注意。

2008-03-20

用TCP/IP进行网际互联(卷1).part2

网络编程的经典书籍,强烈推荐。三卷都上传了,请下载的朋友注意。

2008-03-20

用TCP/IP进行网际互联(卷3).part2

网络编程的经典书籍,强烈推荐。

2008-03-19

用TCP/IP进行网际互联(卷3).part1

网络编程的经典书籍,强烈推荐。第三卷分两个分卷压缩包上传此为第一部分。

2008-03-19

用TCP/IP进行网际互联(卷3).part1

网络编程的经典书籍,强烈推荐。第三卷分两个分卷压缩包上传此为第一部分。

2008-03-19

用TCP/IP进行网际互联(卷2)

网络编程的经典书籍,强烈推荐。三卷我都会上传,请关注。

2008-03-19

C++国际标准(C++ Standard)

C++国际标准,强烈推荐学习研究C++的朋友下载

2007-10-21

inside the c++ model 深度探索C++对象模型.part1.rar(中文版

c++牛书,推荐阅读

2007-10-12

inside the c++ model 深度探索C++对象模型.part1.rar(中文版)

深入c++系列,牛书,分两部分上传

2007-10-12

the c++ Standard library C++标准程序库—自修教程与参考手册.part4.rar(中文版)

分四部分上传。上次上传了第一部分后,因网络原因不能上传第二部分。所以大家不要下以前那个版本。在次也向各位表示歉意。

2007-10-12

the c++ Standard library C++标准程序库—自修教程与参考手册.part3.rar(中文版)

分四部分上传。上次上传了第一部分后,因网络原因不能上传第二部分。所以大家不要下以前那个版本。在次也向各位表示歉意。

2007-10-11

the c++ Standard library C++标准程序库—自修教程与参考手册.part2.rar(中文版)

分四部分上传。上次上传了第一部分后,因网络原因不能上传第二部分。所以大家不要下以前那个版本。在次也向各位表示歉意。

2007-10-11

the c++ Standard library C++标准程序库—自修教程与参考手册.part1.rar(中文版)

分四部分上传。上次上传了第一部分后,因网络原因不能上传第二部分。所以大家不要下以前那个版本。在次也向各位表示歉意。

2007-10-10

the c++ Standard libraryC++标准程序库—自修教程与参考手册.pdf(中文版)

应上传文件不能超过10MB,所以分卷上传

2007-10-07

C++ net programming using ACE

C++网络编程方便的经典书籍

2007-08-11

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除