<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>可可熊的窝 &#187; C</title>
	<atom:link href="http://cocobear.info/blog/category/my-programming/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://cocobear.info/blog</link>
	<description>K.I.S.S</description>
	<lastBuildDate>Sat, 10 Dec 2011 16:11:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>手动生成X509证书</title>
		<link>http://cocobear.info/blog/2009/10/19/make-x509-cert/</link>
		<comments>http://cocobear.info/blog/2009/10/19/make-x509-cert/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 03:24:04 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[x509]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=737</guid>
		<description><![CDATA[X509证书的详细描述在rfc2459中。 简单的来说X509证书是这样的： Certificate ::= SEQUENCE { tbsCertificate TBSCertificate, signatureAlgorithm AlgorithmIdentifier, signatureValue BIT STRING } TBSCertificate ::= SEQUENCE { version [0] EXPLICIT Version DEFAULT v1, serialNumber CertificateSerialNumber, signature AlgorithmIdentifier, issuer Name, validity Validity, subject Name, subjectPublicKeyInfo SubjectPublicKeyInfo, issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, &#8212; If present, version shall be v2 or v3 subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2009/10/19/make-x509-cert/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>发一个Python版的星际译王</title>
		<link>http://cocobear.info/blog/2009/02/26/python-version-of-sdcv/</link>
		<comments>http://cocobear.info/blog/2009/02/26/python-version-of-sdcv/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 09:35:55 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[sdcv]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=548</guid>
		<description><![CDATA[sdcv-0.4.2版本的代码有3480行，而图形界面的星际译王更是有N多的代码，俺也写了一个就十几行的Python代码，速度当然比不上sdcv，能差十倍，不过，请注意，sdcv查一个单词是0.01秒,我这个是0.1秒，我不觉得有人能感觉出来差别。 其实我的核心是C语言写的，之所以在速度上没有sdcv快是没有做那么些优化，俺只写了80多行，而且还有不少代码是用作Python封装的。我以前写文章说过sdcv代码写的很麻烦，用C语言可以很简洁的写出来，现在确实做到了，只是结合了Python。我觉得这种模式挺不错，影响速度的核心使用C语言去写，然后主逻辑框架使用Python写，不仅效率不会受影响，开发的速度也提高了不少。（我这个例子Python并没做什么） static PyObject * lookup(PyObject *self, PyObject *args) { int fd; char *file_prefix; long file_size; long wc; char *word; char *data; const char *p; long index_size; int offset; int size; int flag = 0; unsigned char *buf; if (!PyArg_ParseTuple(args, &#34;slls:lookup&#34;, &#38;file_prefix, &#38;file_size, &#38;wc, &#38;word)) { return NULL; } char file_name[256]; strcpy(file_name, file_prefix); strcat(file_name, &#34;.idx&#34;); [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2009/02/26/python-version-of-sdcv/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>libevent学习-(I)</title>
		<link>http://cocobear.info/blog/2009/02/23/learning-libevent-i/</link>
		<comments>http://cocobear.info/blog/2009/02/23/learning-libevent-i/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 05:57:32 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[libevent]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=512</guid>
		<description><![CDATA[libevent是一个异步事件处理软件函式库，以BSD许可证释出。 libevent提供了一组应用程序编程接口（API），让程式设计师可以设定某些事件发生时所执行的函式，也就是说，libevent可以用来取代网络服务器所使用的循环检查架构。 摘自维基百科 http://blog.gslin.info/2005/11/network-programming-using-libevent-i.html 这里介绍了libevent相关的网络编程背景，需要带套访问哦。 以下分析针对libevent-1.4.3-stable。 来看libevent自带的例子： /* * Compile with: * cc -I/usr/local/include -o event-test event-test.c -L/usr/local/lib -levent */ static void fifo_read(int fd, short event, void *arg) { char buf[255]; int len; struct event *ev = arg; /* Reschedule this event */ event_add(ev, NULL); fprintf(stderr, &#34;fifo_read called with fd: %d, event: %d, arg: %pn&#34;, [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2009/02/23/learning-libevent-i/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>libev编译篇</title>
		<link>http://cocobear.info/blog/2009/02/07/complie-libev/</link>
		<comments>http://cocobear.info/blog/2009/02/07/complie-libev/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 15:17:13 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[libev]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=508</guid>
		<description><![CDATA[先给出libev的主页http://software.schmorp.de/pkg/libev.html，libev是一个高性能的事件驱动模型，与libevent类似，不过设计更为小巧，简洁。 libevent有成功的应用&#8211;memcached，libev是一个比较新的项目，代码比较少，所以这几天来研究下这个。 首先从CVS中下载最新的代码： cvs -z3 -d :pserver:anonymous@cvs.schmorp.de/schmorpforge co libev CVS代码中有autogen.sh文件，执行该文件会生成configure，我机子上出了点问题，需要首先运行 automake &#8211;add-missing 然后就是./configure &#038;&#038; make &#038;&#038; make install 了。 安装好后会有一个提示： Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2009/02/07/complie-libev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sdcv在amd64上编译问题</title>
		<link>http://cocobear.info/blog/2008/12/18/complie-sdcv-on-amd64/</link>
		<comments>http://cocobear.info/blog/2008/12/18/complie-sdcv-on-amd64/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 05:13:27 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[sdcv]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=424</guid>
		<description><![CDATA[sdcv是stardict的命令行替代，打算用stardict的字典，所以看看如何从字典中取词，sdcv比较小巧，拿来看挺合适，不过在我机子上编译出现了点问题： lib.cpp:516: error: no matching function for call to ‘min(long unsigned int, guint32&#038;)’ 解决办法： -fread(wordentry_buf, std::min(sizeof(wordentry_buf), page_size), 1, idxfile); +fread(wordentry_buf,std::min(sizeof(wordentry_buf),(size_t)page_size),1,idxfile); &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;split&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; 听说WordPress2.7在后台的UI上变化不小，今天试着升级上来，发现果然是完全改变了以前的UI，大量使用了JS，感觉还不错:-) 好久没有Opera了，因为又出现了无法输入的现象，只好去用了Firefox一段时间，今天换了下Ibus输入法，发现可以在Opera里面使用，赶快换回Opera，firefox的速度还是与Opera无法相比的。对了Ibus这个输入法也不错。]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/12/18/complie-sdcv-on-amd64/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>筛选法求质数</title>
		<link>http://cocobear.info/blog/2008/11/18/select-prime-number/</link>
		<comments>http://cocobear.info/blog/2008/11/18/select-prime-number/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 08:59:49 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[编程相关]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=358</guid>
		<description><![CDATA[在这里看到用Lua和Python写的使用筛选法求质数的代码，俺自己也写了写，Python版用到了上面链接中一位兄弟的tips 先来C语言版的: #include &#60;stdio .h&#62; #include &#60;math .h&#62; #define NUM 2000000 int main(void) { int primes[NUM]; int i,j; for (i=0;i&#60;num ;i++) { primes[i] = 1; } primes[0] = 0; primes[1] = 0; for (i=1;i&#60;(long)sqrt(NUM)+1;i++) { if (primes[i]) { for (j=pow(i,2);j&#60;NUM;j+=i) { primes[j] = 0; } } } long sum = 0; for (i=0;i&#60;NUM;i++) { if [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/11/18/select-prime-number/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Ext2文件系统源代码分析(3)</title>
		<link>http://cocobear.info/blog/2008/05/06/ext2-source-code-analysis-3-2/</link>
		<comments>http://cocobear.info/blog/2008/05/06/ext2-source-code-analysis-3-2/#comments</comments>
		<pubDate>Tue, 06 May 2008 01:58:17 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[Ext2]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=271</guid>
		<description><![CDATA[symlink.c: /* * linux/fs/ext2/symlink.c * * Only fast symlinks left here - the rest is done by generic code. AV, 1999 * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * from * * linux/fs/minix/symlink.c * [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/05/06/ext2-source-code-analysis-3-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext2文件系统源代码分析(2)</title>
		<link>http://cocobear.info/blog/2008/05/05/ext2-source-code-analysis-2/</link>
		<comments>http://cocobear.info/blog/2008/05/05/ext2-source-code-analysis-2/#comments</comments>
		<pubDate>Mon, 05 May 2008 14:41:13 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[Ext2]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=269</guid>
		<description><![CDATA[xattr.h: /* File: linux/ext2_xattr.h On-disk format of extended attributes for the ext2 filesystem. (C) 2001 Andreas Gruenbacher, &#60;a .gruenbacher@computer.org&#62; */ #include &#60;linux /init.h&#62; #include &#60;/linux&#62;&#60;linux /xattr.h&#62; /* Magic value in attribute blocks */ #define EXT2_XATTR_MAGIC 0xEA020000 //定义属性block中使用的魔数(一个标记，唯一的值) /* Maximum number of references to one attribute block */ #define EXT2_XATTR_REFCOUNT_MAX 1024 //定义一个属性block /* Name indexes */ [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/05/05/ext2-source-code-analysis-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ext2文件系统源代码分析(1)</title>
		<link>http://cocobear.info/blog/2008/05/05/ext2-source-code-analysis-1/</link>
		<comments>http://cocobear.info/blog/2008/05/05/ext2-source-code-analysis-1/#comments</comments>
		<pubDate>Mon, 05 May 2008 14:03:31 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[Ext2]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=268</guid>
		<description><![CDATA[acl.h: /* File: fs/ext2/acl.h (C) 2001 Andreas Gruenbacher, &#60;a .gruenbacher@computer.org&#62; */ #include &#60;linux /posix_acl_xattr.h&#62; //简单说一下acl(访问控制表)，比传统的Linux具有更灵活的文件权限设定，ext2文件系统的扩展属性支持acl，这一点在编译的时候可以指定。 #define EXT2_ACL_VERSION 0x0001 //定义acl的版本； typedef struct { __le16 e_tag; __le16 e_perm; __le32 e_id; } ext2_acl_entry; //__le16类型的定义： //typedef __u16 __bitwise __le16; //看起来比较复杂，其实（在x86平台下）只是一个unsigned short，__bitwise这个只是通过gcc的扩展使用sparse这个工具来进行代码检查。 //ext2_acl_entry定义访问控制项的结构体 //__le16 e_tag; 自身的使用者或組 //__le16 e_perm; 允许访问的 //__le32 e_id; typedef struct { __le16 e_tag; __le16 e_perm; } ext2_acl_entry_short; [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/05/05/ext2-source-code-analysis-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext2文件系统源代码分析(0)</title>
		<link>http://cocobear.info/blog/2008/04/29/ext2-source-code-analysis-0/</link>
		<comments>http://cocobear.info/blog/2008/04/29/ext2-source-code-analysis-0/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 14:22:26 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[Ext2]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=261</guid>
		<description><![CDATA[Makefile: # # Makefile for the linux ext2-filesystem routines. # obj-$(CONFIG_EXT2_FS) += ext2.o ext2-y := balloc.o dir.o file.o fsync.o ialloc.o inode.o \ ioctl.o namei.o super.o symlink.o ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o ext2-$(CONFIG_EXT2_FS_POSIX_ACL) += acl.o ext2-$(CONFIG_EXT2_FS_SECURITY) += xattr_security.o ext2-$(CONFIG_EXT2_FS_XIP) += xip.o obj-$(CONFIG_EXT2_FS)指定编译生成的目标文件，CONFIG_EXT2_FS变量在配置内核时指定，有三个选项：y,m,x分别代表编译，以模块方式编译，不编译。 ext2-y指定了编译ext2.o时所需要同时编译的其它文件。 下面四个是ext2文件系统的一些扩展属性，也是在编译内核时配置是否使用。 ext2.h: #include &#60;linux /fs.h&#62; #include &#60;/linux&#62;&#60;linux /ext2_fs.h&#62; /* * ext2 mount options [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/04/29/ext2-source-code-analysis-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

