2007年8月20日

【FAQ】RPM软件包使用常见问题 [ZZ]

     摘要:   阅读全文

posted @ 2007-08-20 13:21 ashura 阅读(484) | 评论 (0)编辑 收藏

2007年4月28日

花心花语

     摘要: 玫瑰 (Rose)

种类 蔷薇科

别名 无

产地 中国、日本、台湾

花色 花色除了粉红色、红、白、黄以外有许多变色品种,也有杂色品种

花期 春末至秋季

花语 美、爱、恋;

玫瑰本身代表爱情,白色的代表:我尊敬你;红色的代表:热恋;红白混合代表:和解;黄色的代表嫉妒

重点 情人节送花,玫瑰是必然之选,但要注意不同颜色代表的不同意思。

玫瑰英文名rose,源于希腊语rode,红色的意思。法国革命后新生的贵妇人,拿破仑的妻子约瑟芬,在巴黎郊外的玛尔梅逊宅邸建造了一座宏伟的玫瑰园,并命人到欧洲及世界各地搜集珍贵的玫瑰品种;据说在她的玫瑰园里种植着三万株玫瑰,而她的花匠也是史上第一个尝试以人工培玫瑰花种的人,拜她之赐,玫瑰进入了「近代」。约瑟芬请画家鲁道特纪录玫瑰园里玫瑰的姿态,但是未及完成,美人却已香消玉殒。其后鲁道特的画以『玫瑰图谱』出版成册,因而获得『玫瑰画家』的美名。鲁道特纤细、优雅画风,似乎永远歌颂着皇妃约瑟芬未完成的梦,歌颂  阅读全文

posted @ 2007-04-28 12:25 ashura 阅读(627) | 评论 (1)编辑 收藏

C++中的文件输入输出流

     摘要:   C++中的文件输入/输出(3) 原作:Ilia Yordanov,  loobian@cpp-home.com   掌握输入/输出流   在这一章里,我会提及一些有用的函数。我将为你演示如何打开一个可以同时进行读、写操作的文件;此外,我还将为你介绍其它打开文件的方法,以及如何判断打开操作是否成功。因此,请接着往下读! 到目前为止,我已为你所...  阅读全文

posted @ 2007-04-28 11:51 ashura 阅读(2771) | 评论 (0)编辑 收藏

基因芯片[资料整理]

     摘要: 1什么是基因芯片
生物芯片,简单地说就是在一块指甲大小(1cm3)的有多聚赖氨酸包被的硅片上或其它固相支持物(如玻璃片、硅片、聚丙烯膜、硝酸纤维素膜、尼龙膜等,但需经特殊处理。作原位合成的支持物在聚合反应前要先使其表面衍生出羟基或氨基(视所要固定的分子为核酸或寡肽而定)并与保护基建立共价连接;作点样用的支持物为使其表面带上正电荷以吸附带负电荷的探针分子,通常需包被以氨基硅烷或多聚赖氨酸等)将生物分子探针(寡核苷酸片段或基因片段)以大规模阵列的形式排布,形成可与目的分子(如基因)相互作用,交行反应的固相表面,在激光的顺序激发下标记荧光根据实际反应情况分别呈现不同的荧光发射谱征,CCD相机或激光共聚焦显微镜根据其波长及波幅特征收集信号,作出比较和检测,从而迅速得出所要的信息。生物芯片包括基因芯片、蛋白质芯片、组织芯片。而基因芯片中,最成功的是DNA芯片,即将无数预先设计好的寡核苷酸或cDNA在芯片上做成点阵,与样品中同源核酸分子杂交的芯片。  阅读全文

posted @ 2007-04-28 11:10 ashura 阅读(1792) | 评论 (0)编辑 收藏

2007年4月24日

C++的一些免费库

     摘要: C++的一些免费库

原文:C++的一些免费库



//整理 by RobinKin (王亮)

  阅读全文

posted @ 2007-04-24 17:46 ashura 阅读(1991) | 评论 (2)编辑 收藏

最近几天真是累
白天处理数据,晚上写程序
今天找了个理由,吃完午饭就从实验室溜回来了
回来本来想继续写程序
捣鼓了一会
撑不下去
上床了
躺了一个多小时,居然做了三个梦........奇怪的梦....

记得比较清楚的一个是一个不认识的师兄拿了一本C语言×××这类的书,很旧,叫我看,然后还给我演示了一个处理数据的程序后来我接了个电话,他就不讲了.....

posted @ 2007-04-24 17:39 ashura 阅读(343) | 评论 (0)编辑 收藏

2007年4月20日

Game

最近几天常看到师姐在玩一个小游戏,
今天“缠”着师姐教我玩
看得出师姐不是高手^.^
不过师姐英语够牛
这是下载地址
http://www.jollybear.com/bigcityadventuresf/index.html

