<?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; sdcv</title>
	<atom:link href="http://cocobear.info/blog/tag/sdcv/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>更新两个小脚本</title>
		<link>http://cocobear.info/blog/2009/03/20/upgrade-two-python-script/</link>
		<comments>http://cocobear.info/blog/2009/03/20/upgrade-two-python-script/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 09:32:12 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[pysdcv]]></category>
		<category><![CDATA[sdcv]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=583</guid>
		<description><![CDATA[一个是以前写的导出抓虾收藏的工具，增加了保存抓虾上文章的功能，因为只导出链接有些文章地址可能已经失效。 另一个就是pysdcv，前面文章介绍过了，整理了一下，测试了一下，然后放在了google code上面，直接使用星际译王的词典，查一个单词大概0.15秒的时间： cocobear@0-0 /home/cocobear/Work/pytool/pysdcv $ make gcc lookup.c -g -I/usr/include/python2.5 -lz -shared -fPIC -o lookup.so cocobear@0-0 /home/cocobear/Work/pytool/pysdcv $ time ./pysdcv.py test *[test] n. 测试, 试验, 化验, 检验, 考验, 甲壳 vt. 测试, 试验, 化验 vi. 接受测验, 进行测试 【医】 试验, 测验 【经】 检验, 试验, 测试 相关词组: put sth to the test stand the test give a [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2009/03/20/upgrade-two-python-script/feed/</wfw:commentRss>
		<slash:comments>4</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>关于Stardict的字典</title>
		<link>http://cocobear.info/blog/2008/12/31/dict-of-stardict/</link>
		<comments>http://cocobear.info/blog/2008/12/31/dict-of-stardict/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 05:37:24 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[pystardict]]></category>
		<category><![CDATA[sdcv]]></category>
		<category><![CDATA[stardict]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=433</guid>
		<description><![CDATA[前几天看了下sdcv(Console version of Stardict)，感觉很不爽，C++的代码，花了好长时间才理清楚那些结构，我觉得使用C语言来写的话可以让代码更清晰、简洁，或者C++也可以写得更好一些。因为本来就是个很简单的东西，从一个文件中读取单词索引，然后与输入比较，最后在另外一个文件里面查到解释，加上一些模糊匹配，如果需要再加上对国际化的支持，就这些东西。 因为打算在我做的东西里面使用字典，想用stardict的字典，找到了一个PyStardict，不过速度太慢了，加载一个11M的字典需要10s的时间，原因是字典的idx文件中存放的索引使用Python需要一个字节一个字节的去判断字符串长短，而sdcv在实现的时候使用的是C++，它里面读idx文件的时候使用到了指针来确实一个字符串的大小，而Python没办法做到，只能一个一个读然后判断是否字符串结束。 sdcv-0.4.2/lib/lib.cpp:629: for (guint32 i=0; i&#60;wc; i++) { index_size=strlen(p1) +1 + 2*sizeof(guint32); if (i % ENTR_PER_PAGE==0) { wordoffset[j]=p1-idxdatabuffer; ++j; } p1 += index_size; } 谁有什么好的办法吗？]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/12/31/dict-of-stardict/feed/</wfw:commentRss>
		<slash:comments>3</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>vim中使用sdcv(stardict CLI版)</title>
		<link>http://cocobear.info/blog/2008/05/19/vim-sdcv/</link>
		<comments>http://cocobear.info/blog/2008/05/19/vim-sdcv/#comments</comments>
		<pubDate>Mon, 19 May 2008 07:31:36 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[sdcv]]></category>
		<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=280</guid>
		<description><![CDATA[这里介绍的vim中使用辞典查词的方法不错，利用了vim的一些特性，这样平时使用vim的时候就可以手不离键盘要完成查词了。 sdvc是命令行版的Stardict,可以在这里下载，目前最新的版本是0.4.2，不过在ADM64平台下编译会出错，我在网上找到了一个补丁，不过这个补丁是针对debain用户的，有些用不上，那些找不到文件的patch就可以直接忽略掉。 如果在gvim中使用则在~/.gvimrc中添加： function Mybln() let expl=system('sdcv -n ' . \ v:beval_text . \ '&#124;fmt -cstw 40') return expl endfunction set bexpr=Mybln() set beval 如果直接在vim中使用，则在~/.vimrc中添加： function! Mydict() let expl=system('sdcv -n ' . \ expand(&#34;&#60;cword&#62;&#34;)) windo if \ expand(&#34;%&#34;)==&#34;diCt-tmp&#34; &#124; \ q!&#124;endif 25vsp diCt-tmp setlocal buftype=nofile bufhidden=hide noswapfile 1s/^/\=expl/ 1 endfunction nmap F :call Mydict()&#60;cr&#62; gvim中鼠标移动到单词上就可以得到翻译，在vim中光标移动到单词上，使用shift＋f可以新分割出来一个窗口显示单词的翻译。 [...]]]></description>
		<wfw:commentRss>http://cocobear.info/blog/2008/05/19/vim-sdcv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

