日历
| |||||||||
| 日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
| 1 | 2 | 3 | 4 | ||||||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
| 12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
| 19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
| 26 | 27 | 28 | 29 | 30 | 31 | ||||
搜索标题
最新评论
音乐欣赏
统计信息
- 访问量: 123
- 日志数: 7
- 建立时间: 2008-08-21
- 更新时间: 2008-09-27
我的最新日志
-
framebuffer 配置
2008-9-27
默认屏蔽了framebuffer模开,所以无法在gurb参数上加vga=xxx来启用frame buffer.
解决解决方法:
首先,编辑你的 /etc/initramfs-tools/modules 文件
加入如下三行内容
fbcon
vesafb
vga16fb
最重要的一步,要把文件/etc/modprobe.d/blacklist-framebuffer里面的vesafb和vga16fb这两行给注释掉。
这样你就可以在内核后面加入vga=xxx这样的启动参数了。
最好用hwinfo --framebuffer先看一下显卡支持的vga数值
sudo hwinfo --framebuffer 引用: 02: None 00.0: 11001 VESA Framebuffer
[Created at bios.447]
Unique ID: rdCR.il6towt04X5
Hardware Class: framebuffer
Model: "Intel(r) 82945GM Chipset Family Graphics Chip Accelerated VGA BIOS Intel(r) 82945GM Chipset Family Graphics Controller"
Vendor: "Intel Corporation"
Device: "Intel(r) 82945GM Chipset Family Graphics Controller"
SubVendor: "Intel(r) 82945GM Chipset Family Graphics Chip Accelerated VGA BIOS"
SubDevice:
Revision: "Hardware Version 0.0"
Memory Size: 7 MB + 704 kB
Memory Range: 0xd0000000-0xd07affff (rw)
Mode 0x0305: 1024x768 (+1024), 8 bits
Mode 0x0317: 1024x768 (+2048), 16 bits
Mode 0x0318: 1024x768 (+4096), 24 bits
Mode 0x0312: 640x480 (+2560), 24 bits
Mode 0x0314: 800x600 (+1600), 16 bits
Mode 0x0315: 800x600 (+3200), 24 bits
Mode 0x0301: 640x480 (+640), 8 bits
Mode 0x0303: 800x600 (+832), 8 bits
Mode 0x0311: 640x480 (+1280), 16 bits
Config Status: cfg=new, avail=yes, need=no, active=unknown
在内核后面加入了vga=0x031b,是1280x1024的位色。
最后刷新一下
代码: sudo update-initramfs -u
重启,搞定 -
英文简历模版:最流行的简历模版
2008-9-22
写中文简历,对中国人来说,小菜一碟,但是写英文简历呢?那情况就不一样了,很多人根本不懂英语,于是请朋友代写英文简历,这还好些。还有一些人干脆直接用网上的翻译器翻译,那翻译出来的文章真是让人忍俊不禁。
那么英文简历到底该怎么写呢?其实不难,你只要知道一些常用的英语还有跟自己专业相关的一些英语,再套用一个好的简历模式,就足够了。下面我们就来介绍一种比较适合大众,也是国外最普遍,最流行的一种简历模式:一、首先,自己的姓名,地址,联系方式,比如电话或者电子邮箱等等。一般采用居中的方式,其他的则居左就可以了。如下:
Name
Address
Phone No. Home
Cell phone No.
Email Add二、接着,要写objective(求职意向)。这一栏是最重要的一项了。很多公司主要看这一项的内容是否跟他们 所要求的一致或者接近。比如:
OBJECTIVE:
A sales management or business development position where my strategic and consultative selling, cross-cultural relationship building, team facilitation, business management, organizational insight, and advanced technical skills will be continually challenged. I aspire to senior management responsibility and seek a company that embraces growth and change, where compensation is performance-based and increased levels of responsibility offered those with demonstrated potential. (销售经理职位或者和企业发展有关的职位,可以使我的战略头脑、销售能力、建立跨文化关系的能力、团队能力、商务管理能力、组织能力和先进的技术能力都能 够进一步的发挥和进步。)
上面这个例子是老外的简历中的原句,当然对中国人来说比较复杂,如果对英语要求不高的话,其实也不需写这么多。一般来说可以直接翻译中文简历中的句 子,但是也有很多比较好、大家普遍接受的表达方法,由于各行各业不同,应聘职位也不同,要根据情况而用不同表达。但是如果你想要应聘外企或者所应聘的公司 对英语要求比较高的话就可以把使用的句子修饰一下,当然要在自己的能力范围内哦。三、下面要写summary了,也就是(个人简介)。这可是展现自己能力的一个好机会,既要赞美自己,又不能使对方觉得自己在自夸。
四、Experience 工作经验。这一点,别人可帮不了你,得自己写。不过以什么样的形式写,我可以给大家一个建议,比如:
2005 - Present Company
Sales Executive - Financial Services
Just started an exciting new position selling data integration solutions to the insurance and financial services vertical for Pervasive. Will try to update soon.
上面这个例子中体现的方式是外国人普遍采用的方式。因为外国人从很小的时候就开始独立,那么他们可能从事过很多工作,这种方式即使是罗列很多条也比较 清晰,而且还把时间和当时的职位用一种比较明显的方式标注,也能突出重点。职位下面的那句话就是对你所担任的那个职位简单描述了。
另外要注意的是,如果工作经验很多,也没有必要完全列举出来,可以挑几项自己感觉最得意的或者对自己提升最大的来写。五、再接着要写education(教育背景)。一般从大学开始写起,时间,学校,专业,所获得的学位,还有awards也就是所获的奖项,尤 其是特殊奖项等。(注意:如果教育经历不多的话一般教育和奖项写在一起,但是如果教育背景或者奖项很突出的话,则可以另列一栏。)
以上这些是必写的内容。还有一些可以有选择性的写,比如:Associations(参加的社团组织),现在的公司对计算机或者外语能力都有一定的要 求,所以还可以写自己的Computer background(计算机能力)和Language skills,最后还可以写一栏Personal profile(个人评价),比如:
A dynamic, articulate, talented leader, manager and sales professional who inspires confidence and respect, grasps ideas and concepts quickly, is adept at organizing complex projects, recognizes or creates solutions to problems, believes in setting and achieving goals, and possesses the integrity and commitment to high quality performance that produces outstanding results of lasting value.
除此之外,还可以加上一些个人情况,象婚姻情况,身体状况,业余爱好等等。 -
Writing CUnit Tests
2008-9-19
2. Writing CUnit Test Cases
编写CUnit测试用例
2.1. Test Functions
测试函数
A CUnit "test" is a C function having the signature:
一个CUnit 测试是一个有C函数标识
void test_func(void)
There are no restrictions on the content of a test function, except that it should not modify the CUnit framework (e.g. add suites or tests, modify the test registry, or initiate a test run).
在测试函数的内容上没有任何限制,除了他们修改CUnit 的框架(例如:增加组件或测试用例,或者修改一个测试注册表,或者初始化运行一个测试用例)
A test function may call other functions (which also may not modify the framework).
一个测试函数可能调用其他的函数
Registering a test will cause it's function to be run when the test is run.
当测试运行时,注册的测试会导致这个函数也在运行
An example test function for a routine that returns the maximum of 2 integers might look like:
int maxi(int i1, int i2)
{
return (i1 > i2) ? i1 : i2;
}
void test_maxi(void)
{
CU_ASSERT(maxi(0,2) == 2);
CU_ASSERT(maxi(0,-2) == 0);
CU_ASSERT(maxi(2,2) == 2);
}
2.2. CUnit Assertions
CUnit 断言
CUnit provides a set of assertions for testing logical conditions.
CUnit 为逻辑条件提供丰富的断言
The success or failure of these assertions is tracked by the framework, and can be viewed when a test run is complete.
通过这个框架跟踪到断言的成功或者失败,并且当这个测试运行接手能够看到视图
Each assertion tests a single logical condition, and fails if the condition evaluates to FALSE.
每个断言只测试一个逻辑条件,如果条件被赋值为FALSE为失败
Upon failure, the test function continues unless the user chooses the 'xxx_FATAL' version of an assertion.
一旦失败,测试函数继续测试,除非用户选择"xxx_FATAL"版本的断言
In that case, the test function is aborted and returns immediately.
在这种情况下,测试函数中途失败立刻返回结果
FATAL versions of assertions should be used with caution!
在FATAL 版本的断言应该谨慎使用
There is no opportunity for the test function to clean up after itself once a FATAL assertion fails.
没有任何机会释放测试函数,在他本身经历过一次致命的断言失败
The normal suite cleanup function is not affected, however.
正常的suite销毁函数不会收到影响,尽管如此,
There are also special "assertions" for registering a pass or fail with the framework without performing a logical test.
也有特殊的断言,通过注册或者在失败的框架下,没有执行逻辑测试
These are useful for testing flow of control or other conditions not requiring a logical test:
这些都是有用的测试控制流程或者其他一些条件不需要逻辑测试:
void test_longjmp(void)
{
jmp_buf buf;
int i;
i = setjmp(buf);
if (i == 0) {
run_other_func();
CU_PASS("run_other_func() succeeded.");
}
else
CU_FAIL("run_other_func() issued longjmp.");
}
Other functions called by a registered test function may use the CUnit assertions freely.
These assertions will be counted for the calling function.
They may also use FATAL versions of assertions - failure will abort the original test function and its entire call chain. -
Introduction to Unit Testing with CUnit
2008-9-19
1. Introduction to Unit Testing with CUnit
介绍单元测试和CUnit
1.1. Descrīption
描述
CUnit is a system for writing, administering, and running unit tests in C.
CUnit 可以在C的项目上编写,管理,运行单元测试,
It is built as a static library which is linked with the user's testing code.
它建立一个静态库和用户的代码链接在一起
CUnit uses a simple framework for building test structures, and provides a rich set of assertions for testing common data types.
CUnit 用了一个简单的框架来建立测试结构, 并且为常用的数据类型提供了丰富的断言语句支持。
In addition, several different interfaces are provided for running tests and reporting results.
此外.可以为测试运行和测试报告提供不同的接口
These include automated interfaces for code-controlled testing and reporting, as well as interactive interfaces allowing the user to run tests and view results dynamically.
还包括控制代码的测试和报告的自动化界面,以及交互式界面也考虑到用户测试的运行和动态结果视图
The data types and functions useful to the typical user are declared in the following header files:
典型的用户用到数据类型和功能会使用以下头文件:
Header File Descrīption
#include <CUnit/CUnit.h> ASSERT macros for use in test cases, and includes other framework headers.
ASSERT 宏用于测试用例也包括其他框架头文件
#include <CUnit/CUError.h> Error handing functions and data types. Included automatically by CUnit.h.
#include <CUnit/TestDB.h> Data type definitions and manipulation functions for the test registry, suites, and tests. Included automatically by CUnit.h.
#include <CUnit/TestRun.h> Data type definitions and functions for running tests and retrieving results. Included automatically by CUnit.h.
#include <CUnit/Automated.h> Automated interface with xml output.
自动化界面与xml 输出
#include <CUnit/Basic.h> Basic interface with non-interactive output to stdout.
基础界面与非交互式标准输出
#include <CUnit/Console.h> Interactive console interface.
交互式控制台界面
#include <CUnit/CUCurses.h> Interactive console interface (*nix).
交互式控制台界面(unix)
#include <CUnit/Win.h> Windows interface (not yet implemented).
windows界面(没有实现)
1.2. Structure
结构
CUnit is a combination of a platform-independent framework with various user interfaces.
CUnit 是一个结合各种用户界面的独立平台框架
The core framework provides basic support for managing a test registry, suites, and test cases.
该框架核心提供了基本的支持,管理一个测试的注册表,组件,测试用例.
The user interfaces facilitate interaction with the framework to run tests and view results.
用户界面容易在交互式作用的框架内进行测试和查看结果
CUnit is organized like a conventional unit testing framework:
CUnit 的组织像传统的单元测试框架
Test Registry
|
------------------------------
| |
Suite '1' . . . . Suite 'N'
| |
--------------- ---------------
| | | |
Test '11' ... Test '1M' Test 'N1' ... Test 'NM'
Individual test cases are packaged into suites, which are registered with the active test registry.
个别几个测试用例封装到suites里面,该组件被注册,并且激活该注册表
Suites can have setup and teardown functions which are automatically called before and after running the suite's tests.
在运行Suite测试前后,suite能够自动调用装载和卸载的功能,
All suites/tests in the registry may be run using a single function call, or selected suites or tests can be run.
所有的suites/测试都有可能执行一个简单的功能或者选择一个suites 或者执行一个测试用例调用注册表
1.3. General Usage
A typical sequence of steps for using the CUnit framework is:
使用CUnit的一个典型步骤是:
1. Write functions for tests (and suite init/cleanup if necessary).
编写一个测试函数 (suite 初始化和销毁)
2. Initialize the test registry - CU_initialize_registry()
初始化测试注册表
3. Add suites to the test registry - CU_add_suite()
添加suites 到注册表
4. Add tests to the suites - CU_add_test()
添加测试用例到注册表
5. Run tests using an appropriate interface, e.g. CU_console_run_tests
运行测试用例使用一个合适的界面
6. Cleanup the test registry - CU_cleanup_registry
释放测试注册表
1.4. Changes to the CUnit API in Version 2
转到第2版,CUnit API
All public names in CUnit are now prefixed with 'CU_'.
在CUnit中,现在所有公共的名字都要加上前缀"CU_"
This helps minimize clashes with names in user code.
在用户代码中,有助于减少名字相同
Note that earlier versions of CUnit used different names without this prefix.
注意在早期版本CUnit使用不同的名字,没有前缀
The older API names are deprecated but still supported.
老的API,仍然支持
To use the older names, user code must now be compiled with USE_DEPRECATED_CUNIT_NAMES defined.
使用旧的名称,用户必须在编译代码的是定义 USE_DEPRECATED_CUNIT_NAMES
The deprecated API functions are described in the appropriate sections of the documentation.
在部分文档中描述废弃的API -
cunit
2008-9-18
http://cunit.sourceforge.net/doc/writing_tests.html
http://linux.chinaunix.net/techdoc/develop/2008/07/29/1021460.shtml
http://cunit.sourceforge.net/doxdocs/globals_func.html
-
valgrind 使用
2008-8-21
除了mtrace函数可以检查内存泄漏,使用valgrind也可以检测出内存泄漏,不管使用那个,都要正常的操作。正常的退出。
首先,apt-get install valgrind 或者yun 一下也行,下个源码包就行了,呵呵 。
可以man valgrind 。里面有好多的选项,平时大家只要使用这几个选项就差不多了
valgrind --tool=memcheck --leak-check=yes ./二进制文件
第二,进行正常的操作后,退出
第三,注意 LEAK SUMMARY:信息:
工具会把认为有内存泄漏的地方,都会列出来.
根据结果信息,就可以找到错误的代码了
-
mtrace 检测内存泄漏函数
2008-8-21
在linux C下,研发大侠在写完代码后,基本上会使用mtrace函数,在pc上进行内存泄漏测试。
mtrace函数的具体使用:
1.在main()函数的最开始包含一个函数调用:mtrace()。由于在main函数的最开头调用了mtrace(),所以该进程后面的一切分配和释放内存的操作都可以由mtrace来跟踪和分析。2.export MALLOC_TRACE=mymemory.log定义一个环境变量,用来指示一个文件。该文件用来输出log信息。
3.正常运行程序。此时程序中的关于内存分配和释放的操作都可以记录下来。
4.然后用mtrace使 用工具来分析log文件。
mtrace testmem $MALLOC_TRACE
有兴趣的可以动手试试