======================
回学校后居然玩这个游戏到十二点多

posted @ 2007-04-20 20:35 ashura 阅读(210) | 评论 (0)编辑 收藏

爬山

师兄师姐爬山去了
叫我一起去
我没去
跑回学校coding了T。T~~~~

posted @ 2007-04-20 19:37 ashura 阅读(319) | 评论 (0)编辑 收藏

2007年4月15日

[转]如何使用 类进行文件的 I/O 处理

如何使用 <fstream> 类进行文件的 I/O 处理

作者:Danny Kalev
编译:MTT 工作室

下载源代码
原文出处:How to Use <fstream> Classes for File I/O

摘要:传统的文件 I/O 库如 Unix 的 <io.h> 和 <stdio.h> ,由于其程序接口的原因,在很大程度上强制程序员进行某些处理,缺乏类型安全和国际化支持。C++ 的 <fstream> 库则在文件的 I/O 方面提供了一个增强的、面向对象的、具有国际化意识的库。本文将介绍如何使用这个库进行文件的 I/O 处理并利用它来编写易于跨平台的代码。


  大多数 C++ 程序员都熟悉不止一个文件 I/O 库。首先是传统的 Unix 风格的库,它由一些低级函数如 read() 和 open()组成。其次是 ANSI C 的 <stdio.h> 库,它包含 fopen() 和 fread()等函数。其它的还有一些具备所有权的库或框架,比如 MFC,它有很多自己的文件处理类。
  这些库一般都很难跨平台使用。更糟的是,上述提到的 C 库由于其程序接口的原因,在很大程度上强制程序员进行某些处理,而且缺乏类型安全支持。
  标准 C++ 提供提供了一个增强的、面向对象的、具有国际化意识的  <fstream> 库。这个库包含一系列派生于标准 ios_base 和 ios 类的类模板。因此, <fstream> 提供了高级的自动控制机制和健壮性。本文下面将示范如何使用  <fstream> 类实现文件的输入/输出处理:

第一步:创建文件流
  输入文件流(ifstream)支持重载的 >> 操作符,同样,输出文件流(ofstream)支持重载的 << 操作符。结合了输入和输出的文件流被称为 fstream。下面的程序创建了一个 ifstream 对象:dict,并将该对象中的每一个单字显示到屏幕上:

#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
string s;
cout<<"enter dictionary file: ";
cin>>s;
ifstream dict (s.c_str());
if (!dictionary) // were there any errors on opening?
exit(-1);
while (dictionary >> s) cout << s <<''\n'';
}      
  我们必须调用 string::c_str() 成员函数,因为 fstream 对象只接受常量字符串作为文件名。当你将文件名作为参数传递时,构造函数试图打开指定的文件。接着,我们用重载的 !操作符来检查文件的状态。如果出错,该操作符估值为 true。最后一行是个循环,每次反复都从文件读取一个单字,将它拷贝到 s,然后显示出来。注意我们不必显式地检查 EOF,因为重载操作符 >> 会自动处理。此外,我们不用显式地关闭此文件,因为析构函数会为我们做这件事情。
  过时和荒废的 <fstream.h> 库支持 ios::nocreate 和 ios::noreplace 标志。但新的 <fstream> 库已经取代了 <fstream.h> 并不再支持这两个标志。
 
文件的打开模式
  如果你不显式指定打开模式,fstream 类将使用默认值。例如,ifstream 默认以读方式打开某个文件并将文件指针置为文件的开始处。为了向某个文件写入数据,你需要创建一个 ofstream 对象。<fstream> 定义了下列打开模式和文件属性:
ios::app // 从后面添加
ios::ate // 打开并找到文件尾
ios::binary // 二进制模式 I/O (与文本模式相对)
ios::in // 只读打开
ios::out // 写打开
ios::trunc // 将文件截为 0 长度

你可以用位域操作符 OR 组合这些标志:

ofstream logfile("login.dat", ios::binary | ios::app);

fstream 类型对象同时支持读和写操作:

fstream logfile("database.dat", ios::in | ios::out);

第二步:设置文件的位置
  文件具备一个逻辑指针,它指向该文件中的某个偏移位置。你可以通过调用seekp()成员函数,以字节为单位将这个指针定位到文件的任意位置。为了获取从文件开始处到当前偏移的字节数,调用seekp()即可。在下面的例子中,程序将文件位置前移10个字节,然后调用 tellp()报告新位置:

ofstream fout("parts.txt");
fout.seekp(10); // 从0偏移开始前进 10 个字节
cout<<"new position: "<<fout.tellp(); // 显示 10

你可以用下面的常量重新定位文ian指针:

ios::beg // 文件开始位置
ios::cur // 当前位置,例如: ios::cur+5
ios::end // 文件尾

