2007年4月28日星期六

开源许可证要点

如果不使用许可证(License),你的代码可能会被改得面目全非,不知取向。下面是一些有名的开源许可证和简要的介绍。

MIT或者X Consotrium
最宽松的
要求在所有修改的版本中保留版权许可证条款,就可以对代码进行任意使用、拷贝、修改再发行。

BSD许可证
比上面稍加了一个条件:在广告和软件包的相关文档中包含致谢。

Artistic许可证
这个限制了源码的再发行,只允许发行二进制版本。(Perl)

GPL通用公共许可证
使用较广泛,但是像病毒一样具有传播性:只要你的代码使用了GPL,你的代码也处于GPL的涵盖之下,必须公开、可供他人使用、拷贝、修改。如果是商业使用,这将给你的代码带来麻烦。

2007年4月27日星期五

域名申请,网站空间,虚拟主机等

这里记下一些 域名申请,网站空间,虚拟主机等的网站。

快网 (多种套餐)
http://www.kuww.net/

中国空间网
http://www.72sky.com/
中国空间网-国内专业虚拟主机服务提供商,竭诚为海内外客户提供优质的服务提,供ASP网站空 间,国外空间,美国空间,美国虚拟主机,日本虚拟主机,日本空间,香港空间,台湾空间,国外空间,ASP.NET空间,ASP空间,网站空间域名在线支 付,稳定,高速主机,主机托管,主机租用,域名注册, 美国空间租用,国外域名空间,美国服务器,香港服务器,,海外邮箱,台湾服务器,网站建设,香港主机,台湾主机

第一主机
www1.com.cn
虚拟主机第一主机是中国著名虚拟主机,域名注册专业提供商!独创数字智能型虚拟主机技术,为企业上网建站提供最好的虚拟主机方案!同时开通电信虚拟主机和网通虚拟主机专用机房,免费支持wap虚拟主机手机上网!

第一商务网
http://www.cmbchina.com.cn
http://www.eb.com.cn

九州未来科技
http://www.czm.cn/

万网
www.net.cn


新网,多种套餐,较贵
http://www.xinnet.com/

2007年4月26日星期四

SNG(Scriptable Network Graphics)

Linux系统下的在PNG(Portable Network Graphics)与其纯文本格式间转换的工具。
似乎没有windows版本。

2007年4月25日星期三

http://anaturb.net/ - Web page for programmers

http://anaturb.net/
一个个人的网站,但是里面有很多的编程相关的例子和参考。
如C/C++相关,Vim编辑器的参考,MySQL, CSS,还有Linux和Unix相关的内容。

“This "page" is not tutorial or reference for some particular subject.
It is intended for usage as "manual" to the subjects of my own private and professional interests. It is under constant development.
Anyone is welcome to use it.”

2007年4月24日星期二

最好的网络编程教程网站w3schools

http://www.w3schools.com (不要漏了schools的复数,否则就转到另一个粗制滥造的网站上去了。)
The best things in life are free.

最全面的网站编程相关的教程和参考。包括
HTML Tutorials
Learn HTML
Learn XHTML
Learn CSS
Learn TCP/IP

XML Tutorials
Learn XML
Learn XSL
Learn XSLT
Learn XSL-FO
Learn XPath
Learn XQuery
Learn XLink
Learn XPointer
Learn DTD
Learn Schema
Learn XML DOM
Learn XForms
Learn SOAP
Learn WSDL
Learn RDF
Learn RSS
Learn WAP
Learn Web Services

Browser Scripting
Learn JavaScript
Learn HTML DOM
Learn DHTML
Learn VBScript
Learn AJAX
Learn AppML
Learn E4X
Learn WMLScript

Server Scripting
Learn SQL
Learn ASP
Learn ADO
Learn PHP

.NET (dotnet)
.NET Microsoft
.NET ASP
.NET Mobile

Multimedia
Learn Media
Learn SMIL
Learn SVG
Learn Flash

Web Building
Web Building
Web W3C
Web Browsers
Web Quality
Web Semantic
Web Careers
Web Hosting
Web Certification

最富特色的是具有脚本的实时编写和显示功能,用户即使没有编辑器也可以马上实验脚本的执行结果。

Emacs + color-theme.el

