<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-34562618</id><updated>2024-03-13T19:18:47.441+08:00</updated><title type='text'>Wenshu cBlog</title><subtitle type='html'>c代表coding...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default?alt=atom&amp;start-index=26&amp;max-results=25'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>163</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-34562618.post-1972763200872456541</id><published>2008-01-27T14:23:00.001+08:00</published><updated>2008-01-27T14:23:06.221+08:00</updated><title type='text'>blog搬家了</title><content type='html'>终于...多个原因促使我将blog再次搬家了：&lt;br&gt;&lt;br&gt;- Blogger虽然不错，无奈隔了一堵墙，这还是带来了不小的麻烦。&lt;br&gt;- 如果想给blog做一些自己想要的定制特性的话，基于空间自建的blog是更好的选择，加上对wordpress神往已久，终于决定加入wordpress的大家庭。&lt;br&gt;&lt;br&gt;这次的搬迁算是相当顺利（因为有那个&lt;a href=&quot;http://miian.com&quot;&gt;blog同步工具&lt;/a&gt;的帮忙），但也有一些损失，如下：&lt;br&gt; - 所有的留言都丢了，还好我的留言不多，但还是感觉有些遗憾。&lt;br&gt;- 帖子的分类信息也丢了，不过这个我可以一点点补回来，暂时还没来得及做。&lt;br&gt;&lt;br&gt;回顾一下我的blog经历：&lt;br&gt;- 2003年5月，开始写blog（那时还叫做weblog），当时是放在我自己的PC上，用一些CMS程序来做blog，比如我用过mambo和PostNuke（在用这些CMS之前，我还自己用PHP写过一些，不过那时觉得太麻烦了，一个留言本都需要花很多时间搞）。&lt;br&gt; - 2003年7月，我发现了&lt;a href=&quot;http://cafelog.com/&quot;&gt;b2&lt;/a&gt;，这个在现在看来应该算是非常标准的blog程序了，在此后很长的时间内，我一直用b2作为我的blog程序，现在这个程序还可以从网上下载，但已经很久没有更新过版本了。&lt;br&gt;- 2003年8月，买了一个空间和域名，开始了比较正规的blog生涯。&lt;br&gt;- 2004年10月，这个空间的问题慢慢暴露出来了，服务比较差，带宽分配不合理以及强制广告等等，我的blog的积极性也慢慢降低了。&lt;br&gt; - 2005年，因为空间商和我自己的问题，我的blog几乎是停止了更新，这一直延续到2006年。&lt;br&gt;- 2006年，是比较彷徨的一年，我尝试了国内的一些blog服务商，比如blogbus，donews，都没能坚持下来，总是有这样那样的问题。我还考虑了很久是否搭建一个wiki来代替我的blog，并花了不少时间维护了一个个人wiki，最终我否定了这个想法。&lt;br&gt;- 2006年9月，我切换到了Blogger，这次切换看来是相当的明智，自此之后我blog的频率逐渐恢复了，并开始使用Gmail来发blog。&lt;br&gt; - 2007年一年是我的blog历史中最高产的一年，这应该得益于Gmail和Blogger的组合，非常感谢google。&lt;br&gt;- 现在，2008年1月，我再次切换到了wordpress，这个决定会对我的blog如何影响，需要在未来靠时间来检验了。&lt;br&gt;&lt;br&gt;最后也是最重要的，亲爱的读者们（如果有的话），请更新你们的地址栏，到 &lt;a href=&quot;http://www.liuzhongshu.com&quot;&gt;http://www.liuzhongshu.com&lt;/a&gt;，这是我的blog的新家，使用rss的朋友们，也请更新地址到: &lt;a href=&quot;?shva=1&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://www.liuzhongshu.com/feed&quot;&gt;http://www.liuzhongshu.com/feed&lt;/a&gt;，我原来的Blogger将会停止更新。&lt;br&gt; &lt;a href=&quot;?shva=1&quot;&gt;&lt;/a&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1972763200872456541/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1972763200872456541' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1972763200872456541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1972763200872456541'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/blog.html' title='blog搬家了'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1379224337260278203</id><published>2008-01-24T19:01:00.001+08:00</published><updated>2008-01-24T19:01:47.067+08:00</updated><title type='text'>设置Sun J2ME模拟器</title><content type='html'>Sun的模拟器我感觉还是不错的，不过还可以给它们做很多设置，在&lt;br&gt;&lt;br&gt;/usr/local/netbeans-6.0/mobility8/WTK2.5.2/wtklib/devices&lt;br&gt;&lt;br&gt;下面可以看到每种设备有一个目录，在每个目录下都有一个xxx.properties （xxx取决于设备名）文件，编辑这个文件就可以设置某类模拟器的很多细节参数，比如&lt;br&gt;&lt;br&gt;设置 touch_screen = true 就可以得到一个带触摸屏的模拟器（当然要运行的程序也支持触摸屏，才能看到效果），Cool。 &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1379224337260278203/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1379224337260278203' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1379224337260278203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1379224337260278203'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/sun-j2me.html' title='设置Sun J2ME模拟器'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-7607483711979992563</id><published>2008-01-23T19:21:00.001+08:00</published><updated>2008-01-23T19:21:13.821+08:00</updated><title type='text'>flickr API</title><content type='html'>flickr API用起来还是很方便的，记录一下：&lt;br&gt;&lt;br&gt;&lt;b&gt;申请key&lt;/b&gt;&lt;br&gt;lickr的所有API都需要api_key，商业使用需要申请，个人使用也需要&lt;a href=&quot;http://www.flickr.com/services/api/keys/apply/&quot;&gt;申请&lt;/a&gt;，但很简单，只是在Web上填个表单就可以了（需要flickr帐号），这样就可以得到一个很长的api_key。&lt;br&gt;&lt;br&gt;&lt;b&gt;格式&lt;/b&gt;&lt;br&gt; 使用flickr API可以使用很多种格式，输入（Request）可以是REST/XML/SOAP格式，输出（Response）则更多，可以有REST/XML/SOAP/JSON/PHP等格式，最常见的输入格式就是REST格式，给个URL就可以了，并且可以通过工具curl在命令行下面测试。&lt;br&gt;&lt;br&gt;&lt;b&gt;curl&lt;br&gt;&lt;/b&gt;curl是一个命令行工具，用于各种URL交互，在Ubuntu下只需要sudo apt-get install curl就可以了，然后可以用curl来测试flickr的API，下面是用REST输入格式获取flickr的interesting图片的方法： &lt;br&gt;curl &lt;a href=&quot;http://api.flickr.com/services/rest/?method=flickr.interestingness.getList%5C&amp;amp;api_key=xx%5C&amp;amp;per_page=5&quot; target=&quot;_blank&quot;&gt; http://api.flickr.com/services/rest/?method=flickr.interestingness.getList\&amp;amp;api_key=xx\&amp;amp;per_page=5&lt;/a&gt; &lt;br&gt;这个API（flickr.interestingness.getList）会返回一组图片列表，这个API除了api_key参数外（这里api_key随便写了一个值），还带了另一个参数per_page表示每次返回几张图片。另外注意&amp;amp;前要用的反斜杠(因为在shell下&amp;amp;是个特殊字符）&lt;br&gt;&lt;br&gt;&lt;b&gt;图片&lt;/b&gt;&lt;br&gt;很多API（比如上面的那个）会返回一些图片的列表，包含访问具体图片的参数， 可以用这些参数（比如图片ID，图片所在的server ID等）就可以构造得到一个图片URL，来访问flickr上的图片（包括剪裁后的各种图片），很方便。 &lt;br&gt;&lt;br&gt;全部的API都在&lt;a href=&quot;http://www.flickr.com/services/api/&quot;&gt;网站&lt;/a&gt;上列的很详细，简单易用。 </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/7607483711979992563/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/7607483711979992563' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/7607483711979992563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/7607483711979992563'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/flickr-api.html' title='flickr API'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1524784698934227804</id><published>2008-01-21T19:02:00.001+08:00</published><updated>2008-01-21T19:02:06.716+08:00</updated><title type='text'>Nokia 模拟器的调式</title><content type='html'>使用Nokia模拟器可以很方便的在PC上调试midlet，不过我用下来最深的感受是，慢。。。&lt;br&gt; &lt;br&gt;也许是我的PC性能不佳，也有可能是这个Nokia Emulator优化不够，又或是Windows系统有关，反正在Netbeans里面，直接调用Nokia Emulator来调试的话，肯定是Emulator连不上而超时（因为模拟器还在那慢腾腾的启动呢），如果先用一般的run模式启动模拟器运行一下midlet，然后不关闭模拟器，再选调试就可以了。&lt;br&gt;&lt;br&gt;Nokia的SDK包还支持真机调试，需要在手机上装一个Debug agent，我还没有试过，不过Nokia模拟器的模拟度似乎很高，估计大部分情况时是不需要这个牛刀的。。。 &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1524784698934227804/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1524784698934227804' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1524784698934227804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1524784698934227804'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/nokia_21.html' title='Nokia 模拟器的调式'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1135471307870877980</id><published>2008-01-20T19:16:00.001+08:00</published><updated>2008-01-20T19:16:50.225+08:00</updated><title type='text'>Nokia 模拟器</title><content type='html'>在Nokia网站上下载Java开发SDK，可以得到一个不错的模拟器，不仅可以支持J2ME开发，用来在PC上玩&quot;手机&quot;也不错的。可惜目前支持Windows系统&lt;br&gt;&lt;br&gt;下载&lt;br&gt;在&lt;a href=&quot;http://www.forum.nokia.com/main/resources/tools_and_sdks/index.html&quot;&gt;Nokia的网站&lt;/a&gt;上选择合适的平台下载即可，我的手机是N73，自然选择S60，进去以后，页面后边可以看到有一个下拉框，列出了多个下载选项，比如 3rd Edition, FP2, Beta，这个就是S60v3的开发包了，FP2是指Feture pack2，相当于小版本号（反正我这么理解的）。选择这个就ok了，由于模拟器带了大量的手机程序，所以这个包很大。 &lt;br&gt;&lt;br&gt;安装&lt;br&gt;安装这个包很简单，安装完后，通常也要在J2ME开发环境中通知一下有了这个模拟器，在Netbeans，只需要在Java Platform对话框下把这个Nokia S60 Platform加进来就OK了（Netbeans会让选择一个目录）。&lt;br&gt;&lt;br&gt;运行&lt;br&gt;运行之前，可以在Windows的Start菜单中，将这个模拟器切换为中文（不过中文汉化的不完全，有少量信息还是英文的），然后启动模拟器，就看到Nokia的一个&quot;模拟手机&quot;了，可是我运行了几遍都不能让这个手机&quot;开机&quot;，无奈， 使用命令行运行开发包下的一个sdk.exe（文档中这么写的），就可以了，不过很慢，要等10秒左右才看到&quot;手机&quot;的开机画面，以后再通过Start菜单运行模拟器，也可以&quot;开机&quot;了，大部分Nokia手机程序都在里面，还可以切换主题，很酷的样子，找时间试试里面的手机&quot;硬件&quot;，看看音乐播放/USB/红外/蓝牙是怎么模拟的，不过文档中如此说到，相机是模拟不了的，呵呵。&lt;br&gt;&lt;br&gt;开发&lt;br&gt;如果是之前的Netbeans Project想使用这个新的模拟器，一定要为项目建立一个新的Configuration，并选择从Nokia S60 Platform中继承选项，而不能直接在原先的Sun模拟器上改（反正我这样做的结果是：运行时Nokia模拟器起不来）。不知什么原因，Netbeans6在Windows下的启动速度比Linux下慢很多（大约58秒vs30秒），怎么差这么多？ &lt;br&gt;&lt;br&gt;输入法&lt;br&gt;用这个版本的模拟器，可以看到它支持了中文拼音词组输入（这个应该可以比之前的输入法快不少），不错哈，不知什么时候能在我的N73真机上用。不过这个模拟器模拟的程度太高，在编辑框输入中文，居然不能用Windows的输入法（只能输进去英文），只能用下面的虚拟键一个个点，好慢啊。&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1135471307870877980/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1135471307870877980' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1135471307870877980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1135471307870877980'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/nokia.html' title='Nokia 模拟器'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1357283445302372785</id><published>2008-01-16T19:34:00.001+08:00</published><updated>2008-01-16T19:34:39.392+08:00</updated><title type='text'>MIDP 实例 I</title><content type='html'>下面是一个简单的midlet，它会在屏幕上显示字符串Commander，并显示一个Exit的软键，按下这个软键会退出程序。&lt;br&gt; &lt;b&gt;&lt;br&gt;源码&lt;/b&gt;&lt;br&gt;import javax.microedition.midlet.*;&lt;br&gt;import javax.microedition.lcdui.*;&lt;br&gt;public class Commander extends MIDlet {&lt;br&gt;&amp;nbsp; public void startApp() {&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Displayable d = new TextBox(&amp;quot;TextBox&amp;quot;, &amp;quot;Commander&amp;quot;, 20,  TextField.ANY); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Command c = new Command(&amp;quot;Exit&amp;quot;, Command.EXIT, 0); &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.addCommand(c);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.setCommandListener(new CommandListener() {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void commandAction(Command c, Displayable s) { &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; notifyDestroyed();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } );&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Display.getDisplay(this).setCurrent(d);&lt;br&gt;&amp;nbsp; }&lt;br&gt;&amp;nbsp; public void pauseApp() { }&lt;br&gt;&amp;nbsp; public void destroyApp(boolean unconditional) { } &lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;b&gt;说明&lt;/b&gt;&lt;br&gt;这里涉及了MIDP程序的几个基本概念：&lt;br&gt;* MIDP程序被称为midlet，它的生命周期很简单，创建并构造后处于paused状态，然后通过StartApp进入Actived状态，退出时会调用DestroyApp函数，而actived状态可以通过调用pauseApp()回到paused状态，因此，一个midlet总是能看到这几个基本函数， 这几个函数通常是被应用程序管理器调用的，但程序自己也可以调用（下面讲解）。 &lt;br&gt;* Display对应了整个midlet的显示部分，它有可能是不可见的（比如处于后台的midlet），而在Display上，自然可以设置Displayable对象，这个Displayable对象就象一般的GUI widget，有其家族谱系，不过在MIDP中，GUI widget比较简单，上面的例子用到的是TextBox。&lt;br&gt;* MIDP对用户输入做了高度抽象，Command就是抽象后的产物，它表示MIDP设备（比如手机）的一个输入，不同的设备上的Java实现会将Command对应到设备的某个输入上，比如使用软键，触摸屏等。多个Command可以加入到一个Displayable对象上，表示在显示这个对象时可执行的多个动作，而这些Command的安排也由Java实现去安排（比如组织为多个软键，或菜单）。 &lt;br&gt;* Command可以注册一个CommandListener来执行command的响应，实际上就是一个回调函数了。上面的例子很简单，为了退出，调用了一个notifyDestroyed。&lt;br&gt;&lt;br&gt;&lt;b&gt;NotifyDestroyed和DestroyApp（boolean）&lt;/b&gt;&lt;br&gt;这个区别很重要：&lt;br&gt;* 当midlet被强制退出（比如用户通过程序管理器杀程序），DestroyApp会被调用，并带参数true，这种情况下notifyDestroyed不会被调，也不需要主动调。 &lt;br&gt;* 而应用程序自己希望退出时，比如用户按了什么键，或工作已经做完了，那么应该调用NotifyDestroyed()，这时DestoyApp不会被触发，但通常主动退出前，也需要清理资源，所以一般的程序会在NotifyDestroyed前调用DestroyApp，会了和上面的退出区别，通常会带个false参数，但实际上这种情况下，不是一定要DestroyApp（比如没有资源需要释放），也不是一定要带false参数（比如没有什么需要和强杀区别，所以也可以带true参数）。 &lt;br&gt;&lt;span&gt;&lt;/span&gt;&lt;br&gt;&lt;b&gt;编译和发布&lt;/b&gt;&lt;br&gt;在Netbeans里面，无论选择何种configuration，这小程序都是能编译，仿真运行的，但要是想发布到手机上，必须选择合适的Device Configuration和Device Profile（Device倒是无所谓，似乎只影响仿真），比如对于N73，缺省的MIDP-2.1会导致最终程序无法在手机上安装，降为MIDP-2.0就可以了。&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1357283445302372785/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1357283445302372785' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1357283445302372785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1357283445302372785'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/midp-i.html' title='MIDP 实例 I'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-6482533250186091365</id><published>2008-01-15T19:27:00.001+08:00</published><updated>2008-01-15T19:27:32.443+08:00</updated><title type='text'>Linux下开发Nokia，难</title><content type='html'>想在Linux开发Nokia手机程序，怕是要失望了， Nokia的java SDK只支持在Windows下使用， 这很让人难以理解，从集成开发环境（Netbeans或Eclipse），到Sun的J2ME SDK参考实现，以及Sun的虚拟机都支持了Linux平台，为什么Nokia不支持呢？ Nokia的网站上看到一些解释是虚拟机在Linux下实现工作量大，不过我觉得这只是一个借口，还是没有重视Linux，哎，短视啊。&lt;br&gt;&lt;br&gt;不过索爱，摩托也不支持Linux，摩托更可气，它的手机上已经在跑Linux，却需要在Windows下开发Java应用程序，看看 &lt;a href=&quot;http://developer.motorola.com/docstools/sdks/linux64/&quot;&gt;这里&lt;/a&gt; 。&lt;br&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/6482533250186091365/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/6482533250186091365' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/6482533250186091365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/6482533250186091365'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/linuxnokia.html' title='Linux下开发Nokia，难'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1608905648008164946</id><published>2008-01-14T19:49:00.001+08:00</published><updated>2008-01-14T19:49:42.533+08:00</updated><title type='text'>Netbeans 6</title><content type='html'>很多人热炒这个版本的Netbeans，并将之提到和Eclipse直接竞争的角度，本着实事求是的原则，我新鲜试用了Netbeans 6。&lt;br&gt;&lt;br&gt;&lt;b&gt;安装&lt;/b&gt;&lt;br&gt;我用apt-get可以直接安装netbeans5.5.1，但令我意外的是，安装后总是不能正常启动，提示找不到jdk，而我是安装有jdk1.5的（猜想这个问题可能和我机器上安装的jre6有关）。 由于Sun的网站上还有&lt;a href=&quot;http://dlc.sun.com.edgesuite.net/netbeans/6.0/final/&quot;&gt; Netbeans 6的下载&lt;/a&gt;，加上我更想试用6.0，我便下载了Netbeans6（这个版本不能通过apt-get安装），Netbeans6的安装很方便，下载下来的50多M的sh文件，直接运行就可以安装了。&lt;br&gt;&lt;br&gt;注： Netbeans6是按照套件的方式下载的，而不象以前的版本要先安装主IDE，再一个个装插件，这种套件的方式要方便很多。&lt;br&gt;&lt;br&gt;&lt;b&gt;Hello,Wold&lt;br&gt;&lt;/b&gt;官方网站上的&lt;a href=&quot;http://www.netbeans.org/kb/index.html&quot;&gt; 文档&lt;/a&gt;写的不错（起码我目前的感觉是这样），我实验了Quick Start Guide的几个教程，都写的非常好，按部就班下来，很有些感觉（NetBeans Mobility带的几款手机模拟器好漂亮）。&lt;br&gt;&lt;br&gt;&lt;b&gt;印象&lt;/b&gt;&lt;br&gt;Netbeans 6的启动速度很快，功能强大，编辑器给我留下了深刻的印象，非常智能，所有的菜单，工具的布局都比较&quot;常规&quot;（这是相对于eclipse给我留下的&quot;晦涩&quot;的印象所对比的），基本的IDE的功能，诸如工程，编译，调试，仿真（针对J2ME）都做的很好，起码到目前为止，我对Netbeans印象颇佳，超出了eclipse几分，也许我会再花一些时间深入使用一下看看。 &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1608905648008164946/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1608905648008164946' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1608905648008164946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1608905648008164946'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/netbeans-6.html' title='Netbeans 6'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-3260445345231976397</id><published>2008-01-02T19:55:00.001+08:00</published><updated>2008-01-02T19:55:33.804+08:00</updated><title type='text'>asciidoc 自定义</title><content type='html'>asciidoc提供了完整的css供用户自定义，每个用户总有些自己的格式化方面的需求需要通过css来定制，我用了一段时间，对于css有以下几个修改（/usr/share/asciidoc/stylesheets/xhtml11.css）：&lt;br&gt;&lt;br&gt;× 段落行间距，这是因为如果不定义这个，则在打印时（firefox），行间距过小，但在显示器中浏览时却是正常的，我没有去细究为什么，反正简单修改一下就好了。在段落的定义中增加 line-height:  1.5，现在的定义如下：&lt;br&gt;p {&lt;br&gt;&amp;nbsp; margin-top: 0.5em;&lt;br&gt;&amp;nbsp; margin-bottom: 0.5em;&lt;br&gt;&amp;nbsp; line-height: 1.5; &lt;br&gt;}&lt;br&gt;&lt;br&gt;× 我喜欢用literal block（一种段落样式，在ascdoc中用&amp;quot;.....&amp;quot;来定义）来引用代码，缺省的literal block字体偏大了（也是打印时，在显示器上没有问题），我增加下面一个css定义： &lt;br&gt;div.literalblock {&lt;br&gt;&amp;nbsp; font-size: small;&lt;br&gt;}&lt;br&gt;&lt;br&gt;× 我不喜欢缺省的1px的图像边框，因此我改了下面的语句到0px：&lt;br&gt;div.imageblock img { border: 0px solid silver; }&lt;br&gt;&lt;br&gt;所有的改动就是这些，得益于css的强大，都很简单的搞定，有时间是应该仔细看看css了。&lt;br&gt; &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/3260445345231976397/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/3260445345231976397' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/3260445345231976397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/3260445345231976397'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/asciidoc.html' title='asciidoc 自定义'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-2226966292730170209</id><published>2008-01-01T20:31:00.001+08:00</published><updated>2008-01-01T20:31:56.623+08:00</updated><title type='text'>markdown和pygments</title><content type='html'>这两个东东&lt;a href=&quot;http://pygments.org/&quot; target=&quot;_blank&quot;&gt;pygments&lt;/a&gt;和&lt;a href=&quot;http://www.freewisdom.org/projects/python-markdown/&quot; target=&quot;_blank&quot;&gt;python-markdown&lt;/a&gt;是很多python web程序需要的模块，前者是格式化高亮代码的，后者是提供类似wiki格式的格式化功能（mark text转html），很多blog用这两个东东做文本的格式化。 &lt;br&gt; &lt;br&gt;安装依然简单：&lt;br&gt;sudo apt-get install python-pygments &lt;br&gt;sudo apt-get install python-markdown &lt;br&gt;&lt;br&gt;markdown的帮助文档：&lt;br&gt;&lt;a href=&quot;http://www.unix-center.net/moodle/help.php?file=markdown.html&quot; target=&quot;_blank&quot;&gt;http://www.unix-center.net/moodle/help.php?file=markdown.html &lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://daringfireball.net/projects/markdown/basics&quot; target=&quot;_blank&quot;&gt;http://daringfireball.net/projects/markdown/basics&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/2226966292730170209/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/2226966292730170209' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/2226966292730170209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/2226966292730170209'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2008/01/markdownpygments.html' title='markdown和pygments'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-5387852930632315229</id><published>2007-12-31T22:19:00.001+08:00</published><updated>2007-12-31T22:19:32.919+08:00</updated><title type='text'>反 spambots</title><content type='html'>spambots是指那些在网页上自动提交垃圾/广告信息的机器程序，我曾经深受其害，在我以前的blog中（那时用b2搭建），大量的垃圾留言几乎使我不得不关闭了留言功能。&lt;br&gt;&lt;br&gt;现在的网页上的Form信息提交很多都依赖于&quot;人工检测&quot;，比如最常见的就是给出一个机器无法识别的图像识别，可是由于机器人的智能越来越高，有很多网页给出的这种图像识别也是越来越难，甚至连真人也很难识别了，不信你试试blogger的留言就知道了。下面一篇blog提出的方法则完全不同，它不会对&quot;真人&quot;造成任何的困扰： &lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://nedbatchelder.com/text/stopbots.html&quot;&gt;http://nedbatchelder.com/text/stopbots.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;它所使用的技术虽然有些复杂，但很实用，能够完全避免&quot;图像识别&quot;带来的困扰，有机会我会试试。 </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/5387852930632315229/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/5387852930632315229' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/5387852930632315229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/5387852930632315229'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/spambots.html' title='反 spambots'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-5200187360597958356</id><published>2007-12-30T18:51:00.001+08:00</published><updated>2007-12-30T18:51:37.431+08:00</updated><title type='text'>python map/filter/reduce</title><content type='html'>python有几个内置的函数很有意思：map/filter/reduce，都是对一个集合进行处理，filter很容易理解用于过滤，map用于映射，reduce用于归并，这几个词还是太抽象了，下面的代码精确的说明了这几个函数的用途：&lt;br&gt;&lt;br&gt;def map_imp(function, sequence) :&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if function is None: return list(sequence)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; retvals = [] &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for element in sequence:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retvals.append(function(element))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return retvals&lt;br&gt;&lt;br&gt;def reduce_imp(function, sequence) :&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arg1 = function(sequence[0])&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for arg2 in sequence[1:] :&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arg1 = function(arg1, arg2) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return arg1&lt;br&gt;&lt;br&gt;def filter_imp(function, sequence) :&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; retvals = []&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for element in sequence:&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (function is None and element) or function(element) :&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retvals.append(element) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return retvals&lt;br&gt;&lt;br&gt;对于这种逻辑性强的东西，用语言来描述是无助的，代码则要清晰的多。&amp;nbsp;  &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/5200187360597958356/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/5200187360597958356' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/5200187360597958356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/5200187360597958356'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/python-mapfilterreduce.html' title='python map/filter/reduce'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1582207468296709843</id><published>2007-12-29T20:08:00.001+08:00</published><updated>2007-12-29T20:08:10.555+08:00</updated><title type='text'>python classmethod和staticmethod</title><content type='html'>在早期的python版本（2.2之后）中就有了这两个东东，staticmethod就对应于C++的静态成员函数，而classmetho在C++中是找不到对等体的（它的第一个参数是类对象，而不是类实例）。&lt;br&gt;&lt;br&gt;def smethodimp(arg):&lt;br&gt; &amp;nbsp; do somthing &lt;br&gt;smethod = staticmethod(smethodimp)&lt;br&gt;&lt;br&gt;def cmethodimp(cls, arg):&lt;br&gt;  &amp;nbsp; do something&lt;br&gt;cmethog = classmethod(cmethodimp)&lt;br&gt;&lt;br&gt;一般情况下，smethod和smethodimp可以用同一个名字（比如都叫smethod），同样cmethod和cemthodimp也可以同名。&lt;br&gt;&lt;br&gt;这样的定义总是怪怪的，在2.4版本之后，我们可以用decorator来重写这难看的代码，不过decorator的功能远超出这么简单，我暂时还不能理解其精髓啊（等用时再看吧）。 &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1582207468296709843/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1582207468296709843' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1582207468296709843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1582207468296709843'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/python-classmethodstaticmethod.html' title='python classmethod和staticmethod'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1054588439818908602</id><published>2007-12-27T19:15:00.001+08:00</published><updated>2007-12-27T19:15:40.557+08:00</updated><title type='text'>python __file__ 与相对路径</title><content type='html'>用__file__ 来获得脚本所在的路径是比较方便的，但这可能得到的是一个相对路径，比如在脚本test.py中写入：&lt;br&gt;&lt;br&gt;#!/usr/bin/env python&lt;br&gt;print __file__&lt;br&gt;&lt;br&gt;按相对路径./test.py来执行，则打印得到的是相对路径，&lt;br&gt;按绝对路径执行则得到的是绝对路径。&lt;br&gt;而按用户目录来执行（~/practice/test.py），则得到的也是绝对路径（~被展开）&lt;br&gt;&lt;br&gt; 所以为了得到绝对路径，我们需要 os.path.realpath(__file__)。&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1054588439818908602/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1054588439818908602' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1054588439818908602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1054588439818908602'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/python-file.html' title='python __file__ 与相对路径'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-3884615575011915993</id><published>2007-12-26T19:33:00.001+08:00</published><updated>2007-12-26T19:33:12.751+08:00</updated><title type='text'>django调试</title><content type='html'>用python/django有个好处，调试时用 print 可以在控制台直接输出，而不会送到web输出，也就是说本地的控制台输出和送给brwoser的输出是分开的，这比php要方便一些。&lt;br&gt;&lt;br&gt;还有一个方法得益于django内置的error page，只要在想要的地方放一个assert False，就可以在django的错误页面中看详细的http信息，变量信息等。&lt;br&gt;&lt;br&gt;如果这些还不过瘾的话，也许 &lt;a href=&quot;http://code.google.com/p/django-logging/&quot;&gt; django loggin&lt;/a&gt; 也值得一试（我还没试过）。有了这些调试手段，一般的动态调试基本是用不上了。。。&lt;br&gt;&lt;br&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/3884615575011915993/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/3884615575011915993' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/3884615575011915993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/3884615575011915993'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/django_26.html' title='django调试'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-960438359311356284</id><published>2007-12-25T20:53:00.001+08:00</published><updated>2007-12-25T20:53:39.724+08:00</updated><title type='text'>Leah Culver</title><content type='html'>这是一个达人mm，通过出售笔记本外壳的&amp;quot;广告&amp;quot;位，为自己攒钱买到了配置相当了得的Macbook pro，广告是通过激光雕刻上去的，因为她在一家机械加工相关的网站工作，这件事也使得她攒了相当的名气（不信可以用google试试） 。&lt;br&gt;&lt;br&gt;让我很感兴趣的是，她是一个了得的Python/Django程序员， 并作为Lead developer创建了 &lt;a href=&quot;http://www.pownce.com&quot; target=&quot;_blank&quot;&gt; Pownce&lt;/a&gt; 网站，这个网站还是很酷的，基本上可以算一个社交网站，但提供了基于Adobe Air的客户端（这个不是Leah开发的，呵呵），似乎基于Adobe Air的应用也逐渐多了起来。。。  &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/960438359311356284/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/960438359311356284' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/960438359311356284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/960438359311356284'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/leah-culver.html' title='Leah Culver'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-9032659183181215466</id><published>2007-12-23T19:38:00.001+08:00</published><updated>2007-12-23T19:38:07.370+08:00</updated><title type='text'>sqlite 与 mysql的时间函数</title><content type='html'>很不幸，sqlite和mysql在SQL函数的支持上有很多差异，比如：&lt;br&gt;&lt;br&gt;这是官方mysql的时间函数说明：&lt;br&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html&quot; target=&quot;_blank&quot;&gt;http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html &lt;br&gt;&lt;/a&gt;&lt;br&gt;这是官方sqlite的时间函数说明： &lt;br&gt;&lt;a href=&quot;http://www.sqlite.org/cvstrac/wiki/wiki?p=DateAndTimeFunctions&quot; target=&quot;_blank&quot;&gt;http://www.sqlite.org/cvstrac/wiki/wiki?p=DateAndTimeFunctions&lt;/a&gt;&lt;br&gt;&lt;br&gt;mysql里面如果 select year(field) 在sqlite里面就需要写成 select strftime(&amp;quot;%Y&amp;quot;, field)， 这个麻烦的说。 &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/9032659183181215466/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/9032659183181215466' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/9032659183181215466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/9032659183181215466'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/sqlite-mysql.html' title='sqlite 与 mysql的时间函数'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-847206378783277399</id><published>2007-12-20T19:55:00.001+08:00</published><updated>2007-12-20T19:55:22.241+08:00</updated><title type='text'>VIM与python</title><content type='html'>python的缩进识别给很多编辑器带来了困难，但VIM还是灵活的，通常我用下面的设置（在~/.vimrc中写入）：&lt;br&gt;&lt;br&gt;autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab|set softtabstop=4&lt;br&gt;&lt;br&gt;这是用于控制python文件类型的一些设置，这样在编辑其它文件时不会受这个影响，注解如下：&lt;br&gt;set expandtab 只是在输入tab时转tab到空格，如果是已经有的tab，可以用:retab命令来强制转换到4个空格。 &lt;br&gt;set softtabstop=4是为了让vim可以在backspace时将4个空格当成一个tab删除用的，这样省却每次按4次。&lt;br&gt;&lt;br&gt;&amp;nbsp;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/847206378783277399/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/847206378783277399' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/847206378783277399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/847206378783277399'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/vimpython.html' title='VIM与python'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1712818925357489011</id><published>2007-12-17T20:17:00.001+08:00</published><updated>2007-12-17T20:17:19.191+08:00</updated><title type='text'>makefile for asciidoc</title><content type='html'>不愿意每次键入长长的命令来执行asciidoc的编译，那么下面这个makefile正是为此准备的，自动检查是否需要编译，如果需要则自动调用asciidoc:&lt;br&gt;&lt;br&gt;HTMLS := $(patsubst %.txt,%.html,$(wildcard *.txt))&lt;br&gt;&lt;br&gt;all: $(HTMLS)&lt;br&gt;&lt;br&gt;%.html: %.txt&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asciidoc -a toc -a numbered $&amp;lt; &lt;br&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1712818925357489011/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1712818925357489011' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1712818925357489011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1712818925357489011'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/makefile-for-asciidoc.html' title='makefile for asciidoc'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-6521511168376309853</id><published>2007-12-16T18:20:00.001+08:00</published><updated>2007-12-16T18:20:02.030+08:00</updated><title type='text'>mysql事务</title><content type='html'>由于phpmyadmin的存在，我通常&amp;quot;抵制&amp;quot;使用mysql的命令行，不过老实说，有时用mysql的命令行也是满方便的，昨天为了验证事务的特性，还动用了mysql的命令行。&lt;br&gt;&lt;br&gt;show create table xxx;&lt;br&gt;create table xxx ( a int primary key , b ) engine=innodb;&lt;br&gt;start transaction;&lt;br&gt;insert into xxx values (1,1); &lt;br&gt;insert into xxx values (1,2);&lt;br&gt; commit;&lt;br&gt;&lt;br&gt;结果是 第一条记录 被插入进去了，说明了事务并不管sql语句的返回，事务只保证这些语句统一的执行或不执行。 &lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/6521511168376309853/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/6521511168376309853' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/6521511168376309853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/6521511168376309853'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/mysql_16.html' title='mysql事务'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-1393792972764794083</id><published>2007-12-15T21:19:00.001+08:00</published><updated>2007-12-15T21:19:43.553+08:00</updated><title type='text'>asciidoc格式</title><content type='html'>用了这个asciidoc，感觉还不错，稍微记录一下常用的asciidoc格式：&lt;br&gt;&lt;br&gt;文件头： 文件标题后加一行字数和文件头相同的等号&lt;br&gt;章节： 这个类似于Mediawiki，用 == 标题 == （后一半等号可省略）&lt;br&gt;URL： url[]&lt;br&gt;图像： image::url[]，如果是段落内的图像，则两个冒号改为一个&lt;br&gt;段落： 可以使用样式打头，比如&amp;nbsp; NOTES: 内容 &lt;br&gt; 表格： 可以用&amp;nbsp; `-----`-----（内容用空格对齐），也可以用 ````~宽度（内容用逗号分隔）&lt;br&gt;列表： 用 - 或者 * 打头，要加一个空格&lt;br&gt;&lt;br&gt;总得来说和wiki比较相似，但基于文件来操作，可以更灵活一些，比如可以使用喜欢的编辑器，可以diff/merge等。&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/1393792972764794083/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/1393792972764794083' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1393792972764794083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/1393792972764794083'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/asciidoc_15.html' title='asciidoc格式'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-3041821079980888675</id><published>2007-12-11T20:10:00.001+08:00</published><updated>2007-12-11T20:10:11.606+08:00</updated><title type='text'>WordPress Clone in 27 Seconds</title><content type='html'>这个niubility了，&lt;a href=&quot;http://fallingbullets.com/blog/2006/aug/06/wordpress-clone-27-seconds-part-1-40/&quot; target=&quot;_blank&quot; onclick=&quot;return top.js.OpenExtLink(window,event,this)&quot;&gt;http://fallingbullets.com/blog/2006/aug/06/wordpress-clone-27-seconds-part-1-40/ &lt;/a&gt; 号称27妙搞定一个blog（还是wordpress克隆版的）&lt;br&gt;&lt;br&gt;我试了一下，27秒确实太夸张了，估计只够Ctrl-C/Ctrl-V的时间，而且这个帖子里还有一些遗漏没有写清楚：&lt;br&gt;× 记得要设置 setting.py 中的数据库，sqlite3是比较简单的 &lt;br&gt;× 还要设置setting.py中的template路径，否则会找不到模板&lt;br&gt;× 还要在admin中创建一个blog时时间要提前一天 ，或者在url.py中调用django.views.generic.date_based.archive_index时增加一个参数(allow_future=True)，或者正确的设置setting.py中的时区（我就是Asia/Shanghai），否则都不能显示当前的blog。&lt;br&gt;&lt;br&gt; 这个代码里用到了model的Slug类型，这是一种短字符串，通常由字母，数字，短线（减号）构成，显然很适合做URL，django的slug支持一个populate_from参数，可以在admin后台界面里从另一个字段自动产生这个slug字段（这个很酷的）。&lt;br&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/3041821079980888675/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/3041821079980888675' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/3041821079980888675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/3041821079980888675'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/wordpress-clone-in-27-seconds.html' title='WordPress Clone in 27 Seconds'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-8332478173716411176</id><published>2007-12-10T20:21:00.001+08:00</published><updated>2007-12-10T20:21:45.240+08:00</updated><title type='text'>gcc的虚函数表</title><content type='html'>gcc的虚函数表是怎么组织的？它是和版本相关的，在2.x的gcc版本中（我知道的是2.7和2.9）我们可以看到虚表中每个函数指针占用了8个字节，这8个字节的后四个字节才是虚函数指针，而在3.x的版本中（比如3.3），则类似于VC，4个字节一个函数指针，这比较紧凑。&lt;br&gt;&lt;br&gt;一般情况下，这不会影响什么，但如果要写一些特殊的代码，依赖于虚表的格式（比如通过虚表去调用函数），那么问题就来了，把格式弄错的话，就可能会导致严重的&quot;&lt;span class=&quot;ts&quot;&gt; Pure Virtual Function Called&quot;问题，直接导致程序Crash掉。&lt;br&gt;&lt;br&gt;不过不要混淆这个问题和 &lt;a href=&quot;http://www.artima.com/cppsource/pure_virtual.html&quot;&gt;这篇 文章&lt;/a&gt; 提到的问题，虽然结果都是一样的&quot;Pure Virtual Function Called&quot;。。。&lt;br&gt;&lt;/span&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/8332478173716411176/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/8332478173716411176' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/8332478173716411176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/8332478173716411176'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/gcc.html' title='gcc的虚函数表'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-2606302317386545644</id><published>2007-12-09T19:11:00.001+08:00</published><updated>2007-12-09T19:11:24.755+08:00</updated><title type='text'>mysql事务</title><content type='html'>事务在mysql中，是否支持取决于后端的表驱动，如果是缺省的MyISAM表是不支持事务的，通常需要InnoDB来支持事务，创建表时可以指定这个表的驱动类型，比如：&lt;br&gt;&lt;br&gt;create table vv ( v varchar(4)) engine=innodb;&lt;br&gt;&lt;br&gt;对于支持事务的InnoDB表，缺省时，如果不显式启动事务，每条命令会自动启动一个事务，并被自动commit。但我们可以更改一个系统变量autocommit，当autocommit设置为0时（set autocommit=0;），可以让mysql象oracle一样，命令不会触发事务的commit，需要手动的commit或者rollback（可以在多条命令后commit或rollback）。但在commit之前，我们可以用select将改动查询回来（也就是说查到的是buffer里面的数据），但其它的session是不会查到这些没有提交的数据的。 &lt;br&gt;&lt;br&gt;当然，即便设置了autocommit=1; 一样可以通过 start transaction来启动事务。&lt;br&gt; &lt;br&gt;&lt;br&gt;&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/2606302317386545644/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/2606302317386545644' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/2606302317386545644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/2606302317386545644'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/mysql.html' title='mysql事务'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-34562618.post-2818393195778664813</id><published>2007-12-08T22:00:00.001+08:00</published><updated>2007-12-08T22:00:55.131+08:00</updated><title type='text'>asciidoc</title><content type='html'>已经有很多简单标记语言了，不是吗？ （wiki，markdown等），这个asciidoc也是一种，它有什么新式武器吗？ 没有，它也是将带标记的text文件转换为html或其它格式，看起来很像docbook，不过git选择了asciidoc，而git是Linus大佬的项目，所以asciidoc还是有它的过人之处的。 &lt;br&gt;&lt;br&gt;简单的在Ubuntu下sudo apt-get install asciidoc就可以安装了，下载一个例子 &lt;a href=&quot;http://www.methods.co.nz/asciidoc/faq.txt&quot; target=&quot;_blank&quot;&gt;  http://www.methods.co.nz/asciidoc/faq.txt&lt;/a&gt; ，然后执行：&lt;br&gt;asciidoc faq.txt &lt;br&gt;就可以得到一份漂亮的内嵌css的html文档faq.html了，不错吧，试试看编辑一下txt文件，加入中文，都没有问题。&lt;br&gt;&lt;br&gt;asciidoc的过人之处在于：&lt;br&gt;+ 格式简单，比docbook简单， 这种简单的格式带来的结果是asciidoc文件本身已经可以具备很好的文档可视性（一个docbook源文件看起来还是有些费劲的，被xml tag穿插的有些支离破碎），这可能对写文档的人连贯自己的思路有很大的好处。 &lt;br&gt;+ 表达能力强，在格式简单的基础上，asciidoc的表达能力并不象某些wiki那么弱，比如asciidoc可以支持三种格式输入（doctype）：article，book和manpage（他们三种的基本语法是类似的），显然支持book就意味着asciidoc有较好的表达能力。&lt;br&gt;+ 工具易用， asciidoc本身的工具只有一个命令文件(asciidoc)，就支持三种格式（backend）输出：xhtml11/docbook/html4，一般情况下用xhtml11就很好用了，如果需要更复杂的输出，可以先转换到docbook，再用docbook toolchain做进一步转换。在命令行下使用 asciidoc -b backend -d doctype file 就可以了，通常 -b/-d都不用指定，缺省值分别为xhtml11和article，所以命令行使用就非常简单，比docbook的一整套toolchain用起来平易近人一些。 &lt;br&gt;&lt;br&gt;写了这么多优点，并不是说asciidoc没有缺点，通常一个新事物总是容易先看到优点，而在使用中再逐步看到缺点，我用的不多，所以不敢妄下结论，不过有一个缺点先提一下，它的官网上的User Guide文档写的不好，比较晦涩 :))&lt;br&gt; </content><link rel='replies' type='application/atom+xml' href='http://wenshuc.blogspot.com/feeds/2818393195778664813/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/34562618/2818393195778664813' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/2818393195778664813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/34562618/posts/default/2818393195778664813'/><link rel='alternate' type='text/html' href='http://wenshuc.blogspot.com/2007/12/asciidoc.html' title='asciidoc'/><author><name>wenshu</name><uri>http://www.blogger.com/profile/04934622277504544804</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>