第三步:读写数据
  fstream 类为所有内建数据类型以及 std::string 和 std::complex 类型重载 << 和 >> 操作符。下面的例子示范了这些操作符的使用方法:

fstream logfile("log.dat");
logfile<<time(0)<<"danny"<<''\n''; // 写一条新记录
logfile.seekp(ios::beg); // 位置重置
logfile>>login>>user; // 读取以前写入的值


作者简介
  Danny Kalev 是一名通过认证的系统分析师和软件工程师,专攻 C++ 和形式语言理论。1997 年到 2000 年期间,他是 C++ 标准委员会成员。最近他以优异成绩完成了他在普通语言学研究方面的硕士论文。 业余时间他喜欢听古典音乐,阅读维多利亚时期的文学作品,研究 Hittite、Basque 和 Irish Gaelic 这样的自然语言。其它兴趣包括考古和地理。Danny 时常到一些 C++ 论坛并定期为不同的 C++ 网站和杂志撰写文章。他还在教育机构讲授程序设计语言和应用语言课程。

posted @ 2007-04-15 21:26 ashura 阅读(360) | 评论 (0)编辑 收藏

[转载]VC++常见错误

Visual C++ Error Messages

This page contains a listing of "difficult to diagnose" error messages and possible fixes. I haven't taught a programming class that uses Visual C++ in several years so this list is probably out of date by now.  It was valid for Microsoft Visual C++ version 6.0 service pack 3.

 

C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information

This error results from leaving off the parentheses immediately following the function name in a function header.  To correct the error simply add () to the end of the function name.

 

C1010: unexpected end of file while looking for precompiled header directive

If your project is an MFC AppWizard created project then this error results from not #including StdAfx.h as the first include statement (before any other includes, data declarations, or executable program code).

 

C1083: Cannot open precompiled header file: 'Debug/<Project-Name>.pch': No such file or directory

This error results from a missing file - the compiled version of StdAfx.cpp. Visual C++ does a poor job of keeping track of this file and frequently "forgets" how to build it. This problem often occurs after restoring a saved workspace from diskette without the Debug directory. To fix the error select StdAfx.cpp from the workspace file list them choose Compile from the Build menu.  If that doesn't work the go to Project -> Settings, select the C/C++ tab, and click the radio button labeled Create Precompiled Headers.

 

C2001: newline in constant

This error is usually caused by a string or character constant that is missing its closing ' or " symbol.

C2065: '<data-member name>' : undeclared identifier

If this error occurs in one of your member functions then it is generally the result of forgetting the class scope operator in front of the function name in your .cpp file.

 

C2143: syntax error : missing ';' before 'PCH creation point'

Check each of the include files to ensure that the closing brace of each class declaration is followed by a semicolon.

 


C2143: syntax error : missing ';' before '*'

If this error is followed by two C2501 errors then the problem is an undeclared class name within a pointer declaration.

For example, the declaration:

CClass *pObject;

will generate the above error message followed by a C2501 error message for 'CClass' and another C2501 message for 'pObject'.  The problem is that the compiler isn't recognizing CClass as a valid class/type name.  To correct the problem add a i nclude of the file containing the declaration of CClass (e.g., i nclude CClass.h)

 

C2447: missing function header (old-style formal list?)

