- 博客(44)
- 资源 (1)
- 收藏
- 关注
原创 makefile编写
#----------------------------------------------CC := gccSHARE := -m32 -fPIC -sharedDEFINES := -DPLATFORM_UBUNTU \-D_REENTRANT \-D_UNICODE \-DPRINTLOG #-------------------------------
2014-08-06 15:35:09
321
原创 Servlet 文件名 乱码
responseFileName = java.net.URLEncoder.encode(responseFileName, "UTF-8").replace("+", "%20"); // 处理文件乱码的问题response.setContentType("application/octet-stream"); response.setHeader("Content-dispositi
2013-08-27 11:18:35
461
原创 面试题转载
全面整理的C++面试题C++面试题1.是不是一个父类写了一个virtual 函数,如果子类覆盖它的函数不加virtual ,也能实现多态?virtual修饰符会被隐形继承的。private 也被集成,只事派生类没有访问权限而已virtual可加可不加子类的空间里有父类的所有变量(static除外)同一个函数只存在一个实体(inline除外)子类覆盖它的函数不
2013-04-25 07:38:28
364
原创 网址收藏
Inject your code to a Portable Executable filehttp://www.ntcore.com/files/inject2exe.htm#PEMakerDownloadLink1
2013-03-22 14:27:45
818
原创 that
一.定语从句及相关术语 1.定语从句:修饰一个名词或代词的从句称为定语从句,一般紧跟在它所修饰的先行词后面。 2.关系词:引导定语从句的关联词成为关系词 关系词有关系代词和关系副词。 关系代词有that, which, who, whom, whose, as 等; 关系副词有where, when, why等。 关系词常有3个作用; 1,引导定语从句。2,代替先行词。
2013-03-05 16:03:39
465
原创 网络DV算法概述
// Initialization: // NodeArray[N], except node x;for (int i = 0; i < N; ++i){ y = NodeArray[i]; if (/*y is a neighbor of x*/) { Dx(y) = c(x, y); } else { Dx(y) = 1000000; } // for e
2012-10-29 16:37:56
1143
原创 网站地址
http://technet.microsoft.com/en-us/sysinternals/bb896653http://tools.ietf.org/html/rfc768
2012-09-05 16:58:19
306
转载 sizeof()功能
sizeof()功能:计算数据空间的字节数1.与strlen()比较 strlen()计算字符数组的字符数,以"\0"为结束判断,不计算为'\0'的数组元素。 而sizeof计算数据(包括数组、变量、类型、结构体等)所占内存空间,用字节数表示。2.指针与静态数组的sizeof操作 指针均可看为变量类型的一种。所有指针变量的sizeof 操作结果均为
2012-07-20 16:19:06
390
原创 huffman 树
void CreateHT(HTNode ht[], int n){ for (int k = 0; k < 2*n - 1; ++k) { ht[k].parent = -1; ht[k].lchild = -1; ht[k].rchild = -1; } for (int i = n; i <= 2*n - 1; ++i) { double lWight = 327
2012-07-18 14:06:27
432
原创 线索化二叉树
typedef struct node { /*ElemType*/int m_Data; int m_LTag; int m_RTag; struct node* m_LChild; struct node* m_RChild;} ThreadTreeNode;ThreadTreeNode* pre = NULL;ThreadTreeNode* CreateThre
2012-07-17 14:13:21
352
原创 java 读配置文件
Properties props = new Properties(); try { props.load(Test4.class.getClassLoader().getResourceAsStream("com/cj/dp/observer/observer.properties")); } catch (IOException e) { // TODO Auto-
2012-07-12 22:52:32
231
原创 Java 环境配置
JAVA_HOME C:\Program Files\Java\jdk1.7.0_05CLASSPATH .;%JAVA_HOME%lib;%JAVA_HOME%lib\tools.jarPath ;C:\Program Files\Java\jdk1.7.0_05\bin;C:\Program Files\Java\jre7
2012-07-10 21:03:17
218
原创 树的基本知识
表示法:1. 树形 2. 文氏图 3. 凹入 4. 括号结点的度与树的度 m次树: 结点子树的个数非终端节点,分支结点,叶节点路径与路径长度: ki,ki1,ki2,…,kj, 结点数目减1(分支数目)孩子结点,双亲结点,兄弟结点结点的层次和树的高度:根节点为第一层,树的高度。森林:n(n>0)个互不相交的树的集合,n可以为1?树中的结点数等
2012-05-08 17:36:59
397
原创 解决迷宫问题, 栈和队列
#includeusing namespace std;const int M = 10, N = 10;int mg[M+1][N+1]={ /*M=10,N=10*/ {1,1,1,1,1,1,1,1,1,1}, {1,0,0,1,0,0,0,1,0,1}, {1,0,0,1,0,0,0,1,0,1}, {1,0,0,0,0,1,1,0,0,1}, {1,0,1,1,1,0
2012-05-07 12:53:38
763
原创 Expression
//while (从exp读取字符ch,ch!='\0')//{ 若ch为数字,将后续的所有数字均依次存放到postexp中,并以字符“#”标志数值串结束。//若ch为左括号“(”,则将此括号进栈到运算符栈op中。// 若ch为右括号“)”,则将运算符栈op中左括号“(”以前的运算符依次出栈并存放到postexp中,然后将左括号“(”删除。//
2012-04-26 17:07:06
304
原创 exception the last one.
T t; T t();T t(u);T t = u; // T t(T(u)); // When using return-by-value for non-builtin return types, prefer returning a const value.typedef int bool;const bool true = 1;const bool fals
2011-12-23 11:20:44
389
原创 Auto_Ptr
auto_ptr source() { return auto_ptr( new T(1) ); }void sink( auto_ptr pt ) { }void f(){ auto_ptr a( source() ); sink( source() ); sink( auto_ptr( new T(1) ) ); // It is never safe t
2011-12-21 15:50:14
228
原创 memory management 2
class B { public: virtual ~B(); void operator delete (void*, size_t) throw(); void operator delete[](void*, size_t) throw(); void f(void*, size_t) throw(); };class D : public B{ pub
2011-12-20 16:26:52
316
原创 static 的作用
对于一个完整的程序,在内存中的分布情况如下图: 代码区 //low address 全局数据区 堆区 栈区 //high address 1、全局变量和全局静态变量的区别, example:#include void fn();int n; //定义静态全局变量void main(){ n=20; cout<<n<<endl; fn();} /
2011-12-19 16:15:09
204
原创 Memory Management1
Prefer using the free store (new/delete). Avoid using the heap (malloc/free).const datastackfree storeHeapglobal/static
2011-12-19 14:25:54
244
原创 NameLookup4
// Example 2: Will this compile? //// In some library header:namespace N { class C {}; }int operator+(int i, N::C) { return i+1; }// solution this problem: let operator in N// A mainline to exer
2011-12-19 11:24:27
317
原创 NameLookupAndInterfacePrinciple2
//*** Example 5 (a) -- nonvirtual streaming class X{ /*...ostream is never mentioned here...*/};ostream& operator<<( ostream& o, const X& x ){ /* code to output an X to a stream */ return o;
2011-12-15 17:12:11
188
原创 NameLookupAndInterfacePrinciple1
namespace A { struct X; struct Y; void f( int ); void g( X );}namespace B{ void f( int i ) { f( i ); // which f()? } void g( A::X x ) { g( x ); // which g()? }
2011-12-15 17:11:07
199
原创 The "Fast Pimpl" Idiom
// file y.hclass X;class Y{ /*...*/ X* px_; };// file y.cpp#include "x.h"Y::Y() : px_( new X ) {}Y::~Y() { delete px_; px_ = 0; }// This nicely hides X, but it turns out that Y is u
2011-12-14 16:46:44
281
原创 compilation firewalls
// In C++, when anything in a class definition changes (even private members), // all users of that class must be recompiled. To reduce these dependencies, // a common technique is to use an opaque
2011-12-14 14:21:28
301
原创 Minimizing Compile-time Dependencies 1
// x.h: original header //#include // remove, unnecessary #include // std, typedef. it can replace with #include #include // for compatibility.#include // None of A, B, C, D or E are t
2011-12-14 13:49:21
196
原创 Uses And Abuses of Inheritance
Use inheritance wisely. If you can express a class relationship using containment/delegation alone, you should always prefer that. If you need inheritance but aren't modeling IS-A, use nonpublic inher
2011-12-13 17:00:35
347
原创 classrelationships2
class GenericTableAlgorithm{public: GenericTableAlgorithm(const string& table); virtual ~GenericTableAlgorithm(); // Process() returns true if and only if successful. // It does all the wor
2011-12-12 16:29:26
193
原创 classrelationships1
class BasicProtocol /* : possible base classes */ // MessageCreator or MessageHelper.{ public: BasicProtocol(); virtual ~BasicProtocol(); bool BasicMsgA( /*...*/ ); bool BasicMsgB( /*...*/
2011-12-12 14:28:22
284
原创 overring virtual functions
#include #include using namespace std;class Base{public: virtual void f( int ); virtual void f(double); virtual void g(int i = 10);};void Base::f( int ){ cout << "Base::f(int)" <<
2011-12-12 13:39:58
414
原创 class mechanics
class Complex { public: // The constructor allows an implicit conversion. // Watch out for hidden temporaries created by implicit conversions. explicit Complex(double real, double imaginary = 0)
2011-12-12 10:09:35
258
原创 codecomplexity
// 1.invokes the Employee copy constructor. This copy operation might throw an exceptionString EvaluateSalaryAndReturnName(Employee e) { // 2.The Title() member function might itself throw, or it
2011-12-09 16:25:25
226
原创 writing exception cod2
templateclass Stack{public: Stack(); ~Stack(); Stack(const Stack& other); Stack& operator=(const Stack& other); size_t Count() const; void Push(const T&);// T* Pop(); void Pop(); T* T
2011-12-09 13:36:41
231
原创 Writing Exception Code
templateclass Stack{public: Stack(); ~Stack(); Stack(const Stack& other); Stack& operator=(const Stack& other); size_t Count() const; void Push(const T&);// T* Pop(); void Pop(); T* T
2011-12-07 16:40:52
282
原创 Temporary Objects
string FindAddr(list emps, string name) // const &, string& dangerous.{ // for most containers, calling end() returns a temporary object that must be constructed and detroyed. for(list::iterator i
2011-12-06 12:54:58
218
原创 Maximally Reusable Generic Containers
template class fixed_vector{public: typedef T* iterator; typedef const T* const_iterator; iterator begin() { return v_; } iterator end() { return v_+size; } const_iterator begin() c
2011-12-02 16:03:00
311
原创 Case-Insensitive
/* ci_string s( "AbCdE" ); // case insensitive//assert( s == "abcde" );assert( s == "ABCDE" );// still case-preserving, of course//assert( strcmp( s.c_str(), "AbCdE" ) == 0 );assert( strcm
2011-12-02 15:39:05
953
原创 Iterators
#include using std::vector;int main() { vector e; copy(istream_iterator(cin), istream_iterator(), back_inserter(e)); // the find() algorithm returns its second argument(e.end()) if the value i
2011-12-02 12:35:31
191
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人