给Emacs配色,最好的就是使用color-theme.el。
你可以从https://gna.org/projects/color-theme找到最新的color-theme.el的信息。
https://gna.org/files/?group=color-theme下载最新的包。
对Windows下的GNU Emacs
将压缩包中的 color-theme.el 和 themes 文件夹拷贝到 emacs程序文件夹下的lisp中。
修改 .emacs,在c:/下,添加如下的内容
;; color theme
(require 'color-theme)
(color-theme-initialize)
(color-theme-calm-forest) ;; case sensitive.
执行的内容分别是载入color-theme.el,初始化,使用配色方案Calm Forest。
对Cygwin
拷贝到cygwin\usr\share\emacs\site-lisp下即可。
同样修改.emacs,这个在home\yourusername目录下

可以通过M-x color-theme-select命令来更改或预览效果。

你可以在这里http://www.cs.cmu.edu/~maverick/GNUEmacsColorThemeTest/
预览各种颜色的效果,有C,LaTeX,Lisp,Perl等语言加亮显示的预览

2007年4月21日星期六

Open Source Data Mining Tool - Tanagra

TANAGRA is a free DATA MINING software for academic and research purposes. It proposes several data mining methods from exploratory data analysis, statistical learning, machine learning and databases area.
http://eric.univ-lyon2.fr/~ricco/tanagra/en/tanagra.html
免费的数据挖掘和处理的程序。

2007年4月20日星期五

BogoMIPS

BogoMIPS 是 “Bogus millions of instructions per second”,是一个假的每秒钟百万处理数的单位,用来表征计算机处理器的速度。
原来是Linux之父Linus Torvalds在Linux系统启动时用来计算并设置启动相关操作的。由于没有考虑许多有关因素,这个测量并不标准。
这里有个BogoMips mini-Howto
http://www.hobby.nl/~clifton/index.html?bogomips.html

XOOPS-CMS

http://www.xoops.org/
一个可扩展的内容管理系统,免费,用PHP写成。
XOOPS is an extensible, OO (Object Oriented), easy to use dynamic web content management system written in PHP. XOOPS is the ideal tool for developing small to large dynamic community websites, intra company portals, corporate portals, weblogs and much more. Read the All about XOOPS page for more details.

PolePosition

PolePosition

开源的数据库基准测试代码
the open source database benchmark
http://www.polepos.org

Content


简介:用来比较不同数据库性能的测试框架

“About

PolePosition is a benchmark test suite to compare database engines and object-relational mapping technology. As of today it is by no means complete. Database vendors and open source database project participants are invited to improve the test implementations and to contribute further disciplines ("Circuits"). The PolePosition framework source code will help to implement own tests quickly and to time and output the results as number series and graphic visualisations.

The authors of the current test implementations do not see themselves as experts for SQL, JDO or Hibernate or for any of the database engines used. If you think that you can provide a faster implementation for a circuit, please supply it to the PolePosition project instead of criticising the authors for ignorance or the test for lacking objectivity.

This is a community project. It is for you! Please think positive, help us and be nice to us for starting the initiative. If you have a strong ego, good! Please write a better Circuit, Team, Car or Driver than we did instead of laughing about us.

Objectivity must be the most important goal of the benchmark tests. The results show very clearly that there can not be one single "best product". Depending on your application, some circuit results may be very important for you and some may be completely irrelevant. If you consider basing your choice of database on this benchmark, bring along lots of time to look at what every test does. You will not be able to judge the results without looking at the source code that produces them.


HSQLDB

一个以Java为特色的SQL数据库。
下面是它的网站上的介绍:

HSQLDB is the leading SQL relational database engine written in Java. It has a JDBC driver and supports a rich subset of ANSI-92 SQL (BNF tree format) plus SQL 99 and 2003 enhancements. It offers a small (less than 100k in one version for applets), fast database engine which offers both in-memory and disk-based tables and supports embedded and server modes. Additionally, it includes tools such as a minimal web server, in-memory query and management tools (can be run as applets) and a number of demonstration examples.

The product is currently being used as a database and persistence engine in many Open Source Software projects and even in commercial projects and products. In it's current version it is extremely stable and reliable. It is best known for its small size, ability to execute completely in memory, its flexibility and speed.

This feature-packed software is completely free to use and distribute under our licenses , based on the standard BSD license. Completely free of cost or restrictions and fully compatible with all major open source licenses. Java source code and extensive documentation included.

Our group was formed in 2001 and has as its charter the continuation of Thomas Mueller's closed Hypersonic SQL Project. We have actively developed and released six new versions of the database since April 2001. The latest release version features a wide range of new functionality and code rewrite. The project enjoys a top 50 ranking among all SourceForge projects (100,000) with over 380,000 downloads.

MIMER 可以在手机上使用的数据库

MIMER是一个SQL数据库,可以在众多平台上使用,甚至包括了嵌入版本和手机上(Symbian OS 60)的版本。
下面是下载地址,所有的都可以免费下载。但商业用就需要许可。
http://developer.mimer.com/downloads/index.htm

2007年4月19日星期四

HTMLUnit

http://htmlunit.sourceforge.net/

一个用来测试基于网络的程序的测试框架,(测试Java程序的有JUnit,测试CPP的也有CPPUnit)等等。

HtmlUnit is a java unit testing framework for testing web based applications. It is similar in concept to httpunit but is very different in implementation. Which one is better for you depends on how you like to write your tests. HttpUnit models the http protocol so you deal with request and response objects. HtmlUnit on the other hand, models the returned document so that you deal with pages and forms and tables.

HtmlUnit was originally written by Mike Bowler of Gargoyle Software and released under an apache style license. Since then, it has received many contributions from other developers and would not be where it is today without their assistance.

HtmlUnit is not a generic unit testing framework. It is specifically a way to simulate a browser for testing purposes and is intended to be used within another testing framework such as JUnit. Refer to the document "Getting Started with HtmlUnit" for an introduction.

NOTE: This documentation is for the current code in SVN and may not accurately reflect the version of HtmlUnit that you have downloaded. Refer to the documentation that came with your download for the most correct information

SQLite C++ Wrapper

http://dev.int64.org/sqlite.html

一个用来与SQLite数据库进行交互的Wrapper,可以用它方便地对SQLite数据库进行各种操作。
这个简单的网页还有一些示例代码。

2007年4月18日星期三

How to pronounce Cygwin?

Some guys say it should be pronounced as /saigwin/ like cycle, but it's correct pronounce should be /sɪgwɪn/ because GNU+Cygnus+Windows=Cygwin Cyg as /sig/ in cygnus.

2007年4月17日星期二

Basic CLisp(1) some test, just try.

>(* 1 2 3 4)
120
>(nth 2 '(1 2 3 4))
3
>(length '(a b c d))
4
>(member 5 '(1 2 3))
nil

'() = (quote())
>(length (quote(a b c d)))
4
>(eval(list '*3 5)) #=(eval(* 3 5))
15
>

Xmanager

Xmanager是一个Windows下的链接适用Linux系统的软件(至少今天我作的事情就是这么回事。)
Xstart可以定义一个字符界面的session,进入后启动xterm
Xbrowser可以定义一个图形界面的登录。
等等。

2007年4月15日星期日

Free CFD software and etc.

Links - Software
http://www.cfd-online.com/Links/soft.html

Software related to CFD. This section is a mix of real links and meta links. Only particularly interesting things are linked directly. If you want a more comprehensive overview you should follow the meta links. To suggest a link to be included in this section please use the online link suggestion form. You are of course also welcome to contact us directly via email at webmaster@cfd-online.com.

Contents:

* Fluid Dynamics
o Selected Codes
* General Numerical Software
* Visualization
o Organizations
o Companies
* Mesh Generation
* Commercial CFD Packages

2007年4月12日星期四

免费的数据库

提起免费的数据库,想到最多的当然是MySQL, PostgreSQL等免费的数据库了(http://www.freesql.org/)。

但是现在几个大的软件开发商都有他们的免费的数据库可用:

微软的Microsoft SQL Servre 2005 Express Edition


"SQL Server 2005 Express Edition is the next version of MSDE and is a free, easy-to-use, lightweight, and embeddable version of SQL Server 2005. Free to download, free to redistribute, free to embed, and easy for new developers to use immediately, SQL Server Express includes powerful features such as SQL Server Management Studio Express, for easily managing a database. Continue reading to learn more about the benefits of SQL Server Express Edition and to download SQL Server Management Studio.”

甲骨文的Oracle Database 10g Express Edition


Free to develop, deploy, and distribute

Oracle Database 10g Express Edition (Oracle Database XE) is an entry-level, small-footprint database based on the Oracle Database 10g Release 2 code base that's free to develop, deploy, and distribute; fast to download; and simple to administer. Oracle Database XE is a great starter database for:

  • Developers working on PHP, Java, .NET, XML, and Open Source applications
  • DBAs who need a free, starter database for training and deployment
  • Independent Software Vendors (ISVs) and hardware vendors who want a starter database to distribute free of charge
  • Educational institutions and students who need a free database for their curriculum


IBM的DB2 Express-C

Free to build, deploy, distribute ... No limits.

DB2 9 (formerly codenamed “Viper”) is a leading edge hybrid data server capable of supporting both relational and pureXML™ storage. New features increase performance and scalability for both XML and relational data.

DB2 Express-C is a no-charge edition of DB2.

DB2 Express C:



这里有一个很长的免费(自由?)数据库的列表:
http://www.faqs.org/faqs/databases/free-databases/

2007年4月11日星期三

sprintf与cout一起处理输出

sprintf负责将字符串格式化,cout则输出格式化后的字符串。
前者也可以处理字符串,比如为文件名编号等。

格式参考
http://www.cplusplus.com/reference/clibrary/cstdio/sprintf.html
sprintf function
int sprintf ( char * str, const char * format, ... );

Write formatted data to string

Writes into the array pointed by str a C string consisting on a sequence of data formatted as the format argument specifies. After the format parameter, the function expects at least as many additional arguments as specified in format.
This function behaves exactly as printf does, but writing its results to a string instead of stdout. The size of the array passed as str should be enough to contain the entire formatted string.

Parameters

str
Pointer to an array of char elements where the resulting C string is stored.
format
C string that contains the text to be written to the buffer.
It can optionally contain embedded format tags that are substituted by the values specified in subsequent argument(s) and formatted as requested.
The number of arguments following the format parameters should at least be as much as the number of format tags.
The format tags follow this prototype:

%[flags][width][.precision][length]specifier
Where specifier is the most significant one and defines the type and the interpretation of the value of the coresponding argument:
specifierOutputExample
cCharactera
d or iSigned decimal integer392
eScientific notation (mantise/exponent) using e character3.9265e+2
EScientific notation (mantise/exponent) using E character3.9265E+2
fDecimal floating point392.65
gUse the shorter of %e or %f392.65
GUse the shorter of %E or %f392.65
oSigned octal610
sString of characterssample
uUnsigned decimal integer7235
xUnsigned hexadecimal integer7fa
XUnsigned hexadecimal integer (capital letters)7FA
pPointer addressB800:0000
nNothing printed. The argument must be a pointer to a signed int, where the number of characters written so far is stored.
%A % followed by another % character will write % to the string.

The tag can also contain flags, width, .precision and modifiers sub-specifiers, which are optional and follow these specifications:

flagsdescription
-Left-justify within the given field width; Right justification is the default (see width sub-specifier).
+Forces to preceed the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.
(space)If no sign is going to be written, a blank space is inserted before the value.
#Used with o, x or X specifiers the value is preceeded with 0, 0x or 0X respectively for values different than zero.
Used with e, E and f, it forces the written output to contain a decimal point even if no digits would follow. By default, if no digits follow, no decimal point is written.
Used with g or G the result is the same as with e or E but trailing zeros are not removed.
0Left-pads the number with zeroes (0) instead of spaces, where padding is specified (see width sub-specifier).
widthdescription
(number)Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated even if the result is larger.
*The width is not specified in the format string, but as an additional integer value argument preceding the argument thas has to be formatted.

.precisiondescription
.numberFor integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result is padded with leading zeros. The value is not truncated even if the result is longer. A precision of 0 means that no character is written for the value 0.
For e, E and f specifiers: this is the number of digits to be printed after de decimal point.
For g and G specifiers: This is the maximum number of significant digits to be printed.
For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.
For c type: it has no effect.
When no precision is specified, the default is 1. If the period is specified without an explicit value for precision, 0 is assumed.
.*The precision is not specified in the format string, but as an additional integer value argument preceding the argument thas has to be formatted.
lengthdescription
hThe argument is interpreted as a short int or unsigned short int (only applies to integer specifiers: i, d, o, u, x and X).
lThe argument is interpreted as a long int or unsigned long int for integer specifiers (i, d, o, u, x and X), and as a wide character or wide character string for specifiers c and s.
LThe argument is interpreted as a long double (only applies to floating point specifiers: e, E, f, g and G).
additional arguments
Depending on the format string, the function may expect a sequence of additional arguments, each containing one value to be inserted instead of each %-tag specified in the format parameter, if any. There should be the same number of these arguments as the number of %-tags that expect a value.

Return Value

On success, the total number of characters written is returned. This count does not include the additional null-character automatically appended at the end of the string.
On failure, a negative number is returned.

Example

/* sprintf example */
#include

int main ()
{
char buffer [50];
int n, a=5, b=3;
n=sprintf (buffer, "%d plus %d is %d", a, b, a+b);
printf ("[%s] is a %d char long string\n",buffer,n);
return 0;
}

Output:
[5 plus 3 is 8] is a 13 char long string

这里也有一些例子:
http://www.cppreference.com/stdio/sprintf.html

最大最小值算符

新版的C++编译器才支持的最大最小值操作符。

smallervalue=value1<?value2;

biggervalue=value1>?value2;


用gcc编译会报错。不过g++没问题。

和原来的
smallervalue=(value1<value2?value1:value2);
等价。

2007年4月10日星期二

当执行 ofstream open() 时,程序崩溃crash

程序中使用了大量的动态分配内存,如果这些分配出了错,那么像标题中的那个错误可能会在什么时候出现,而错误根本与open无关。

下面是一个我找到的错误:
double * aVector;
aVector=new double[0]; // 分配了0个double 长的内存。
这时,delete[] aVector; //就是一个隐藏的错误,但是不会报错。

害我找了半天错误!!!

How to Program in C++ 怎样用C++编程

http://www.cs.fit.edu/~mmahoney/cse2050/how2cpp.html

这是一个C++编程的简单教程,只有一页,基本涵盖了所有的内容(这是夸张)。不过,有功夫看看这么短的东西也好,也是一个比较好的参考文献。下面给出了第一章,就是一个比较罗嗦的目录。

You may copy this file for noncommercial use. The latest version is located at cs.fit.edu/~mmahoney/cse2050/how2cpp.html updated Sept. 26, 2005. Please report errors to Matt Mahoney at mmahoney@cs.fit.edu. Seldom-used features have been deliberately omitted.

Language Summary

Basic Concepts

Statements if, for, while, return, break...

Expressions arithmetic, comparison, assignment...

The most important types are int, char, bool, double, and the containers string, vector, and map. Summary of common types:

Built-in        Description
int x; Fastest integer type (16-32 bits), also short, long, unsigned
char x; 8-bit character, '\0' to '\xFF' or -128 to 127
double x; 64 bit real + or - 1.8e308, 14 significant digits, also float
bool x; true or false

Modifiers Description
const T x; Non-modifiable object
T& y=x; Reference, y is an alias for x, which both have type T
T f(...) {...} Defines f as a function returning T
T* p; Pointer to T (*p is a T object)
T[N] a; Array of N elements of T, a[0] to a[N-1]
static T x; Place x in data segment
register T x; (rare) Hint to optimize for speed
volatile T x; (rare) x may be modified externally
The following standard library types and functions require at the beginning of the program:
  #include <header>
using namespace std;

Library Type Description Header
istream Standard input (cin) iostream
ostream Output (cout, cerr, clog) iostream
ifstream Input file fstream
ofstream Output file fstream
string Sequence of char string
vector Expandable array/stack of T vector
deque Array/double ended queue deque
list List/stack/queue of T list
map Associative mapping of T1 to T2 map
set A map with keys only set
pair Two objects of type T1 and T2 map or utility
priority_queue Sorted queue queue
stack Stack stack
bitset Array of N bool with logical operations bitset
valarray Array with arithmetic operations valarray
complex Complex number complex
iterator Pointer into a container (Included with container)
const_iterator Pointer not allowing element assignment (Included with container)
exception Hierarchy of exception types stdexcept, exception

C++ Standard Library Functions Header
min(), max(), swap(), sort(), copy(), equal() algorithm
accumulate(), inner_product() numeric
back_inserter() iterator
equal_to(), less(), bind2nd() functional
set_new_handler() new

C Library Functions Header
atoi(), atof(), abs(), rand(), system(), exit() cstdlib
isalpha(), isdigit(), tolower(), toupper() cctype
sqrt(), log(), exp(), pow(), sin(), cos(), atan() cmath
clock(), time() ctime
strlen(), memset(), memmove(), memcmp() cstring
printf(), fopen(), getc(), perror() cstdio
assert() cassert

C++ allows you to create your own types and libraries. The most important type is a class, allowing object oriented programming. A class is an abstract data type with a hidden representation and a set of public member functions and types. Classes can be organized into a hierarchy (inheritance), and you can write code that accepts any type in this hierarchy (polymorphism). Functions and classes can be parameterized by type (templated).

class T {...};  Defines T as a collection of types, objects, and member functions
template ... Defines a set of functions or classes over all T
typedef T U; Defines type U is a synonym for T
enum T {...}; Defines T as an int, and set of int constants
struct T {...}; Like a class, except default scope of members is public
union T {...}; A struct with object members overlapping in memory
namespace N {...}; Defines a scope for a collection of types, objects, and functions

Program Organization (compiling, linking, make)
History of C++
Further Reading

How to convert string to char array (char *)

怎样将string字符串转化为字符数组char* ?
只需要一个函数, c_str();

应用:
如果你想把字符串转变为double双精度类型数据。

string aString="10.525aeqaewrar";
char * aPointer;
double aNumber=strtod(aString.c_str(),&aPointer); // aNumber=10.525

C++ string class

C++的string类里提供了很多的函数,包含字符串的查找,替换,等等操作。尽管它并没有比如javascript之类的字符操作函数多样,但是各种功能的字符查找都可以通过这些基本的函数实现。
javascript的字符串对象string object的相关内容见
http://www.w3schools.com/jsref/jsref_obj_string.asp
XPATH的字符串对象string object可以参考:
http://www.w3.org/TR/xpath#section-String-Functions
http://www.w3schools.com/xpath/xpath_functions.asp#string

http://www.w3schools.com 是个好网站




参考可以看
http://www.cppreference.com/cppstring/index.html
每一个条目的链接页都有示例。

C++ Strings

Display all entries for C++ Strings on one page, or view entries individually:

String constructors create strings from arrays of characters and other strings
String operators concatenate strings, assign strings, use strings for I/O, compare strings
append append characters and strings onto a string
assign give a string values from strings of characters and other C++ strings
at returns an element at a specific location
begin returns an iterator to the beginning of the string
c_str returns a standard C character array version of the string
capacity returns the number of elements that the string can hold
clear removes all elements from the string
compare compares two strings
copy copies characters from a string into an array
data returns a pointer to the first character of a string
empty true if the string has no elements
end returns an iterator just past the last element of a string
erase removes elements from a string
find find characters in the string
find_first_not_of find first absence of characters
find_first_of find first occurrence of characters
find_last_not_of find last absence of characters
find_last_of find last occurrence of characters
getline read data from an I/O stream into a string
insert insert characters into a string
length returns the length of the string
max_size returns the maximum number of elements that the string can hold
push_back add an element to the end of the string
rbegin returns a reverse_iterator to the end of the string
rend returns a reverse_iterator to the beginning of the string
replace replace characters in the string
reserve sets the minimum capacity of the string
resize change the size of the string
rfind find the last occurrence of a substring
size returns the number of items in the string
substr returns a certain substring
swap swap the contents of this string with another

这里还有一个列表,来自
http://www.bgsu.edu/departments/compsci/docs/string.html

C++ String Class

The C++ Standard Template Library (STL) contains a string class that is used in several computer science classes. In order to use the string class you should include the following statements:
#include
using std::string;

The following examples assume these declarations and initial values for each:

string s = "abc def abc";
string s2 = "abcde uvwxyz";
char c;
char ch[] = "aba daba do";
char *cp = ch;
unsigned int i;

Stream input cin >> s; Changes the value of s to the value read in. The value stops at whitespace.
Stream output cout <<> Writes the string to the specified output stream.
Line input getline(cin, s); Reads everything up to the next newline character and puts the result into the specified string variable.
Assignment s = s2;s = "abc";
s = ch; s = cp;
A string literal or a string variable or a character array can be assigned to a string variable. The last two assignments have the same effect.
Subscript s[1] = 'c';
c = s[1];
Changes s to equal "acc def abc"
Sets c to 'b'. The subscript operator returns a char value, not a string value.
Length i = s.length();
i = s.size();
Either example sets i to the current length of the string s
Empty? if(s.empty()) i++;
if(s =
= "") i++;
Both examples add 1 to i if string s is now empty
Relational operators if (s <> Uses ASCII code to determine which string is smaller. Here the condition is true because a space comes before letter d
Concatenation

s2 = s2 + "x";
s2 += "x";

Both examples add x to the end of s2
Substring

s = s2.substr(1,4);
s = s2.substr(1,50);

The first example starts in position 1 of s2 and takes 4 characters, setting s to "bcde". In the second example, s is set to "bcde uvwxyz". If the length specified is longer than the remaining number of characters, the rest of the string is used. The first position in a string is position 0.
Substring replace s.replace(4,3,"x"); Replaces the three characters of s beginning in position 4 with the character x. Variable s is set to "abc x abc".
Substring removal s.erase(4,5);
s.erase(4);
Removes the five characters starting in position 4 of s. The new value of s is "abc bc".
Remove from position 4 to end of string. The new value of s is "abc ".
Character array to string s = ch; Converts character array ch into string s.
String to character array cp = s.c_str(); Pointer cp points to a character array with the same characters as s.
Pattern matching

i = s.find("ab",4);

if(s.rfind("ab",4) != string::npos)
cout << "Yes" <<>

The first example returns the position of the substring "ab" starting the search in position 4. Sets i to 8. The find and rfind functions return the unsigned int string::npos if substring not found. The second example searches from right to left starting at position 4. Since the substring is found, the word Yes is printed.

Because of a bug in the bgunix version of the g++ compiler, writing a string variable under setw control doesn't work. You need to use the c_str member function, like this:
cout <<>


C语言的字符处理库如下
http://www.cplusplus.com/reference/clibrary/cstring/
cstring (string.h) header


C Strings

This header file defines several functions to manipulate C strings and arrays.

Functions

Copying:
memcpy Copy block of memory (function)
memmove Move block of memory (function)
strcpy Copy string (function)
strncpy Copy characters from string (function)

Concatenation:

strcat Concatenate strings (function)
strncat Append characters from string (function)

Comparison:

memcmp Compare two blocks of memory (function)
strcmp Compare two strings (function)
strcoll Compare two strings using locale (function)
strncmp Compare characters of two strings (function)
strxfrm Transform string using locale (function)

Searching:

memchr Locate character in block of memory (function)
strchr Locate first occurrence of character in string (function)
strcspn Get span until character in string (function)
strpbrk Locate character in string (function)
strrchr Locate last occurrence of character in string (function)
strspn Get span of character set in string (function)
strstr Locate substring (function)
strtok Split string into tokens (function)

Other:

memset Fill block of memory (function)
strerror Get pointer to error message string (function)
strlen Get string length (function)

Macros

NULL Null pointer (macro)

Types

size_t Unsigned integral type (type)

2007年4月7日星期六

Echo2

Echo2 一个网页开发框架,开发在线应用程序的。
http://www.nextapp.com/platform/echo2/echo/
says:

Echo2

Echo2 is the next-generation of the Echo Web Framework, a platform for developing web-based applications that approach the capabilities of rich clients. The 2.0 version holds true to the core concepts of Echo while providing dramatic performance, capability, and user-experience enhancements made possible by its new Ajax-based rendering engine.

Echo2 removes the developer from having to think in terms of "page-based" applications and enables him/her to develop applications using the conventional object-oriented and event-driven paradigm for user interface development. Knowledge of HTML, HTTP, and JavaScript is not required. Applications may be hosted using any Java servlet container. Echo2, like its predecessor, is open-source software distributed under the terms of the Mozilla Public License (or, if preferred, the GNU LGPL License).

If you are interested in participating in the development and testing of Echo, or just want to stay up-to-date with the latest releases, fixes, and ideas, visit the Developer Forums.

Google Maps API 工具

KsGmap
一个Google Map API的JavaScript脚本库。
下面是例子:
http://www.ksgmap.jp/download/sample.html


汎用 Google Maps API スクリプト“ KsGMap ”とは

Google Maps API を用いた地図を簡単に設置することができる汎用スクリプトです。
JavaScript を知らない方でも、簡単に高機能な地図を自分のサイトに組み入れることができます。

Google Maps API は JavaScript という比較的簡単なプログラム言語を用いている為、誰でも簡単に設置することができます。しかし、さまざまな機能を付けると、どうしても敷居の高いものに なってしまいます。そこで、さらに簡単に設置できるようにしたのが、KsGMap です。

2007年4月6日星期五

查询服务器或者IP、域名

http://whois.webhosting.info/hotmail.com

其他,赚钱的网站
http://www.99bill.com/
http://u.ete.cn/index/

2007年4月5日星期四

Debug Error! DAMAGE:after Normal block (#xxx) at

出错的原因很简单,你在某处定义了一个数组,如
double *a=new double[SIZE]
但是在访问的时候越了界,也就是SIZE定义小了,这时不会报错。

但当你delete它的时候,就会出错。

如果简单注释掉 delete语句,可能会给其它分配内存的语句带来错误的隐患,如在Debug时不被发现,而在Release则会莫名其妙地出错。

2007年4月4日星期三

Release 和Debug的另一篇文章

发信人: thracia (多拉基亚枪骑兵), 信区: VisualC
标 题: Re: 为什么release生成的exe文件的运行结果和debug下的不同
发信站: BBS 水木清华站 (Mon May 17 19:44:47 2004), 站内

我转贴一篇,不知道贴过没有,vcer上面的


--------------------------------------

本文主要包含如下内容:

1. Debug 和 Release 编译方式的本质区别

2. 哪些情况下 Release 版会出错

2. 怎样“调试” Release 版的程序

--------------------------------------



关于Debug和Release之本质区别的讨论



一、Debug 和 Release 编译方式的本质区别



Debug 通常称为调试版本,它包含调试信息,并且不作任何优化,便于程序员调试程序。Release 称为发布版本,它往往是进行了各种优化,使得程序在代码大小和运行速度上都是最优的,以便用户很好地使用。

Debug 和 Release 的真正秘密,在于一组编译选项。下面列出了分别针对二者的选项(当然除此之外还有其他一些,如/Fd /Fo,但区别并不重要,通常他们也不会引起 Release 版错误,在此不讨论)



Debug 版本:

/MDd /MLd 或 /MTd 使用 Debug runtime library(调试版本的运行时刻函数库)

/Od 关闭优化开关

/D "_DEBUG" 相当于 #define _DEBUG,打开编译调试代码开关(主要针对assert函数)

/ZI 创建 Edit and continue(编辑继续)数据库,这样在调试过程中如果修改了源代码不需重新编译

/GZ 可以帮助捕获内存错误

/Gm 打开最小化重链接开关,减少链接时间



Release 版本:

/MD /ML 或 /MT 使用发布版本的运行时刻函数库

/O1 或 /O2 优化开关,使程序最小或最快

/D "NDEBUG" 关闭条件编译调试代码开关(即不编译assert函数)

/GF 合并重复的字符串,并将字符串常量放到只读内存,防止被修改

实际上,Debug 和 Release 并没有本质的界限,他们只是一组编译选项的集合,编译器只是按照预定的选项行动。事实上,我们甚至可以修改这些选项,从而得到优化过的调试版本或是带跟踪语句的发布版本。



二、哪些情况下 Release 版会出错



有了上面的介绍,我们再来逐个对照这些选项看看 Release 版错误是怎样产生的

1. Runtime Library:链接哪种运行时刻函数库通常只对程序的性能产生影响。调试版本的 Runtime Library 包含了调试信息,并采用了一些保护机制以帮助发现错误,因此性能不如发布版本。编译器提供的 Runtime Library 通常很稳定,不会造成 Release 版错误;倒是由于 Debug 的 Runtime Library 加强了对错误的检测,如堆内存分配,有时会出现 Debug 有错但 Release 正常的现象。应当指出的是,如果Debug有错,即使 Release正常,程序肯定是有 Bug 的,只不过可能是 Release版的某次运行没有表现出来而已。

2. 优化:这是造成错误的主要原因,因为关闭优化时源程序基本上是直接翻译的,而打开优化后编译器会作出一系列假设。这类错误主要有以下几种:

(1) 帧指针(Frame Pointer)省略(简称 FPO ):在函数调用过程中,所有调用信息(返回地址、参数)以及自动变量都是放在栈中的。若函数的声明与实现不同(参数、返回值、调用方式),就会产生错误 ————但 Debug 方式下,栈的访问通过 EBP 寄存器保存的地址实现,如果没有发生数组越界之类的错误(或是越界“不多”),函数通常能正常执行;Release 方式下,优化会省略 EBP 栈基址指针,这样通过一个全局指针访问栈就会造成返回地址错误是程序崩溃。C++ 的强类型特性能检查出大多数这样的错误,但如果用了强制类型转换,就不行了。你可以在 Release 版本中强制加入 /Oy- 编译选项来关掉帧指针省略,以确定是否此类错误。此类错误通常有:

● MFC 消息响应函数书写错误。正确的应为

afx_msg LRESULT OnMessageOwn(WPARAM wparam, LPARAM lparam);

ON_MESSAGE 宏包含强制类型转换。防止这种错误的方法之一是重定义 ON_MESSAGE 宏,把下列代码加到 stdafx.h 中(在#include "afxwin.h"之后),函数原形错误时编译会报错

#undef ON_MESSAGE

#define ON_MESSAGE(message, memberFxn) \

{ message, 0, 0, 0, AfxSig_lwl, \

(AFX_PMSG)(AFX_PMSGW)(static_cast< LRESULT (AFX_MSG_CALL \

CWnd::*)(WPARAM, LPARAM) > (&memberFxn) },



(2) volatile 型变量:volatile 告诉编译器该变量可能被程序之外的未知方式修改(如系统、其他进程和线程)。优化程序为了使程序性能提高,常把一些变量放在寄存器中(类似于 register 关键字),而其他进程只能对该变量所在的内存进行修改,而寄存器中的值没变。如果你的程序是多线程的,或者你发现某个变量的值与预期的不符而你确信已正确 的设置了,则很可能遇到这样的问题。这种错误有时会表现为程序在最快优化出错而最小优化正常。把你认为可疑的变量加上 volatile 试试。

(3) 变量优化:优化程序会根据变量的使用情况优化变量。例如,函数中有一个未被使用的变量,在 Debug 版中它有可能掩盖一个数组越界,而在 Release 版中,这个变量很可能被优化调,此时数组越界会破坏栈中有用的数据。当然,实际的情况会比这复杂得多。与此有关的错误有:

● 非法访问,包括数组越界、指针错误等。例如

void fn(void)

{

int i;

i = 1;

int a[4];

{

int j;

j = 1;

}

a[-1] = 1;//当然错误不会这么明显,例如下标是变量

a[4] = 1;

}

j 虽然在数组越界时已出了作用域,但其空间并未收回,因而 i 和 j 就会掩盖越界。而 Release 版由于 i、j 并未其很大作用可能会被优化掉,从而使栈被破坏。



3. _DEBUG 与 NDEBUG :当定义了 _DEBUG 时,assert() 函数会被编译,而 NDEBUG 时不被编译。除此之外,VC++中还有一系列断言宏。这包括:



ANSI C 断言 void assert(int expression );

C Runtime Lib 断言 _ASSERT( booleanExpression );

_ASSERTE( booleanExpression );

MFC 断言 ASSERT( booleanExpression );

VERIFY( booleanExpression );

ASSERT_VALID( pObject );

ASSERT_KINDOF( classname, pobject );

ATL 断言 ATLASSERT( booleanExpression );

此外,TRACE() 宏的编译也受 _DEBUG 控制。



所 有这些断言都只在 Debug版中才被编译,而在 Release 版中被忽略。唯一的例外是VERIFY() 。事实上,这些宏都是调用了 assert() 函数,只不过附加了一些与库有关的调试代码。如果你在这些宏中加入了任何程序代码,而不只是布尔表达式(例如赋值、能改变变量值的函数调用 等),那么 Release 版都不会执行这些操作,从而造成错误。初学者很容易犯这类错误,查找的方法也很简单,因为这些宏都已在上面列出,只要利用 V C++ 的 Find in Files 功能在工程所有文件中找到用这些宏的地方再一一检查即可。另外,有些高手可能还会加入 #ifdef _DEBUG 之类的条件编译,也要注意一下。

顺便值得一提的是 VERIFY() 宏,这个宏允许你将程序代码放在布尔表达式里。这个宏通常用来检查 Windows API 的返回值。有些人可能为这个原因而滥用 VERIFY() ,事实上这是危险的,因为 VERIFY() 违反了断言的思想,不能使程序代码和调试代码完全分离,最终可能会带来很多麻烦。因此,专家们建议尽量少用这个宏。

4. /GZ 选项:这个选项会做以下这些事

(1) 初始化内存和变量。包括用 0xCC 初始化所有自动变量,0xCD ( Cleared Data) 初始化堆中分配的内存(即动态分配的内存,例如 new ),0xDD ( Dead Data ) 填充已被释放的堆内存(例如 delete ),0xFD( deFencde Data ) 初始化受保护的内存(debug 版在动态分配内存的前后加入保护内存以防止越界访问),其中括号中的词是微软建议的助记词。这样做的好处是这些值都很大,作为指针是不可能的(而且 32 位系统中指针很少是奇数值,在有些系统中奇数的指针会产生运行时错误),作为数值也很少遇到,而且这些值也很容易辨认,因此这很有利于在 Debug 版中发现 Release 版才会遇到的错误。要特别注意的是,很多人认为编译器会用 0 来初始化变量,这是错误的(而且这样很不利于查找错误)。

(2) 通过函数指针调用函数时,会通过检查栈指针验证函数调用的匹配性。(防止原形不匹配)

(3) 函数返回前检查栈指针,确认未被修改。(防止越界访问和原形不匹配,与第二项合在一起可大致模拟帧指针省略 FPO )

通常 /GZ 选项会造成 Debug 版出错而 Release 版正常的现象,因为 Release 版中未初始化的变量是随机的,这有可能使指针指向一个有效地址而掩盖了非法访问。

除此之外,/Gm /GF 等选项造成错误的情况比较少,而且他们的效果显而易见,比较容易发现。

三、怎样“调试” Release 版的程序

遇到 Debug 成功但 Release 失败,显然是一件很沮丧的事,而且往往无从下手。如果你看了以上的分析,结合错误的具体表现,很快找出了错误,固然很好。但如果一时找不出,以下给出了一些在这种情况下的策略。

1. 前面已经提过,Debug 和 Release 只是一组编译选项的差别,实际上并没有什么定义能区分二者。我们可以修改 Release 版的编译选项来缩小错误范围。如上所述,可以把 Release 的选项逐个改为与之相对的 Debug 选项,如 /MD 改为 /MDd、/O1 改为 /Od,或运行时间优化改为程序大小优化。注意,一次只改一个选项,看改哪个选项时错误消失,再对应该选项相关的错误,针对性地查找。这些选项在 Project\Settings... 中都可以直接通过列表选取,通常不要手动修改。由于以上的分析已相当全面,这个方法是最有效的。

2. 在编程过程中就要时常注意测试 Release 版本,以免最后代码太多,时间又很紧。

3. 在 Debug 版中使用 /W4 警告级别,这样可以从编译器获得最大限度的错误信息,比如 if( i =0 )就会引起 /W4 警告。不要忽略这些警告,通常这是你程序中的 Bug 引起的。但有时 /W4 会带来很多冗余信息,如 未使用的函数参数 警告,而很多消息处理函数都会忽略某些参数。我们可以用

#progma warning(disable: 4702) //禁止

//...

#progma warning(default: 4702) //重新允许

来暂时禁止某个警告,或使用

#progma warning(push, 3) //设置警告级别为 /W3

//...

#progma warning(pop) //重设为 /W4

来暂时改变警告级别,有时你可以只在认为可疑的那一部分代码使用 /W4。



4. 你也可以像 Debug 一样调试你的 Release 版,只要加入调试符号。在 Project/Settings... 中,选中 Settings for "Win32 Release",选中 C/C++ 标签,Category 选General,Debug Info 选 Program Database。再在 Link 标签 Project options 最后加上 "/OPT:REF" (引号不要输)。这样调试器就能使用 pdb 文件中的调试符号。但调试时你会发现断点很难设置,变量也很难找到——这些都被优化过了。不过令人庆幸的是,Call Stack 窗口仍然工作正常,即使帧指针被优化,栈信息(特别是返回地址)仍然能找到。这对定位错误很有帮助。



参考文献

《Windows 程序调试》Everett N. McKay Mike Woodring 中国电力出版社

http://expert.csdn.net/Expert/topic/1349/1349401.xml?temp=.6075556

http://www.csdn.net/develop/article/17/17068.shtm

http://expert.csdn.net/Expert/topic/1456/1456293.xml?temp=6.505984E-02

http://expert.csdn.net/Expert/topic/1400/1400166.xml?temp=.4560053

2007年4月3日星期二

Debug版本没错而Release版本出错的情况

遍了个程序好几天了,填了不少内容,在Debug模式下没有错误,今天在Release模式下编译便出现了程序崩溃的错误,弹出一个向微软报告的那个警告对话框。
在网上查了一下,自己也找了一下,出错的地方在
double *something=new double[Size];
在Release模式下设置了调试,结果调试时没有错,执行就会出错.

解决: 我把这个语句往上移动了一些位置,错误消失了。不过这不算什么解决方法,不知道什么时候又会出错。

下面是一篇可能有用的文章,拷贝在此。
来源:http://dev.csdn.net/article/19/19724.shtm

调试Release版本应用程序

引言

如果在您的开发过程中遇到了常见的错误,或许您的Release版本不能正常运行而Debug版本运行无误,那么我推荐您阅读本文:因为并非如您想象的那样,Release版本可以保证您的应用程序可以象Debug版本一样运行。

如果您在开发阶段完成之后或者在开发进行一段时间之内从来没有进行过Release版本测试,然而当您测试的时候却发现问题,那么请看我们的调试规则1:

规则1: 经常性对开发软件进行DebugRelease版本的常规测试.

测试Release版本的时间间隔越长,排除问题的难度越大,至少对Release版本进行每周1次的测试,可以使您在紧凑的开发周期内节省潜在的排故时间.

不要随意删除Release版本需要的代码

这点看起来似乎再明显不过,但却是开发人员无意中经常犯的错误,原因在于编译器编译Release版本时候会主动排除在代码中存在的宏,例如ASSERTTRACERelease版本会自动排除,这样导致的问题是您在这些宏当中运行的代码也被随之删除,这是非常危险的事情J,例如:

ASSERT(m_ImageList.Create(MAKEINTRESOURCE(IDB_IMAGES), 16, 1, RGB(255,255,255)));

这样的代码在Debug模式不会出错,图像列表也自动创建了,然而在Release版本呢?后继使用m_ImageList对象只会造成程序的Crash!,因此ASSERT宏中尽量使用逻辑运算符作为验证。

规则 2: 不要将代码放置在仅在某种编译选项中执行的地方,对于使用_DEBUG等编译选项宏内部的代码必须不影响整个程序的使用.

规则 3: 不要使用规则2作为评判标准来删除ASSERT宏,ASSERT宏是个有用的工具,但容易使用错误.

使Debug编译模式接近Release模式

如果您的Release版本存在的问题是由代码被编译器自动排除造成的,那么通过这个方法您的问题可能会重现.

一些问题的产生可能是由于不同编译选项之间预定义符号造成的,因此您可以更改编译模式下的预定义符号,从而使您的Debug模式接近Release模式,观察错误是否产生,更改编译预定义符号方法如下:

  • Alt-F7打开项目设置,在C++/C 页面,选择"General"类别,更改"_DEBUG"符号为"NDEBUG".
  • C++/C 页面, 选择"Preprocessor"类别,添加预定义符号"_DEBUG""Undefined Symbols".
  • 使用"Rebuild All"重新编译

如果通过上面设置,您在Release编译模式下面的问题在Debug模式下重现,那么请您依据以下步骤对您的代码进行修改:

  • 查找ASSERT排除其中的所有重要执行语句,或者将ASSERT修改为VERIFY.
  • 检查"#ifdef _DEBUG" 内所有代码,排除Release模式使用的代码.
  • 查找TRACE 排除其中的所有重要执行语句. TRACEASSERT一样,仅在Debug模式下编译.

如果通过上面修改更正了您在Debug模式下的问题,那么您可以重新编译Release模式,非常有可能您可以解决先前存在的问题!.

错误的假定造成编译模式错误

您是否经常性的假定您的变量或者对象被初试化成某个指定的值(可能0)?您是否假定你所有关联到的资源在应用程序中都存在?这些也是DebugRelease模式下不同问题产生的原因.

规则 4: 除非您在代码中对变量进行初始化,否则不能作出如上假定. 包括全局变量,自动变量,申请对象和new对象.

这种情况还常常发生在内存顺序的问题,记得原来使用结构体的时候为了使用方便,比较两个结构体对象使用memcmp,在Debug版本工作正常,而Release版本计算出错误的解,看来的确不能进行错误的假定!

规则 5: 确保删除资源的所有引用都被删除,例如resource.h中的定义.

软件开发中,不同编译版本对变量和内存的初始化是不同的. 如果您假定变量初始化为0,那么在Win9x系统的Release模式下,会出现异常现象。因此对所有变量,内存显式清0是较为安全的做法.

如果您引用了已经被删除的资源,您的Debug版本可以正常工作,但是Release版本可能会crash.

您是否相信编译器?

编译器警告级别和编译噪音有着相当大的关系.

通过提高编译器警告级别可增加程序隐藏问题暴露的机会.通常设置警告级别在"Level 3"或者 "Level 4".编译并解决所有警告,这是发布Release版本应用程序的一个很好的建议.这能暴露会使您的应用程序出现问题的很多初始化问题和其它潜在的错误.

规则 6: 开始项目之前先将编译警告级别设置在"Level 3" 或者 "Level 4" ,登记代码之前确保消灭所有警告!.

总结报告

编译模式下的调试

曾经不止一次的听到一些VC开发者说Release模式下面不能进行调试,幸运的是:通过相应设置,可以在Release模式进行调试,因此那只不过是一个以讹传讹的荒谬说法而已.

规则 7: 当前面所有的方法都无效的时候,在Release模式下面进行调试.

Release模式可以进行调试,第一步是打开符号表:

  • Alt-F7打开项目设置,在C++/C 页面,选择"General"类,修改Debug Info setting "Program Database".
  • "Link" 页面,选择"Generate Debug Info".
  • "Rebuild All"

这些设置将允许您在Release模式下保留符号表,您也可以同时考虑以下设置:

  • 调试Release版本应用程序,您可以关闭优化选项.
  • 如果在Release模式下面不能设置断点,添加指令"__asm {int 3}" 可以是您的应用程序在改行停止(确定在发布应用程序时候排除这些代码).

Release模式进行调试的几个限制.

  • 最大的问题在于您不能跟踪到MFC函数内部,原因在于Release版本的MFC动态链接库不包含调试信息和符号表.
  • 同上,想要调试调用的dll,您必须给它们全部加上调试信息和符号表.

编译器生成了错误的代码?

或许有的时候您会发现VC++编译器生成了问题代码,然而坦率的讲,人们通常抱怨的太早.您可以在Release模式下面关闭优化选项来进行测试.

如果这个操作解决了您的问题,或许您的编码习惯存在问题. 信不信由你, 极其可能在您的编码中存在模棱两可的求解或者看起来似乎正确,某些条件下也是正确的情况. 举个例子,下面的代码在Debug模式似乎一切正常,而在Release模式下面却会出错!

#include 
 
int* func1()
{
int retval = 5;
return &retval;
}
 
int main(int argc, char* argv[])
{
printf("%d\n", *func1());
return 0;
}

我相信大多数程序员尤其是初学者容易遇到此类情况的.

规则 8: 如果关闭Release模式的优化选项可以使您的应用程序运行正常,而打开优化选项则出现问题的化,原因多半在于您的不良编码习惯造成的. 这意味着必须仔细检查您的代码,清理出那些错误的假设,悬空指针等等. 等同的这告诉您,在Debug模式和关闭优化选项的Release模式下您的应用程序工作正常全是因为系统隐含的运气,您必须着手更正存在隐患的代码,否则在日后可能会造成巨大的损失.

规则 9: 如果您已经彻底检查了您的代码,并且没有发现问题,那么您最好逐个打开优化选项将产生错误的原因限制在某个范围之内.

BTW- 以上问题代码由C++编译器自动检出. 如果您已经遵循 规则 6 您或许在前面环节中已经解决了这些问题.

凭我的开发经验,编译器极少会产生错误的代码(当然要注意接口程序边界对齐的问题).通常在使用模板类时候VC6编译器或许会产生断言ASSERT错误,这种情况您只需更新补丁即可解决.

最后的思考

在日常编码中只需稍微增加一点严格的检测,便能有效的避免新的Debug -v- Release模式问题的产生,以下是我的一些经验.

1. 取出(check out)需要修改的代码.

2. 修改代码,排除所有警告,编译DebugRelease版本.

3. 详细测试新代码,即单步调试新代码段之后进入工作代码,确保代码无误.

4. 更正所有问题.

5. 确认无误之后将新代码登记入库(check in).

6. 对登记入库的代码进行全新的编译,确保新登记代码与其它代码融合.

7. 重新详细测试代码.

8. 更正新问题(或许可以发现登记入库代码存在的问题)

严格按照以上步骤,您在设计开发过程中即可解决大量问题,避免在最后发布应用程序时候产生新的难以定位的问题.

后记

本文是在我的开发历程中遇到Release版本应用程序发布,产生错误的时候苦苦求索得到的一些经验,原文来自于codeproject,经过本人润色,改写成为适合国内开发者的文章,希望能对大家有用,谢谢!


相关文章
调试Release版本应用程序
自动建库的安装程序制作方法
关于AppWizard的定制 添加本地化第一站
VC6帮助文件BUG的修改
科学计算与可视化之二(Matlab C/C++函数库)

2007年4月1日星期日

ZK - Simply Ajax

ZK is Ajax framework enriching Web apps with little programming. With event-driven components and XUL/XHTML markup languages, developing is as simple as programming desktops and authoring HTML pages. Scripting support Java, JavaScript, Ruby, Groovy...

http://www.zkoss.org/
https://sourceforge.net/project/showfiles.php?group_id=152762
需要java基础,与prototype之类的纯javascript库不一样。