This error usually results from a missing { or use of a ; instead of a { following the parameter list of a function header.

 

C2511: '<function-name>' : overloaded member function not found in '<class-name>'

This error results from a mismatch in the parameter list of a member function declaration (.h file) and definition (.ccp file). Check the forward declaration of the function in the .h file and its definition in the .cpp file and ensure that the number of parameters and the type of each parameter match exactly.

C2512: '<constructor-function-name>' : no appropriate default constructor available

This error usually occurs when you implement the constructor function of a derived class and forget to include parameter passing to the base class constructor function.   For example assume that CDerived is derived from CBase and that the CBase constructor function requires one parameter (e.g., int A).  If you define the CDerived constructor function as:

CDerived::CDerived(int A, int B) { ... }

the compiler will issue the above error message on the line containing the function header of CDerived::CDerived() because you haven't provided instructions for routing the parameter A to CBase::CBase().  Because you didn't provide instructions the compiler assumes that CBase::CBase() requires no arguments and it complains because no version of CBase::CBase() has been defined that accepts zero arguments.

If you intended to provide a version of CBase::CBase() that requires no arguments then the error message indicates that you forgot to declare that function in your base class declaration (e.g., in CBase.h).

If CBase::CBase() does require one or more arguments then you must correct the problem by including explicit instructions for passing parameters from the derived class constructor function to the base class constructor function.  The correction for the example above is:

CDerived::CDerived(int A, int B) : CBase(A) { ... }

 

C2556: '<function-name>' : overloaded functions only differ by return type
C2371: '<function-name>' : redefinition; different basic types

These errors usually result from a mismatch of function type between a .h and .cpp file. Check the forward declaration of the function in the .h file and its definition in the .cpp file and make the function return type identical in both files.

 

C2601: '<function-name>' : local function definitions are illegal

This error results from defining one function inside the body of another function.   It usually means that you omitted one or more } symbols in the function just before the function named in the error message.

C2653: '<Class-Name>' : is not a class or namespace name

This error usually results from not having include "StdAfx.h" as the first include statement in your class.cpp file.  It can also occur if your class definition is in a .h file and you forget to include that .h file in another file that refers to the class name.

 

C2661: '<Class-Name>::<Function-Name>' : no overloaded function takes n parameters

This error indicates a mismatch between the parameters used in a function call (e.g., from main.cpp) and the declaration of the function.  The function call is passing n parameters and there is no function declaration that uses that number of parameters.

 

LNK1104: Cannot open file nafxcwd.lib

This error sometimes occurs when a project uses a class from the MFC but the project settings don't explicitly tell the link editor to look in the MFC libraries. 

Go to Project --> Settings (Build --> Settings in Visual C++ 4.0). On the General tab check the box that says "Use MFC in a Shared DLL".

 

LNK1168: cannot open Debug\<Project-Name>.exe for writing

This error occurs when the link editor attempts to write to a .exe file that is currently in use. The .exe file of an executing program is write protected until the program is terminated. Look at the status bar at the bottom of your screen and find the icon representing your executable application. Open the application and exit from it. Then select Build.

 

LNK2001: unresolved external symbol __endthreadex
LNK2001: unresolved external symbol __beginthreadex

These errors result from using an MFC object or function without telling the link editor to search the MFC libraries.

Go to Project --> Settings (Build --> Settings in Visual C++ 4.0). On the General tab check the box that says "Use MFC in a Shared DLL".

LNK2001: unresolved external symbol _main

Your project doesn't contain a function called main().  The error usually results from forgeting to add main.cpp to the project workspace.

 

<File>.obj : error LNK2001: unresolved external symbol "public: void __thiscall <Class1>::<Function1>(<Type>)"

This a generic form of a LNK2001 error where <File>.obj can be any object file in your project and <Class1>::<Function1>(<Type>) can be any function in any class.  Substitute the specific <File>, <Class>, <Function>, and <Type> in your message into the instructions below to diagnose and correct the problem.

An LNK2001 error means that the link editor is looking for a compiled function and can't find it.  The call to the "missing function" is somewhere in <File>.cpp. Unfortunately, double-clicking on the error message won't take you to the point in <File.cpp> where the function is called but you can search for it with Find or Find In Files.  The function the link editor can't find is a member of <Class>, its name is <Function1>, and its return type is <Type>.

There are two common reasons for a LNK2001 error:

1.        The call in <File>.cpp doesn't match the function prototype in <Class>.h and/or the implementation in <Class>.cpp.  The mismatch may be in the function name, return type, or number and/or type of parameters.   Correction strategies include:

o        Check that the function name is spelled the same (case sensitive) in all three files (File.cpp, Class.h, and Class.cpp).

o        Check that the function is actually declared and defined within <Class> - perhaps you defined it as a member of a different class or perhaps you tried to call the function (in <File>.cpp) using an object or object pointer of a different class.

o        Check that the number and type of parameters in the function implementation (in <Class>.cpp) matches the number and type of parameters declared in the function declaration in <Class>.h.

o        Check that the number and type of parameters in the function call (in <File>.cpp) matches the number and type of parameters declared in the function header in <Class>.cpp.

2.        The function was never declared or was declared but never defined.  To see if either is the case go to the ClassView window of the Workspace view.  Click the + next to <Class> and find <Function> in the list of member functions.

o        If <Function> is NOT in the list then it was never declared or defined - add a declaration to the class declaraion in <Class>.h and implement the function in <Class>.cpp.

If <Function> is in the list then right click on it and select Go To Definition from the pop-up menu.  If you get the error message Cannot find definition (implementation) of this function then the function was declared but never defined (implemented).  Implement the function to

o        <Class>.cpp.

 

LNK2005: <some-long-string-of-mostly-garbage> already defined in <name>.lib(<name>.obj)

This error usually results from including a source code file multiple times. If you recognize any of the names in the message then it probably results from multiple inclusion of one of your own header files. Check to be sure that you've used #ifndef/#define/#endif properly your header files. If you don't recognize the name then it's probably multiple inclusion of a system file (e.g., afxwin.h). Make sure that you haven't explicitly included something in main.cpp that is already included in one of your own header files.   Also check that you haven't included a .cpp file where you should have included a .h file

posted @ 2007-04-15 21:24 ashura 阅读(2279) | 评论 (0)编辑 收藏

仅列出标题  下一页
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

导航

统计

常用链接

留言簿(2)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