<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客网-gyn-随笔分类-other</title><link>http://www.cnitblog.com/gyn/category/2450.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 11 Apr 2008 09:35:28 GMT</lastBuildDate><pubDate>Fri, 11 Apr 2008 09:35:28 GMT</pubDate><ttl>60</ttl><item><title>应用JMF编写mp3播放器</title><link>http://www.cnitblog.com/gyn/archive/2008/04/11/42255.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Fri, 11 Apr 2008 09:16:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2008/04/11/42255.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/42255.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2008/04/11/42255.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/42255.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/42255.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 通过网上搜索，可以找到很多利用JMF播放单个文件的代码，写一个简单的播放器书是轻而易举的事情。而事实上JMF中的start似乎就可以让我们搞定一切。但是这样的东西，或者说仅仅一段代码，实在不能说是播放器。我希望让这个播放器尽量地可以使用，我的意思是对于一个提供的播放列表，它至少可以连续播放以及暂停、前进和后退。如果能做到这些，对于我自己，也许还有使用并且修改它的热情。首先要解决的一个问题是如何实现...&nbsp;&nbsp;<a href='http://www.cnitblog.com/gyn/archive/2008/04/11/42255.html'>阅读全文</a><img src ="http://www.cnitblog.com/gyn/aggbug/42255.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2008-04-11 17:16 <a href="http://www.cnitblog.com/gyn/archive/2008/04/11/42255.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ADT安装小记</title><link>http://www.cnitblog.com/gyn/archive/2008/03/17/41038.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Mon, 17 Mar 2008 08:52:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2008/03/17/41038.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/41038.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2008/03/17/41038.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/41038.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/41038.html</trackback:ping><description><![CDATA[Android很火，估计以后可以靠这个赚点小钱。就算不行，玩玩总是可以的。<br />具体的下载说明在这里：http://www.androidin.com/docs/intro/installing.html#developingwitheclipse<br />安装完SDK后，最好按一个eclipse。我平时一般用UE和GVIM比较多，不过eclipse是官方推荐的，连教程里也是用了这个。所以下载了一个就凑活用用。（学习一个新事物的最好办法就是亲手实践，而一个好的tutorial是十分重要的，对于建立继续学下去的信心至关重要，在此过程中亦步亦趋往往会有比较好的效果。）<br />之后，需要安装一个叫ADT的plugin。具体的安装方法，说明里也有。但是问题出现eclipse在搜索到ADT的一步。提示缺少“org.eclipse.wst.sse.ui”这个玩意儿。到google上搜索，比较值得可信的是http://blog.csdn.net/jiyucn/archive/2008/02/16/2099387.aspx里面说的。但是我从里面的链接里下载来各个plugin，解压，再全部复制到eclipse之后。按照他的说法，再装ADT就成了，但事实上还是提示不行。于是开始上网搜索“如何安装eclipse插件”，文章很多，但基本不靠谱。<br />终于，功夫不负有心人，在http://hi.baidu.com/iiyouxia/blog/item/3f13c245cba57c3c87947325.html中，发现了一句话“删掉configuration中除了config.ini以外的所有文件和文件夹，确保插件安装配置正确”。抱着死马当活马医的心情，删了它们。打开eclpise再试，成了！<br /><img src ="http://www.cnitblog.com/gyn/aggbug/41038.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2008-03-17 16:52 <a href="http://www.cnitblog.com/gyn/archive/2008/03/17/41038.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Big-endian和Little-endian（转自：http://blog.csdn.net/NeptuneX/）</title><link>http://www.cnitblog.com/gyn/archive/2008/02/14/39738.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Thu, 14 Feb 2008 07:17:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2008/02/14/39738.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/39738.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2008/02/14/39738.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/39738.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/39738.html</trackback:ping><description><![CDATA[
		<span id="ArticleContent1_ArticleContent1_lblContent">简而言之：<br />Big endian machine: It thinks the first byte it reads is the biggest.<br />Little endian machine: It thinks the first byte it reads is the littlest.<br />举个例子，从内存地址0x0000开始有以下数据<br /> 0x0000     0x12<br /> 0x0001     0x34<br /> 0x0002     0xab<br /> 0x0003     0xcd<br />如果我们去读取一个地址为0x0000的四个字节变量，若字节序为big-endian，则读出<br />结果为0x1234abcd；若字节序位little-endian，则读出结果为0xcdab3412.<br />如果我们将0x1234abcd写入到以0x0000开始的内存中，则结果为<br />                big-endian     little-endian<br />0x0000     0x12              0xcd<br />0x0001     0x23              0xab<br />0x0002     0xab              0x34<br />0x0003     0xcd              0x12<br />x86系列CPU都是little-endian的字节序.</span>
<img src ="http://www.cnitblog.com/gyn/aggbug/39738.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2008-02-14 15:17 <a href="http://www.cnitblog.com/gyn/archive/2008/02/14/39738.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>新年新学习-erlang</title><link>http://www.cnitblog.com/gyn/archive/2008/02/11/39675.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Mon, 11 Feb 2008 04:59:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2008/02/11/39675.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/39675.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2008/02/11/39675.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/39675.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/39675.html</trackback:ping><description><![CDATA[好久没有来了，不是因为没有在学习，相反的，因为一直在学习新的东西，并且还没有形成理论体系，所以没办法写下心得。前些日子，打算学习一下java，但是因为自己脚本习惯已深，所以先学习groovy，再慢慢过渡到java上去。建议打算学习groovy的朋友看mastering groovy in action，至于那本programming groovy就不要看了，出的时间太早，有一些版本上的冲突。<br />在以前用perl写脚本的日子里，一直被并行或者说进程间的通信问题所困扰。一些信号处理的办法或者Tk中解决通信的办法，在windows下无法很好实现，或多或少存在一些奇怪的问题。这也是为什么下定决心要精通另外一种语言的原因。java无疑是最好的选择。但是在一次浏览csdn的时候，发现了一篇介绍erlang的文章。erlang是天然用来解决并行的语言，因其高效稳定的运行，被用在电信等需要大量并行计算的通信行业中。爱立信和北电的一些产品正是应用了erlang。如此看来，erlang不正是我们这些学通信出身的人的好帮手吗？于是二话不说，下了本programming erlang开始看起来了。<br />相比较perl，c，java，erlang更接近与haskell，而更有意思的是，出于安全考虑，变量一旦赋值就无法更改。递归被频繁地使用。比如说一个快排算法。<br />qsort(_, []) -&gt; [];<br />qsort([Pivat|T]) -&gt; <br />    qsort([X || X &lt;- T, X &lt; Pivat]) <br />    ++ [Pivat] ++ <br />    qsort([X || X &lt;- T, X &gt;= Pivat]).<br />总而言之，与平常接触的一些编程语言习惯格格不入，完全从零开始。当然数据结构的一些概念和算法还是相通的，看来大学时好好学习是非常重要的。<br /><img src ="http://www.cnitblog.com/gyn/aggbug/39675.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2008-02-11 12:59 <a href="http://www.cnitblog.com/gyn/archive/2008/02/11/39675.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>给上一篇中的ftp服务增加了用户添加和删除的程序</title><link>http://www.cnitblog.com/gyn/archive/2007/11/11/36141.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sun, 11 Nov 2007 07:37:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/11/11/36141.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/36141.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/11/11/36141.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/36141.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/36141.html</trackback:ping><description><![CDATA[最终放弃GUI 了，太麻烦。命令行好搞啊，呵呵。<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> os, sys<br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> md5<br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">from</span><span style="COLOR: #000000"> pysqlite2 </span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> dbapi2 as sqlite<br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">def</span><span style="COLOR: #000000"> user_insert(username, password, homedir, perm, msg_login, msg_quit):<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> username: username </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">anonymous</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> os.path.exists(homedir): homedir </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> r</span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">D:\None</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> perm </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> (</span><span style="COLOR: #800000">''</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">r;</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">r;w</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">): perm </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">r;</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> msg_login: msg_login </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">Login successful.</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> msg_quit: msg_quit </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">Goodbye.</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    dbpath </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">%s\\users.db</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000"> os.getcwd()<br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> os.path.isfile(dbpath):<br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        con </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sqlite.connect(dbpath, isolation_level </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> None)<br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        cur </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> con.cursor()<br /></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        cur.execute(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">CREATE TABLE users(username test primary key, password text, homedir text, perm text, msg_login text, mag_quit text)</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        cur.close()<br /></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        con.close()<br /></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    con </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sqlite.connect(dbpath, isolation_level </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> None)<br /></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    cur </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> con.cursor()<br /></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    cur.execute(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">insert into users values(?, ?, ?, ?, ?, ?)</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, <br /></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />                (username, password, homedir, perm, msg_login, msg_quit))<br /></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    cur.close()<br /></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    con.close()<br /></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">from</span><span style="COLOR: #000000"> msvcrt </span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> getch<br /></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">except</span><span style="COLOR: #000000"> ImportError:<br /></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">def</span><span style="COLOR: #000000"> getch():<br /></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> tty, termios<br /></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        fd </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sts.stdin.fileno()<br /></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        old.settings </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> termios.tcgetattr(fd)<br /></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">try</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            tty.setraw(fd)<br /></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            ch </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sys.stdin.read(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">finally</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            termios.tcsetattr(fd, tremios.TCSADRAIN, old.settings)<br /></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> ch<br /></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">def</span><span style="COLOR: #000000"> asterisk_raw_input(label):<br /></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    sys.stdout.write(label)<br /></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    strAttr </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> []<br /></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> True:<br /></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        tmp </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> getch()<br /></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> tmp </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">\r</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            strAttr.append(tmp)<br /></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            sys.stdout.write(</span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">*</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">: <br /></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            sys.stdout.write(</span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">\n</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">''</span><span style="COLOR: #000000">.join(strAttr)<br /></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    <br /></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    <br /></span><span style="COLOR: #008080">53</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />user_info_list </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> []<br /></span><span style="COLOR: #008080">54</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">-*- pyftpdlib user information. -*-\n-*- Separated by ':' -*-\n</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">55</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> eachLabel </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> (</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Username</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Password</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Homedir</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Perm</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Msg_login</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Msg_quit</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">):<br /></span><span style="COLOR: #008080">56</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> eachLabel </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">Password</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080">57</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        user_info </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> md5.new(asterisk_raw_input(eachLabel </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">:  </span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">)).hexdigest()<br /></span><span style="COLOR: #008080">58</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080">59</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        user_info </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> raw_input(eachLabel </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">:  </span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">60</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    user_info_list.append(user_info)<br /></span><span style="COLOR: #008080">61</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />user_insert(</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">user_info_list)<br /></span><span style="COLOR: #008080">62</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">-*- Programme Quit. -*-</span><span style="COLOR: #800000">"</span></div><br />user_add.py<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> os<br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">from</span><span style="COLOR: #000000"> pysqlite2 </span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> dbapi2 as sqlite<br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />user_info </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> {}<br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />dbpath </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">%s\\users.db</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000"> os.getcwd()<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> os.path.isfile(dbpath):<br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">-*- No user to delete. -*-</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    con </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> sqlite.connect(dbpath, isolation_level </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> None)<br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    cur </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> con.cursor()<br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    cur.execute(</span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">select username from users</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    result </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> cur.fetchall()<br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> result: <br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">-*- No user to delete. -*-</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">:<br /></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        result </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> [name[0] </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> name </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> result]<br /></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000"> index, name </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> zip(range(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">, len(result)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">), result):<br /></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            </span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">'</span><span style="COLOR: #800000">&lt;%d&gt; %s</span><span style="COLOR: #800000">'</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000"> (index, name)<br /></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            user_info[index] </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> name<br /></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">''</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        user_index </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> int(raw_input(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Enter the index of user to delete: </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">))<br /></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">not</span><span style="COLOR: #000000"> user_index </span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000"> range(0, len(result)</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">):<br /></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            user_index </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> raw_input(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">Wrong index, re_enter: </span><span style="COLOR: #800000">"</span><span style="COLOR: #000000">)<br /></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> user_index:<br /></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            cur.execute(</span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">delete from users where username = '%s'</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000"> user_info[user_index])<br /></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />            </span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">-*- '%s' is deleted. -*-</span><span style="COLOR: #800000">"</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">%</span><span style="COLOR: #000000"> user_info[user_index]<br /></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    cur.close()<br /></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    con.close()<br /></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">print</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">"</span><span style="COLOR: #800000">-*- Programme Quit. -*-</span><span style="COLOR: #800000">"</span></div>user_del.py<img src ="http://www.cnitblog.com/gyn/aggbug/36141.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-11-11 15:37 <a href="http://www.cnitblog.com/gyn/archive/2007/11/11/36141.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用pyftpdlib和pysqlite3建立可存储用户信息FTP服务</title><link>http://www.cnitblog.com/gyn/archive/2007/11/10/36096.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sat, 10 Nov 2007 03:15:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/11/10/36096.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/36096.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/11/10/36096.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/36096.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/36096.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 前一段时间因为版权的原因，停用了SERV-U服务。但是ftp的服务不能停止，所以不得不自己动手写一个。但是由于时间原因，无法完全认真去看协议，所以希望利用现有的模块。这类模块在perl和python中都有，不过我差不多有半年没碰perl了，自然选择了python。除了几个无关紧要的bug，这个模块基本能满足日常使用。只是用户信息的存储不是很保险，如果存到数据库中总能好一些。密码则参照范例中的md5...&nbsp;&nbsp;<a href='http://www.cnitblog.com/gyn/archive/2007/11/10/36096.html'>阅读全文</a><img src ="http://www.cnitblog.com/gyn/aggbug/36096.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-11-10 11:15 <a href="http://www.cnitblog.com/gyn/archive/2007/11/10/36096.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>获取文件夹大小的python代码</title><link>http://www.cnitblog.com/gyn/archive/2007/11/01/35698.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Thu, 01 Nov 2007 06:25:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/11/01/35698.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/35698.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/11/01/35698.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/35698.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/35698.html</trackback:ping><description><![CDATA[可能是太简单的缘故，在google中查询不到，所以贴一下免得忘记了：<br />import os<br />from os.path import join, getsize<br /><br />def getdirsize(dir):<br />   size = 0L<br />   for root, dirs, files in os.walk(dir):<br />      size += sum([getsize(join(root, name)) for name in files])<br />   return size<br /><br />if '__name__' == '__main__':<br />   filesize = getdirsize(r'c:\windows')<br />   print 'There are %.3f' % (size/1024/1024), 'Mbytes in c:\\windows'<img src ="http://www.cnitblog.com/gyn/aggbug/35698.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-11-01 14:25 <a href="http://www.cnitblog.com/gyn/archive/2007/11/01/35698.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>python中unicode解决之道</title><link>http://www.cnitblog.com/gyn/archive/2007/10/24/35289.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Wed, 24 Oct 2007 12:26:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/10/24/35289.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/35289.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/10/24/35289.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/35289.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/35289.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="text-indent: 17.95pt;">
				<span style="font-family: 宋体;">和前一篇的起因一样，也是在使用</span>
				<span lang="EN-US">wxPython</span>
				<span style="font-family: 宋体;">的时候。因为不是每个人都熟悉英文（事实上，我总认为不熟悉或者说是生疏与英文的人，大多憎恨英文），不可避免的，需要显示一些中文。但是运行的结果显示大体如“</span>
				<span lang="EN-US">Syntax Error: Non ASCII character in ‘\xc4’….</span>
				<span style="font-family: 宋体;">”的错误提示。按照</span>
				<span lang="EN-US">Dive into Python</span>
				<span style="font-family: 宋体;">的解释，这是因为</span>
				<span lang="EN-US">python</span>
				<span style="font-family: 宋体;">默认使用</span>
				<span lang="EN-US">ASCII</span>
				<span style="font-family: 宋体;">编解码，而中文显然不是标准的</span>
				<span lang="EN-US">ASCII</span>
				<span style="font-family: 宋体;">。<br />   按照文中的解决办法，是要在程序的第一或二行键入形如“</span>
				<span lang="EN-US"># -*- coding:
gbk -*-</span>
				<span style="font-family: 宋体;">”或者将其中的</span>
				<span lang="EN-US">gbk</span>
				<span style="font-family: 宋体;">改为</span>
				<span lang="EN-US">cp936</span>
				<span style="font-family: 宋体;">，这有什么不同。不过也许因为一些大牛习惯的缘故，使用</span>
				<span lang="EN-US">cp936</span>
				<span style="font-family: 宋体;">更酷一点。</span>
				<span lang="EN-US">Google</span>
				<span style="font-family: 宋体;">中的一种简单的写法是“</span>
				<span lang="EN-US">#coding=cp936</span>
				<span style="font-family: 宋体;">”（需要注意的是和</span>
				<span lang="EN-US">bash</span>
				<span style="font-family: 宋体;">的语法相类似的，“</span>
				<span lang="EN-US">=</span>
				<span style="font-family: 宋体;">”两旁不能有空格），不过这样没有前一种来得顺眼，可按个人爱好任意选择。<br />   这样看来，问题似乎解决了。不过事事难预料，由于程序需要对</span>
				<span lang="EN-US">sqlite</span>
				<span style="font-family: 宋体;">进行读写，在将这些中文写入数据库的时候也出现了编解码错误的提示。看来</span>
				<span lang="EN-US">pysqlite</span>
				<span style="font-family: 宋体;">似乎只能处理</span>
				<span lang="EN-US">unicode</span>
				<span style="font-family: 宋体;">的数据，用惯了</span>
				<span lang="EN-US">perl</span>
				<span style="font-family: 宋体;">的</span>
				<span lang="EN-US">DBI</span>
				<span style="font-family: 宋体;">，一时还无法接受这一而再烦人的错误。<br />   解决的办法是将中文用</span>
				<span lang="EN-US">unicode</span>
				<span style="font-family: 宋体;">实例化，然后在传给</span>
				<span lang="EN-US">pysqlite</span>
				<span style="font-family: 宋体;">，具体如：</span>
				<span lang="EN-US">u’</span>
				<span style="font-family: 宋体;">你好</span>
				<span lang="EN-US">’</span>
				<span style="font-family: 宋体;">这样。但是对于变量不能这样简化做，甚至于</span>
				<span lang="EN-US">u’%s’ % niha</span>
				<span style="font-family: 宋体;">（其中</span>
				<span lang="EN-US">nihao</span>
				<span style="font-family: 宋体;">被赋值了‘你好’）的形式也不行。这里我们需要用</span>
				<span lang="EN-US">unicode</span>
				<span style="font-family: 宋体;">的完整形式，</span>
				<span lang="EN-US">unicode(nihao, ‘cp936’)</span>
				<span style="font-family: 宋体;">。</span>
		</p>
<img src ="http://www.cnitblog.com/gyn/aggbug/35289.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-10-24 20:26 <a href="http://www.cnitblog.com/gyn/archive/2007/10/24/35289.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>wxPython中的一个登录对话框（Login Dialog）</title><link>http://www.cnitblog.com/gyn/archive/2007/10/23/35226.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Tue, 23 Oct 2007 08:37:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/10/23/35226.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/35226.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/10/23/35226.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/35226.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/35226.html</trackback:ping><description><![CDATA[在使用wxPython的过程中，临时需要加入一个登录对话框，因为不是标准Dialog，所以在google里搜索了一下，相关的信息只能用凤毛麟角来形容。查询了在wxPython DEMO中标准Dialog实例代码，发现与所需的极为类似，所以稍作修改就被派上用场了。<br />其中密码文本框的style是wx.TE_PASSWORD。类实例在ShowModal返回wx.ID_OK之后，调用GetValue返回用户名和密码，以供调用代码验证之用。<br /><br /># -*- coding: gbk -*-<br /><br />import wx<br /><br />#-------------------------------------------------------------------------<br /><br />class LoginDialog(wx.Dialog):<br />    def __init__(self, parent, id, title,  <br />                       size = (350, 200), <br />                       pos = wx.DefaultPosition,<br />                       style = wx.DEFAULT_DIALOG_STYLE, useMetal = False):<br />        pre = wx.PreDialog()<br />        pre.Create(parent, id, title, pos, size, style)<br />        self.PostCreate(pre)<br />        self.user, self.password = '', ''<br />        self.CreateSizer()<br />        <br />    def dataEntries(self):<br />        return (('用户  ', 0, self.OnUser),('密码  ', wx.TE_PASSWORD, self.OnPassword))<br />                                    <br />    def dataButtons(self):<br />        return ((wx.ID_OK, '确定'),(wx.ID_CANCEL, '取消'))<br />        <br />    def CreateSizer(self):<br />        sizer = wx.BoxSizer(wx.VERTICAL)<br />        sizer.Add(wx.StaticText(self, -1, '请输入用户名和密码'), 0, wx.ALIGN_CENTER | wx.ALL, 5)<br />        for eachLabel, eachStyle, eachHandler in self.dataEntries():<br />            self.CreateEntry(sizer, eachLabel, eachStyle, eachHandler)<br />        sizer.Add(wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL), <br />                            0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)<br />        btnsizer = wx.StdDialogButtonSizer()<br />        for eachId, eachLabel in self.dataButtons():<br />            self.CreateButton(btnsizer, eachId, eachLabel)<br />        btnsizer.Realize()<br />        sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)<br />        self.SetSizer(sizer)<br />        sizer.Fit(self)<br />            <br />    def CreateEntry(self, sizer, label, style, handler):<br />        box = wx.BoxSizer(wx.HORIZONTAL)<br />        box.Add(wx.StaticText(self, -1, label), 0, wx.ALIGN_CENTER | wx.ALL, 5)<br />        text = wx.TextCtrl(self, -1, "", size = (80, -1), style = style)<br />        text.Bind(wx.EVT_TEXT, handler)<br />        box.Add(text, 1, wx.ALIGN_CENTER | wx.ALL, 5)<br />        sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)<br />        <br />    def CreateButton(self, btnsizer, id, label):<br />        button = wx.Button(self, id, label)<br />        if id == wx.ID_OK:<br />            button.SetDefault()<br />        btnsizer.AddButton(button)        <br />        <br />    def OnUser(self, event):<br />        self.user = event.GetString()<br />        <br />    def OnPassword(self, event):<br />        self.password = event.GetString()<br />        <br />    def GetValue(self): <br />        return (self.user, self.password)<br />        <br />#-------------------------------------------------------------------------<img src ="http://www.cnitblog.com/gyn/aggbug/35226.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-10-23 16:37 <a href="http://www.cnitblog.com/gyn/archive/2007/10/23/35226.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>bash常用指令备忘</title><link>http://www.cnitblog.com/gyn/archive/2007/07/16/29892.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sun, 15 Jul 2007 23:50:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/07/16/29892.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/29892.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/07/16/29892.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/29892.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/29892.html</trackback:ping><description><![CDATA[ASCII码：<br />响铃    7<br />退格    10<br />制表符    11<br />新行    12<br />换行    12<br />换页    14<br />回车    15<br />转移    33<br />常用的命令：<br />ls -a : 显示全部文件包括隐藏文件<br />vi : 按i进入插入模式，按:进入last line模式，之后按wq保存并退出，按q!强制退出<br />echo : -n不输出换行<br />wc : -c字节 -m字符数 -w单词数 -l行数<br />mv cp : 只需要目标文件夹即可执行拷贝或者移动<br />ln : -s建立一个可跨越档案系统的软链接，默认情况下显示在同一档案系统中建立硬链接<br />2&gt; : 标准错误的重定向<br />cut : -c1-5表示显示行的第一到五个字符，-d: -f1,5表示按冒号分割，然后显示分割出来的第一和五个字段，默认按制表符分割<br />paste : -d + 将各个文件的行用加号连接，-s合并单个文件的各行为一行<br />sed : 's/jin/hao/'将jin换位hao，-n '1,2p'显示第一、二行， -n '/jin/p'显示包含jin的行，'1,2d'不显示第一、二行，'/jin/d'不显示包含jin的行<br />tr : tr '[a-z]' '[A-Z]' &lt; intro将小写母转化为大写（替换字符不可为空），-s用于压缩重复的被替换字符, -d ' '删除空格<br />grep : -l之显示匹配的文件名，-n显示行号，-v不显示匹配的行, -i不区分大小写<br />sort : -n将第一字段的值按数字形式来排序，-u不显示重复的行，-r反序排列，+1n跳过第一个字段，+2n -t:按冒号来划分字段，并且跳过前两个字段<br />uniq : 删除相同的行，-d显示相同的行<br /><br /><img src ="http://www.cnitblog.com/gyn/aggbug/29892.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-07-16 07:50 <a href="http://www.cnitblog.com/gyn/archive/2007/07/16/29892.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个学习linux命令的好网站</title><link>http://www.cnitblog.com/gyn/archive/2007/05/24/27536.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Thu, 24 May 2007 06:00:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/05/24/27536.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/27536.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/05/24/27536.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/27536.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/27536.html</trackback:ping><description><![CDATA[
		<a href="http://www.linuxcommand.org/">http://www.linuxcommand.org/</a>
		<br />顾名思义，网站的名字就是linux命令的意思。老外的文笔的确要好上一点，不比一些中文资料，虽然是英文但也不会有味如嚼蜡的感觉。有感兴趣的可以去瞧瞧，很基础的一些东西，刚刚可以用于入门。<img src ="http://www.cnitblog.com/gyn/aggbug/27536.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-05-24 14:00 <a href="http://www.cnitblog.com/gyn/archive/2007/05/24/27536.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转蛮有意思的一段伪代码</title><link>http://www.cnitblog.com/gyn/archive/2007/03/09/23774.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Fri, 09 Mar 2007 01:32:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/03/09/23774.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/23774.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/03/09/23774.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/23774.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/23774.html</trackback:ping><description><![CDATA[result love(boy, girl)<br />{<br />    if( boy.有房() and boy.有车() )<br />    {<br />        boy.set(nothing);<br />        return girl.嫁给(boy);<br />    }<br />    if( girl.愿意等() )<br />    {<br />    while(!(boy.赚钱 &gt; 100,000 and girl.感情 &gt; 8 ) )<br />    {<br />        for( day=1; day &lt;=365; day++)<br />        {<br />            if( day == 情人节 )<br />            if( boy.givegirl(玫瑰) )<br />                girl.感情++;<br />            else<br />                girl.感情--;　　<br />            if( day == girl.生日 )<br />            if( boy.givegirl(玫瑰) )<br />            {<br />                girl.感情++;<br />            }else{<br />                girl.感情--;<br />                boy.拼命赚钱();<br />            }<br />        }<br />        if( boy.有房() and boy.有车() )<br />        {<br />            boy.set(nothing);<br />            return girl.嫁给(boy);<br />        }<br />        年龄++;<br />        girl.感情--;<br />    }<br />   else return girl.goto( another_boy);<br />}<br /><img src ="http://www.cnitblog.com/gyn/aggbug/23774.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-03-09 09:32 <a href="http://www.cnitblog.com/gyn/archive/2007/03/09/23774.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>泡妞三十六计(转)</title><link>http://www.cnitblog.com/gyn/archive/2007/03/01/23444.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Thu, 01 Mar 2007 12:23:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2007/03/01/23444.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/23444.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2007/03/01/23444.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/23444.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/23444.html</trackback:ping><description><![CDATA[
		<div>
				<font face="宋体" color="#009999" size="2">第一计：铁面计。</font>
				<font face="宋体" color="#009999" size="2">随着社会的发展，MM变得越来越凶。女人猛于虎，既要泡得MM，又不要被MM所伤，最好莫如戴上一幅铁面。有铁面护着，说多肉麻的话，脸不红，妹妹玉手打来鼻不酸来眼不花，当的过份英俊曾从寨主处悟得此计。等妹妹累了烦了芳心也就许了，一幅铁面，胜过德才兼备远矣！忠告是此计莫在大洋用，大洋MM太厉害了，简直是老虎中的老虎。此计尤其在开心E族失效，你有铁面计，东方MM有踢屁功。 <br /><br />第二计：打折计。看到一个MM，先要沉得住气。色不迷人人自迷，不要见到MM自家先乱了枪法。再美再傲的MM，都可以打折来看。她盘亮不一定条顺，她是美女，有可能是个草包。无论MM再好，打折打到脚脖子上，也就泯然众人矣。别把MM当回事儿，就成功了一半，威威深信此言。妞无常势，泡无常形，别打折打得太过份，对MM失去兴趣。有位老人家说过，要战略上邈视MM，战术上重视MM。 <br /><br />第三计：秋千计。有过打秋千经验的人知道，要想把秋千荡得高，需要一下一下地加力。泡成功一个MM，也得一下一下地加力。今日加力，明日减力，只能在原处晃荡。除非你是世外高人，三天打鱼，两天晒网，保持MM平衡，否则你只有金枪独抱，眼睁睁瞧着人家妞来妹往。记住了，泡妞要有条理，心急吃不了热豆腐。泡妞如做人，需要一步一个脚印。 <br /><br />第四计：吃草计。好马不吃回头草，所以好马常饿肚子。这个世道，只要MM存在一天，GG的命运就多舛一天。当MM都象狗熊掰棒子般被扔掉，好在你不是狗熊，目前腋下没有夹着棒子也不要紧，可以回过头再遛一圈。许多MM潜的很深，要小心寻找美人鲨的蛛丝马迹。辛GG在九百年前研究过此计，他说蓦然回首，那妞却在，灯火阑珊处。 <br /><br />第五计：高帽计。人都喜欢戴高帽，MM是人，所以MM喜欢戴高帽。懂得拍马屁的GG是好 GG，懂得拍MM马屁的GG更是人中俊杰。此计不容易把握，有些水平高的MM，只有水平很高的马屁才能够被薰倒。嘴甜的GG有妞抱，从实践中走来，还将向实践中走去。薰倒的MM容易下手，不过常倒的MM你千万不要下手，比如要提防东方MM倒地时暗藏兔子蹬鹰式。 <br /><br />第六计：黄花计。黄花计是指青春易逝，许多事许多人转眼就成昨日黄花，杜秋娘JJ在泡妞三百首中说过，花开堪折直须折，莫待无花空折枝。人生行乐能几时，不只是GG遇到一个好MM不容易，MM遇到一个好GG也不容易。一定要抢抓机遇，与时俱进，MM如黄花，转眼花飞去，泡妞工程，时不我待呀！记得有位浪费掉无数宝贵泡妞时间的GG惨痛回忆，“忆往昔，峥嵘岁月稠，只可惜，没有泡妞空悲切，白了少年头。” <br /><br />第七计：叉饭计。叉饭计是指无论多好饭，总吃一样总会腻的，只有均衡营养，才有利于身体健康。泡妞也是如此道理，才有利于GG们身体健康。你有一天觉得泡某个MM腻了的时候，就要考虑象鱼丝学习，有时候泡米饭MM，有时候泡烧饼MM，泡起妞来健康快乐。饭切忌吃得太饱，MM切忌泡得太多 <br /><br />第八计：土豆计。土豆藤蔓延伸多，土豆就结多远，即使藤蔓被毁，土豆依然可以保存，此计不适用于东方MM，她是生物老师，给她施此计，她挖地三尺也要把土豆刨出来。主旨是泡一个妞要有泡一个妞的收获，不要泡了N个妞，还跟一个妞没泡似的。有个叫保尔的老外说过，GG的一生应该是这样渡过的，当他回首往事，不因虚度年华而悔恨,不因碌碌无妞而感到羞耻，他应该自豪地说…… <br /><br />第九计：射雁计。这条计很老了，不过历久弥新，郎君还是把它写上了，老树也可以开新花嘛！两位古人射大雁讨论怎么吃雁的时候，雁已经飞跑了。看到MM，不要总想着泡到手后如何与她嘿咻，正当你做白日梦的时候，她说不定已经倒在别的GG怀里。射雁计主旨该出手时就出手，手出的不准，是技术问题，手出的不快，是思想问题。 <br /><br />第十计：金钱计。十个MM九个贪财，泡不到MM不要着急。临渊羡鱼，不如退而结网。在她的裙下死掉一百位GG也与你无关，你只须闷声赚银子。等你腰包鼓了，不用你去泡MM，MM排着队来泡你。有钱的GG自然妙语如珠、貌美枪粗、绅士风度、钻石老五。 <br /><br />第十一计：咖啡计。咖啡虽苦可以提神，泡妞虽苦也可以提神。即使你把一位MM泡上了床，也需要知道上床是个力气活。泡妞看起来表面光鲜，其中的酸甜苦辣只有自己知道。有MM的时候自然挺提神，提神过度难免神经衰弱，吃不香，睡不宁，这是典型的泡妞综合症。 <br /><br />第十二计：走狗计。这是普天下GG泡妞时用得最多的一条计，在MM眼睛的柔里，我宁愿做一条走狗，不计时间，不计名利，风雨无阻，无怨无悔。其实也挺有效的，走狗计实在是一条朴实无华的泡妞之计呀，推荐指数五星。 <br /><br />第十三计：台球计。记得有个段子，说女人和台球的区别，女人是杆进球不进，台球是球进杆不进。虽然泡妹妹的和打台球有区别，但目的都是进洞，虽然不能要求象戴维斯享得利基本上杆杆进洞，也得打几杆进一洞吧。台球计怎么样，不好说呀，泡妞如同打台球，十杆进一洞也是胜利。如果你泡妞只为她的心灵不为她的肉体，那整个大洋的GG都要佩服你的高境界。 <br /><br />第十四计：西游计。泡MM好比是师徒四人一马西天取经。泡妞时常不是一个人的事情，而是一群人的事情。一个泡妞三个帮，团结就是力量，大多数MM在群狼面前是没有招架之力的。成功要素是确定一个主泡手，不要妞未泡成，反而自家乱了阵脚，孔夫子有心得，GG之忧，不在泡妞，而在萧墙之内也。 <br /><br />第十五计：臭袜计。穿一个月不洗的袜子逻辑上比穿一天不洗的袜子要臭。一个月不泡妞的GG逻辑上要比一天不泡妞的GG劲头要足。这种劲头对MM来说诱惑力太大了，MM也需要尝鲜的。人活着就需要有活着的劲头，泡妞要有泡妞的劲头。 <br /><br />第十六计：卖柑计。杭有卖柑者，金玉其外，败絮其中，置于市,价十倍,抢购中。MM就是这样，哪怕她是草包，只要长的漂亮，总是泡者云集。虽然漂亮MM都是草包，但是想泡漂亮MM，GG就绝不能是草包。假如你是草包怎么办？很好办，你只需桃花运当头，泡她的GG比你更草包。 <br /><br />第十七计：两面计。外表绅士，暗地流氓，有这两种面孔的人，泡起妞来厉害得不得了。此计前人之途备矣，郎君不想续貂。只说中国的流氓文化。十个GG九个黄，还有一个是流氓。流氓皆是男人中的才俊之士，因此几千年来，流氓泡妞成功率一直居高不下。在诗经里借抱布贸丝泡妞的是小流氓，升官发财的是大流氓，当皇帝的是最大的流氓。你不要自吹泡的妞多，再多还多过皇帝吗？ <br /><br />第十八计：蝴蝶计。你和我是蝴蝶的双翅，停落时挨紧，飞翔时分离。此计运用到妙处，若即若离，如蝶舞动。这是程度较高的GG泡档次较高的MM常用手段。若即若离不是对MM忽冷忽热，而是你的一即一离都要牵动MM的芳心。动心——很奇妙的一件事呀！ <br /><br />第十九计：解牛计。庖丁解牛目无全牛，泡妞有了境界也会目无全妞。庖丁解牛十九年来，游刃有余，看到牛还怵然为戒，视为止，行为迟，动刀甚微；熟练的GG看到MM也都会小心翼翼的。庖丁刀下，牛如土委地；GG枪下，妞如土委地。特别注意，庖丁解牛刀十九年而刀刃若新发于硎，郎君不知道世上有没有GG泡妞十九年还枪如少年新的。泡妞慎之，慎之，泡妞天下之凶器，不得已而为之呀！ <br /><br />第二十计：画饼计。画饼当然是为了充饥。没有泡到MM，拿张MM的片片总是聊胜于无。郎君曾迷惑，把此计定为画饼计呢，还是望梅记呢？最后还是决定画饼吧，因为已经有情圣鱼丝画过饼了，想必画饼比望梅爽一些。望梅的滋味酸酸的，牙倒了可不妙。画饼容易泡妞难，年年画饼不是咱。 <br /><br />第二一计：唐诗计。熟读唐诗三百首，不会吟诗也会淫。爱的生说过，泡妞天才是百分之一的灵感加上百分之九十九的汗水。你流了百分之九十九的泡妞汗水，差不多已经是泡妞天才了。泡妞是个熟练活儿，没有泡到妞吗？不是你运气不好，而是你不熟练。有诗为证泡妞正当午，汗滴禾下土，谁知泡MM，个个皆辛苦。 <br /><br />第二二计：厕所计。不是教你偷窥上厕所的MM啊。你憋着SN的时候想上厕所，或者上厕所只是想在清净一下，抽根烟，然后呢？当然是离开，有谁BT想在厕所呆一辈子。你有很多种原因去泡妞，你有很多种原因把泡到的妞甩开。唉！这就是现实，未泡妞先打算甩妞，是GG的悲哀也是MM的悲哀 <br /><br />第二三计：苹果计。苹果砸脑袋，牛顿第一时间想到万有引力。MM经过面前，你要象牛GG学习，要在第一时间想到泡她。世间诸物道理相通，万有引力定理适用于泡妞定理，有漂亮MM经过时，GG总会感觉到万有引力。泡妞成功与GG质量成正比，距离成反比。你一时没有办法提高质量，只有想办法接近距离，近水楼台先得月，近身GG先得妞。其实MM没有人泡，也是挺寂寞的，让一个MM寂寞，简直是在犯罪。不信咱们可以在东方MM身上做个试验，一天不与东方MM打招呼，看东方MM什么反应。不过这个协议可能达不成，东方MM太招狼爱了。 <br /><br />第二四计：小鲜计。治大国如烹小鲜，泡妞如治国。老子的话意思不是说治大国象是烹小鱼一样容易，而是说烹小鱼时不能总是翻动，会把鱼翻烂的，讲的是无为而治。泡妞到了无为而泡的境界，当然是想泡谁就泡谁。不过无为的难度太大，对初学乍练的GG 只需要记得说话做事要三思而行，废话少说，闲淡事儿少做。每句话，每件事都要起到良好的泡妞效果，要搔到MM痒处，象烹小鲜一样，翻动不多，却是事半功倍。 <br /><br />第二五计：霸王计。郎君不是让GG们温习好《刑法》后搞rape。温柔对许多MM根本没有杀伤力，那就需要来个霸王硬上弓。初中物理教科书中提示我们，泡妞的阻力是恒定的，那泡妞力度越大，泡妞速度越快。当然你使霸王力的时候，一定会遇到MM 的阻力，你用的力一定要超过阻力，否则MM是不会就范的。能不能用霸王计，可以做个小测试，她在街上和一个男人手挽手逛，这时你敢不敢捧起她的脸吻一下，如果不敢，建议你用第二十计吧。 <br /><br />第二六计：睡觉计。如果泡妞萎靡不振，那就好好睡一觉去。你对她朝思暮想，衣带渐宽，她根本不会知道。当面她可以是主，背后就当她是猪好了。睡一觉去吧，明天你可以精神饱满地对她说昨夜一夜未睡，让她的心打鼓去吧。连睡觉都睡不好的GG，怎么能泡得好MM。可以毫不张地说，睡觉是检验泡妞心理素质的唯一标准。 <br /><br />第二七计：开心计。要泡妹妹得先到开心E族贫贫嘴，什么时候练得心花了，眼绿了，嘴油了，就可以泡妞去了。MM喜欢幽默的GG千古不变。梁锦松是怎么泡到伏明霞的，据伏明霞说，梁比较幽默。MM和你在一块儿开开心心的，这时候，你撵MM走，她都舍不得走。建议开心版弄个开心GG比赛，取得名次的皆可出师泡妞。 <br /><br />第二八计：牙婆计：如果没有红娘，张生泡不成莺莺；如果没有王婆，西门庆泡不成潘金莲。中介的力量真是强大呀。不要找GG为你牵线搭桥，顺手牵羊的教训太多了。郎君求学时曾与MM探讨过，要是张生泡红娘，西门庆泡王婆，世界将会怎样？ <br /><br />第二九计：秋鸿计。苏东坡告诫他侄女世上的常用泡妞手段是：人似秋鸿来有信，事如春梦了无痕。春梦无痕说的是三六计计中的最后一计，下文有交待。人似秋鸿说的是泡妞也得讲诚信，虽然女人的别名叫弱智，但女人感觉一向挺灵敏，诚信不诚信，她能感觉到。《礼记[$#8226]中庸》上说，诚者自成也。 <br /><br />第三十计：彩票计。买彩票为了中奖，虽然中奖的可能性很小。泡个好MM和买中头彩的难度差不多。有的GG不见兔子不撒鹰，有的GG的鹰吐血了还是没捕到兔子，但为了泡到合意的MM，GG们还是前赴后继。买彩票看彩经，泡妞看泡经，只能稳稳神罢了，总有总差那么一点的感觉。一道简单的几率题，身材好的MM一百个里也没一个，漂亮的MM一百个里面也没有一个，有素养的MM一百个里面也没有一个，一百的三次方是一百万，好妹妹是百万里挑一呀！。郎君忠告，中五块钱的彩票也是中彩，泡60分的妞也是泡妞。 <br /><br />第三一计：醉酒计。酒是色媒人，MM喝完酒容易搞定。可是现在很多GG不争气，喝酒喝不过MM。伤心ing，不愿多说。 <br /><br />第三二计：克螂计。屎克螂推粪球，武大郎玩夜猫子，什么档次的GG泡什么档次的MM，一般情况下是这样的，非要癞蛤蟆吃天蛾肉，别最后连苍蝇屎都吃不上。羡慕牛粪上插鲜花是正常的心理反应。可你别小瞧牛粪，他必有过人之处。赖汉取仙妻，表面风光，那赖汉背地里不知道承受了多少苦难，能娶到仙妻的赖汉，与伟人相去不远。 <br /><br />第三三计：守拙计。郭靖将守拙计运用得出神入化，所以武功练成了，黄蓉泡成了。非有大智慧不能用此计，郎君只是提一下这种现象罢了，真能达到大巧若拙境界的，哪里还用郎君教他怎么泡妞，都可以当郎君的老师了。郎君就没见过有真傻的小子能泡到好MM的。 <br /><br />第三四计：撞钟计。妞儿寂寞了，总是难免红杏出墙，所以你要时常恐固。做一天和尚撞一天钟，泡一天MM就要多讨好一天MM，不过现在MM挺复杂的，你就是天天临幸她，她也难免对别的GG投怀送抱，不过你对她好一点，她对别的GG投怀的次数少一点。长叹！这世道，出墙少的MM就是好MM，55555555555555555 <br /><br />第三五计：存酒计。郎君从来不会把酒储在一处，否则会酒到喝时尽空瓶，常用的方法是，某处存酒A，某处存酒B，某处……妞到用时方恨少，时常需要诸备一些备用。某处存MM甲，某处存MM乙，某处…… <br /><br />第三六计：飞翼计。苏东坡向侄女这样解释泡妞：“事如春梦了无痕”。李白说得狠：“事了拂衣去，深藏身与名”。GG常吟的一句诗，万花丛中过，片叶不沾身。郎君深明此理，所以将此计为压卷之计，三十六计，走都嫌慢，还是飞来得快</font>
		</div>
<img src ="http://www.cnitblog.com/gyn/aggbug/23444.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2007-03-01 20:23 <a href="http://www.cnitblog.com/gyn/archive/2007/03/01/23444.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sqlite无记录操作</title><link>http://www.cnitblog.com/gyn/archive/2006/12/17/20678.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sun, 17 Dec 2006 06:46:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/12/17/20678.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/20678.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/12/17/20678.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/20678.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/20678.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal">
				<span lang="EN-US">Sqlite</span>
				<span style="FONT-FAMILY: 宋体">中借鉴了</span>
				<span lang="EN-US">oracle</span>
				<span style="FONT-FAMILY: 宋体">、</span>
				<span lang="EN-US">db2</span>
				<span style="FONT-FAMILY: 宋体">以及</span>
				<span lang="EN-US">postgresql</span>
				<span style="FONT-FAMILY: 宋体">中得</span>
				<span lang="EN-US">null</span>
				<span style="FONT-FAMILY: 宋体">操作方法，也就是借由</span>
				<span lang="EN-US">coalesce</span>
				<span style="FONT-FAMILY: 宋体">的方法来处理</span>
				<span lang="EN-US">null</span>
				<span style="FONT-FAMILY: 宋体">类型的数据。当遇到返回</span>
				<span lang="EN-US">null</span>
				<span style="FONT-FAMILY: 宋体">数据时，</span>
				<span lang="EN-US">coalesce</span>
				<span style="FONT-FAMILY: 宋体">将第二个参数代替</span>
				<span lang="EN-US">null</span>
				<span style="FONT-FAMILY: 宋体">。举例如下：</span>
		</p>
		<p class="MsoNormal">
				<span style="FONT-FAMILY: 宋体">有表</span>
				<span lang="EN-US">phones</span>
				<span style="FONT-FAMILY: 宋体">：</span>
				<br />
				<span lang="EN-US">create table phones(name text, number integer);</span>
				<br />
				<span lang="EN-US">insert into phones values(‘josh’, 86123413);</span> <br /><span lang="EN-US">insert into phones values(‘mariah’, 89804517);</span><br /><span lang="EN-US">insert into phones values(‘samantha’, NULL);</span></p>
		<p class="MsoNormal">
				<span style="FONT-FAMILY: 宋体">很不幸，</span>
				<span lang="EN-US">samantha</span>
				<span style="FONT-FAMILY: 宋体">的办公室还没有装电话，所以在表里虽然有她的名字但只能用</span>
				<span lang="EN-US">NULL</span>
				<span style="FONT-FAMILY: 宋体">来做填充。如果有人希望在该数据库中查询她的电话时，将得到一个</span>
				<span lang="EN-US">NULL</span>
				<span style="FONT-FAMILY: 宋体">的数据。当然首先是要设置</span>
				<span lang="EN-US">null</span>
				<span style="FONT-FAMILY: 宋体">的表示字符串，通常情况下我们使用</span>
				<span lang="EN-US">’NULL’</span>
				<span style="FONT-FAMILY: 宋体">来表示。为了更清楚地表达这种不存在的状况就需要使用</span>
				<span lang="EN-US">coalesce</span>
				<span style="FONT-FAMILY: 宋体">。<br /></span>
				<span lang="EN-US">Select coalesce(number, ‘no phone number for ’||name) as number from phones where name = ‘samantha’;</span>
		</p>
		<p class="MsoNormal">
				<span style="FONT-FAMILY: 宋体">这样的查询可以得到合适的结果。至此似乎一切顺利，可事实上却忽视了一种最基本的情况。</span>
		</p>
		<p class="MsoNormal">
				<span lang="EN-US">Select coalesce(number, ‘no phone number for ’||name) as number from phones where name = ‘tata’;</span>
		</p>
		<p class="MsoNormal">
				<span style="FONT-FAMILY: 宋体">公司里大概是没有一个叫</span>
				<span lang="EN-US">tata</span>
				<span style="FONT-FAMILY: 宋体">的人，也许我们甚至难以确定他的性别。可是即便使用了</span>
				<span lang="EN-US">coalesce</span>
				<span style="FONT-FAMILY: 宋体">也将一无所获。</span>
				<span lang="EN-US">Sqlite</span>
				<span style="FONT-FAMILY: 宋体">里就是这样的，相关的文档里没有作出很好的解释。但它的确是返回了一个</span>
				<span lang="EN-US">NULL</span>
				<span style="FONT-FAMILY: 宋体">值的，这个可以使用</span>
				<span lang="EN-US">nullif</span>
				<span style="FONT-FAMILY: 宋体">来得到证实。<br /></span>
				<span lang="EN-US">Select nullif((Select number from phones where name = ‘tata’), NULL) as result;</span>
		</p>
		<p class="MsoNormal">
				<span style="FONT-FAMILY: 宋体">还好可以确定它返回了一个</span>
				<span lang="EN-US">NULL</span>
				<span style="FONT-FAMILY: 宋体">，只要将</span>
				<span lang="EN-US">nullif</span>
				<span style="FONT-FAMILY: 宋体">嵌到</span>
				<span lang="EN-US">coalesce</span>
				<span style="FONT-FAMILY: 宋体">中便可以得到希望的结果了。</span>
				<br />
				<span lang="EN-US">Select coalesce(nullif((Select number from phones where name = ‘tata’), NULL) , ‘no such person’) as result;</span>
		</p>
<img src ="http://www.cnitblog.com/gyn/aggbug/20678.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-12-17 14:46 <a href="http://www.cnitblog.com/gyn/archive/2006/12/17/20678.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>sqlite远程连接示例</title><link>http://www.cnitblog.com/gyn/archive/2006/12/14/20463.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Thu, 14 Dec 2006 01:29:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/12/14/20463.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/20463.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/12/14/20463.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/20463.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/20463.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span style="font-family: Arial;" lang="EN-US">Sqlite</span>
				<span style="font-family: 宋体;">是一个只有几百</span>
				<span style="font-family: Arial;" lang="EN-US">k</span>
				<span style="font-family: 宋体;">大小的、</span>
				<span style="font-family: 宋体;">优秀的嵌入式数据库，本身不带有远程连接的功能。由于其身材小，速度快并且为众多的语言支持，所以在单机领域得到了广泛的使用。但由于天然不支持服务</span>
				<span style="font-family: Arial;" lang="EN-US">/</span>
				<span style="font-family: 宋体;">客户端的模式，使其在遇到小型规模数据库远程连接的情况时不得不借助于附加的编程。</span>
				<span style="font-family: Arial;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span style="font-family: 宋体;">单位有三百多人，作为网管每天要接到很多电话，有很多一时无法想起对应的名字，翻查通讯录不仅速度慢而且容易漏过。为了方便起见，在</span>
				<span style="font-family: Arial;" lang="EN-US">sqlite</span>
				<span style="font-family: 宋体;">上建立了一个通讯录数据表，然后用</span>
				<span style="font-family: Arial;" lang="EN-US">perl</span>
				<span style="font-family: 宋体;">编写了一个查询脚本。效果不错的同时，也有同事希望可以得到一份拷贝。但是这时遇到一个问题，如何保证通讯录在不同人手中保持版本的统一性。最好的办法是建立一个服务</span>
				<span style="font-family: Arial;" lang="EN-US">/</span>
				<span style="font-family: 宋体;">客户端的模式，在本机上维护一个数据库，而其它人通过连接数据库得到相关的查询结果。</span>
				<span style="font-family: Arial;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span style="font-family: 宋体;">具体的解决方法是这样的：在本机上维护一个到</span>
				<span style="font-family: Arial;" lang="EN-US">sqlite</span>
				<span style="font-family: 宋体;">数据库的连接并建立一个来自于客户端的</span>
				<span style="font-family: Arial;" lang="EN-US">socket</span>
				<span style="font-family: 宋体;">的监听，接受远程查询条件并回复查询结果；客户端志负责发送和接受这些最简单的任务。</span>
				<span style="font-family: Arial;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="text-indent: 21pt;">
				<span style="font-family: 宋体;">客户端的代码：</span>
				<span style="font-family: Arial;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<div style="border: 1pt solid windowtext; padding: 1pt 4pt;">
				<p class="MsoNormal" style="border: medium none ; padding: 0cm;">
						<span style="font-family: Arial;" lang="EN-US">use strict;<br />my $in_buffer = undef;<br />my $PF_INET = 2;<br />my $port = 2345;<br />my $remote_addr =
pack('SnC4x8',$PF_INET,$port,192,168,138,228);<br />my $SOCK_DGRAM = 2;<br />socket(UDP_CLIENT, $PF_INET, $SOCK_DGRAM,
getprotobyname('udp'));<br />while(1){<br /><span style="">       </span>print("</span>
						<span style="font-family: 宋体;">输入名字或号码：</span>
						<span style="font-family: Arial;" lang="EN-US">");<br /><span style="">       </span>my
$out_buffer=&lt;STDIN&gt;;<br /><span style="">       </span>chomp($out_buffer);<br /><span style="">       </span>if($out_buffer
eq "exit"){last;}<br /><span style="">       </span>send(UDP_CLIENT,
$out_buffer, 0, $remote_addr);<br /><span style="">       </span>print("waiting
for reply...\n");<br /><span style="">       </span>recv(UDP_CLIENT,
$in_buffer, 100, 0);<br /><span style="">       </span>chomp($in_buffer);<br /><span style="">       </span>print("$in_buffer\n");<br />}<br />close(UDP_CLIENT);<o:p></o:p></span>
				</p>
		</div>
		<p class="MsoNormal">
				<span style="font-family: Arial;" lang="EN-US">
						<span style="">       </span>
				</span>
				<span style="font-family: 宋体;">服务器端的代码：</span>
				<span style="font-family: Arial;" lang="EN-US">
						<o:p>
						</o:p>
				</span>
		</p>
		<div style="border: 1pt solid windowtext; padding: 1pt 4pt;">
				<p class="MsoNormal" style="border: medium none ; padding: 0cm;">
						<span style="font-family: Arial;" lang="EN-US">BEGIN{<br /><span style="">       </span>if( $^O
eq 'MSWin32' ){<br /><span style="">              </span>require
Win32::Console;<br /><span style="">              </span>Win32::Console::Free();<br /><span style="">       </span>}<br />}<o:p><br /></o:p></span>
				</p>
				<p class="MsoNormal" style="border: medium none ; padding: 0cm;">
						<span style="font-family: Arial;" lang="EN-US">use strict;<br />use DBI;<o:p><br /></o:p></span>
				</p>
				<p class="MsoNormal" style="border: medium none ; padding: 0cm;">
						<span style="font-family: Arial;" lang="EN-US">#database parameters<br />my $db_path = 'd:/src/cc/phones.db';<br />my $dbh =
DBI-&gt;connect("dbi:SQLite:$db_path", {PrintError =&gt; 0}) or die
$DBI::errstr;<br />my $sth = undef;<o:p><br /></o:p></span>
				</p>
				<p class="MsoNormal" style="border: medium none ; padding: 0cm;">
						<span style="font-family: Arial;" lang="EN-US">#socket server parameters<br />my $in_buffer = undef;<br />my $out_buffer = undef;<br />my $PF_INET = 2;<br />my $port = 2345;<br />my $local_addr =
pack('SnC4x8',$PF_INET,$port,192,168,138,228);<br />my $SOCK_DGRAM = 2;<br />socket(UDP_SERVER, $PF_INET,$SOCK_DGRAM,
getprotobyname('udp')) or die("$!");<br />bind(UDP_SERVER, $local_addr) or die("$!");<br />listen(UDP_SERVER, 10);<o:p><br /></o:p></span>
				</p>
				<p class="MsoNormal" style="border: medium none ; padding: 0cm;">
						<span style="font-family: Arial;" lang="EN-US">while(1){<br /><span style="">       </span>#receive
query then send result<br /><span style="">       </span>last
unless my $remote_addr = recv(UDP_SERVER,$in_buffer,100,0);<br /><span style="">       </span>chomp($in_buffer);<br /><span style="">       </span>if($in_buffer
=~ /^[0-9]{6}$/){<br /><span style="">              </span>$sth
= $dbh-&gt;prepare("select * from phones where number = $in_buffer");<br /><span style="">              </span>PROCEDURE:<br /><span style="">              </span>$sth-&gt;execute();<br /><span style="">              </span>my
@items = $sth-&gt;fetchrow_array();<br /><span style="">              </span>if(scalar(@items)){<br /><span style="">                     </span>$out_buffer
= $items[0].'</span>
						<span style="font-family: 宋体;">的虚拟网号码是</span>
						<span style="font-family: Arial;" lang="EN-US">'.$items[1];<br /><span style="">              </span>}else{<br /><span style="">                     </span>$out_buffer
= '</span>
						<span style="font-family: 宋体;">查无此人</span>
						<span style="font-family: Arial;" lang="EN-US">';<br /><span style="">              </span>}<br /><span style="">       </span>}else{<br /><span style="">              </span>$sth
= $dbh-&gt;prepare("select * from phones where name = '$in_buffer'");<br /><span style="">              </span>goto
PROCEDURE;<br /><span style="">       </span>}<span style=""><br />       </span>send(UDP_SERVER,$out_buffer,0,$remote_addr);<br />}<o:p><br /></o:p></span>
				</p>
				<p class="MsoNormal" style="border: medium none ; padding: 0cm;">
						<span style="font-family: Arial;" lang="EN-US">#disconnect from sqlite<br />$dbh-&gt;disconnect();<span style="">   </span><o:p></o:p></span>
				</p>
		</div>
<img src ="http://www.cnitblog.com/gyn/aggbug/20463.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-12-14 09:29 <a href="http://www.cnitblog.com/gyn/archive/2006/12/14/20463.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个直接运行c程序的东东－tiny C</title><link>http://www.cnitblog.com/gyn/archive/2006/12/12/20394.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Tue, 12 Dec 2006 00:37:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/12/12/20394.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/20394.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/12/12/20394.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/20394.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/20394.html</trackback:ping><description><![CDATA[前段时间看见ibm上有人介绍tiny c，就下了一个试试，感觉不错，为了方便起见，又弄了一个bat。<br />比方说，我把tiny c安装在d盘根目录下，然后我在d盘里建个tiny的文件存放如下内容的名为tiny的bat文件：<br />@echo off<br />tcc -run -I d:/tcc/include -L d:/tcc/lib %1<br />然后在环境变量path中加入d:\tiny，然后就可以运行c脚本了。<br />写个hello, world，取名为hello.c，存在随便哪里。然后到cmd里，cd到那个文件夹下，再“tiny hello.c”，接着cmd里就会显示“hello, world”鸟。<br /><img src ="http://www.cnitblog.com/gyn/aggbug/20394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-12-12 08:37 <a href="http://www.cnitblog.com/gyn/archive/2006/12/12/20394.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>tcl文本操作示例</title><link>http://www.cnitblog.com/gyn/archive/2006/11/27/19617.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Mon, 27 Nov 2006 02:16:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/11/27/19617.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/19617.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/11/27/19617.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/19617.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/19617.html</trackback:ping><description><![CDATA[因为要在windows上使用expect的缘故，所以学习了tcl。还是用我在上一篇随笔中使用的例子来入门。<br /><br />set seconds [clock seconds]<br />set timer [clock format $seconds -format %D]<br /><br />regexp {([0-9]{2})/([0-9]{2})/([0-9]{2})} $timer match month day year<br />set rep_smp "20$year$month$day"<br />set rep_full "20$year-$month-$day"<br /><br />set rpjf [open {shixian.rpjf} r]<br />set tmp [open {tmp.txt} w]<br /><br />while {[expr ![eof $rpjf]]} {<br />    gets $rpjf content<br />    set content [regsub {([0-9]{4})-([0-9]{2})-([0-9]{2})} $content $rep_full]<br />    set content [regsub {[0-9]{4}[0-9]{2}[0-9]{2}} $content $rep_smp]<br />    puts $tmp "$content"<br />    }<br /><br />flush $tmp<br />close $rpjf<br />close $tmp<br /><br />tcl语法用一句话概括的话就是：命令加参数。相比perl与python来说，tcl的语法相对简单一些，但是这并不代表就不如以上两者，各有各的特点而已。在tk和expect上tcl不仅仅是先驱而且也是做得最好的。<br /><img src ="http://www.cnitblog.com/gyn/aggbug/19617.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-11-27 10:16 <a href="http://www.cnitblog.com/gyn/archive/2006/11/27/19617.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>分别用vbs、perl、python来操作文本</title><link>http://www.cnitblog.com/gyn/archive/2006/11/15/19177.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Wed, 15 Nov 2006 03:29:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/11/15/19177.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/19177.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/11/15/19177.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/19177.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/19177.html</trackback:ping><description><![CDATA[都是用来更新一个rm视频参数文件的。最早学asp的时候顺便用vbs写了一个，后来学perl就又写了一个，现在学python，凑活也写一个。基本上算是我的一个入门程序。用途就是用简单正则表达式找到时间段，再将它更新为当天日期，更新后的数据存在temp.txt中。perl最短，python比较干净。<br />vbs：<br />dim regOR<br />set regOR=new regexp<br />regOR.ignorecase=True<br />regOR.global=True<br />regOR.pattern="^([0-9]{1})$"<br />dim mytime<br />mytime=date<br />yy=year(mytime)<br />mm=month(mytime)<br />dd=day(mytime)<br />if regOR.test(mm) then<br />    mm=regOR.replace(mm,"0$1")<br />end if<br />if regOR.test(dd) then<br />    dd=regOR.replace(dd,"0$1")<br />end if<br />mytime=yy &amp; "-" &amp; mm &amp; "-" &amp; dd<br />dest=yy &amp; mm &amp; dd<br />pattern1="(.*[^0-9])([0-9]{4}\-[0-9]{2}\-[0-9]{2})([^0-9].*)"<br />pattern2="(.*[^0-9])([0-9]{8})([^0-9].*)"<br />regOR.pattern=pattern1<br />dim tempstring<br />Set fso = CreateObject("Scripting.FileSystemObject")<br />Set f = fso.CreateTextFile("d:\shixian\temp.txt", True)<br />Set fr = fso.GetFile("d:\shixian\shixian.rpjf")<br />Set ts = fr.OpenAsTextStream(1,-2)<br />do until ts.AtEndOfStream<br />    tempstring=ts.readline<br />    if regOR.test(tempstring) then<br />        tempstring=regOR.replace(tempstring,"$1" &amp; mytime &amp; "$3")<br />    end if<br />    regOR.pattern=pattern2<br />    if regOR.test(tempstring) then<br />        tempstring=regOR.replace(tempstring,"$1" &amp; dest &amp; "$3")<br />    end if<br />    regOR.pattern=pattern1<br />    f.writeline(tempstring)<br />loop<br />ts.close<br />f.close<br />set regOR=nothing<br />set ts=nothing<br />set fr=nothing<br />set f=nothing<br />set fso=nothing<br /><br />perl：<br />open(RPJF,"&lt;c:/code/10161.rpjf") or die("can not open because of $!\n");<br />open(TEMP,"&gt;c:/code/temp.txt") or die("can not open because of $!\n");<br />($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();<br />$mday = sprintf("%.2d",$mday);<br />$mon = sprintf("%.2d",$mon+1);<br />$year += 1900;<br />$timerF = "$year"."$mon"."$mday";<br />$timerS = "$year"."-"."$mon"."-"."$mday";<br />while(&lt;RPJF&gt;){<br />    chomp();<br />    $_=~s/(.*)([0-9]{8})(.*)/$1$timerF$3/;<br />    $_=~s/(.*)([0-9]{4}\-[0-9]{2}\-[0-9]{2})(.*)/$1$timerS$3/;<br />    print TEMP "$_\n";<br />}<br />close(RPJF);<br />close(TEMP);<br /><br />python：<br />import re<br />import time<br /><br />pattern_name = re.compile(r'[0-9]{8}')<br />pattern_info = re.compile(r'[0-9]{4}\-[0-9]{2}\-[0-9]{2}')<br />(year, month, day) = time.localtime()[:3]<br />name = '%d%.2d%.2d' % (year, month, day)<br />info = '%d-%.2d-%.2d' % (year, month, day)<br /><br />try:<br />    file_rpjf = open('shixian.rpjf', 'r')<br />    file_temp = open('temp.txt', 'w')<br />    try:<br />        file_data = file_rpjf.readline()<br />        while file_data != '':<br />            file_data = pattern_name.sub(name, file_data)<br />            file_data = pattern_info.sub(info, file_data)<br />            file_temp.write(file_data)<br />            file_data = file_rpjf.readline()<br />    finally:<br />        file_rpjf.close()<br />        file_temp.close() <br />except IOError:<br />    pass<br /><img src ="http://www.cnitblog.com/gyn/aggbug/19177.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-11-15 11:29 <a href="http://www.cnitblog.com/gyn/archive/2006/11/15/19177.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>I Do(Cherish You)</title><link>http://www.cnitblog.com/gyn/archive/2006/11/05/18842.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sun, 05 Nov 2006 04:58:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/11/05/18842.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/18842.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/11/05/18842.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/18842.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/18842.html</trackback:ping><description><![CDATA[All I am, all I'll be<br />Everything in this world<br />All that I'll ever need<br />Is in your eyes<br />Shining at me<br />When you smile I can feel<br />All my passion unfolding<br />Your hand brushes mine<br />And a thousand sensations<br />Seduce me 'cause I<br /><br />I do cherish you<br />For the rest of my life<br />You don't have to think twice<br />I will love still<br />From the depths of my soul<br />It's beyond my control<br />I've waited so long to say this to you<br />If you're asking do I love you this much<br />I do<br /><br />In my world, before you<br />I lived outside my emotions<br />Didn't know where I was going<br />'Til that day I found you<br />How you opened my life<br />To a new paradise<br />In a world torn by change<br />Still with all of my heart<br />'Til my dying day <br /><embed src="http://202.96.80.8/UploadFile/2005-8/2005829215139469.wma" height="0" hidden="true" type="audio/x-ms-wma" loop="1" autostart="1"></embed><img src ="http://www.cnitblog.com/gyn/aggbug/18842.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-11-05 12:58 <a href="http://www.cnitblog.com/gyn/archive/2006/11/05/18842.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>看看python吧</title><link>http://www.cnitblog.com/gyn/archive/2006/10/28/18544.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sat, 28 Oct 2006 06:36:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/10/28/18544.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/18544.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/10/28/18544.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/18544.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/18544.html</trackback:ping><description><![CDATA[近年来python发展迅猛，无论在gui还是在web开发上渐渐显示出强大的实力。而perl却由于初期错误的开发方向，导致迟迟无法发布perl6。相比与python的蒸蒸日上、优秀的开发平台、活跃的社区，perl给人的感觉就是江河日下。单说wxwidget，perl版的连英文文档都少的可怜，而python早就有boa这样优秀的平台了；而在perl原先引以为傲的web开发领域，现在的perl又有多少发言权，所谓的成功案例永远都是亚马逊在线。难以驾驭大型项目更是perl的顽疾，越来越多的perler转向了python。虽然还是可以用缓慢而迟钝的pugs体验也许永远不会到来的perl6，但是还是会感到一些失落。<br /><img src ="http://www.cnitblog.com/gyn/aggbug/18544.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-10-28 14:36 <a href="http://www.cnitblog.com/gyn/archive/2006/10/28/18544.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Ruby on Rails中添加对ibm DB2数据库的支持</title><link>http://www.cnitblog.com/gyn/archive/2006/08/20/15623.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sun, 20 Aug 2006 13:11:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/08/20/15623.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/15623.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/08/20/15623.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/15623.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/15623.html</trackback:ping><description><![CDATA[
		<p>Rails缺省没有对DB2的支持，倒是对mysql和postgresql支持得很全。事实上，用DB2来Rails的确不太配，但是有人用就该有相关得支持，还好<a href="http://raa.ruby-lang.org/project/ruby-db2">http://raa.ruby-lang.org/project/ruby-db2</a>里有相应程序得下载。这是google上搜出来的，但下下了却不知道咋装（偶刚摸ruby不久）。捣鼓了几下才发现，原来相当简单。<br />我是直接运行下载下来的包中的setup.rb文件的<br />ruby -w setup.rb<br />结果失败，显示如下：<br />setup.rb:714: warning: don't put space before argument paremtheses<br />unknown global option ''<br />try "ruby setup.rb --help" for usage<br />于是按照提示<br />ruby setup.rb --help<br />又得到一堆提示，选了其中一条安装命令试试<br />ruby setup.rb install<br />结果，又失败<br />setup.rb config first<br />try "ruby setup.rb --help" for usage<br />原来先要config过，接下来就一帆风顺了，依次键入<br />ruby setup.rb config<br />ruby setup.rb install<br />安装完了<br /></p>
<img src ="http://www.cnitblog.com/gyn/aggbug/15623.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-08-20 21:11 <a href="http://www.cnitblog.com/gyn/archive/2006/08/20/15623.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ruby symbol详解</title><link>http://www.cnitblog.com/gyn/archive/2006/08/13/15206.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Sun, 13 Aug 2006 11:17:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/08/13/15206.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/15206.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/08/13/15206.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/15206.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/15206.html</trackback:ping><description><![CDATA[
		<p>
				<strong>起因<br /></strong>最近在学习ruby on rails，的确是一个优秀的数据库开发框架。但在过程中，发现在视图文件夹中的rhtml文件里有大量的类似于以下的语句：<br />&lt;td&gt;&lt;%= link_to recipe.title, :action =&gt; "show", :id =&gt; 1 %&gt;&lt;/td&gt;<br />这是一个指向链接，如果没有冒号这句话的意思很好理解：这是一个指向<a href="http://127.0.0.1:3000/recipe/show/1">http://127.0.0.1:3000/recipe/show/1</a>的连接，也就是“显示”数据库表recipe中“id”为1的条目的信息，但让人不解的是action和id前面的冒号，它们是干甚么用的？</p>
		<p>
				<strong>ruby面向对象特性的一个缺点<br /></strong>ruby中，一切皆是对象。就一个简单的字符串举例：<br />ruby -e 'puts "hello world".class'<br />String<br />这里打印了"hello world"的字符串所属的类，结果显示它是一个String对象的实例。我们还可以显示它的对象号。<br />ruby -e 'puts "hello world".object_id'<br />41436168<br />ruby一向标榜自己是完全的面向对象的原因就在于此，它的确做的很彻底。但是凡事有好就有坏，一个对象占用的内存空间显然会比纯粹的变量大得多，当程序中涉及到大量的字符串时，一个ruby程序会占用过多的内存。举个例子说：<br />我们用hash列表来存储歌曲的信息<br />song1 = { 'title' =&gt; 'used to love you', 'artist' =&gt; 'john legend'}<br />song2 = { 'title' =&gt; 'i still', 'artist' =&gt; 'backstreet boys'}<br />#......<br />#很多歌，这里只用两首<br />for i in 1..2<br /> thesong="song"+i.to_s<br /> eval &lt;&lt;-PROC<br /> #{thesong}.each_key { |key| puts key.object_id.to_s }<br /> PROC<br />end<br />结果：<br />41436144<br />41436408<br />41435904<br />41436000<br />因为object_id各不相同，在hash表中的各个key都是独立的String对象，即使内容相同（如'title'），ruby还是将其视为不同的对象，这样就无端地占用了不少内存。但事实上，大多数情况下，我们仅将hash中的key视为字段而已，不会涉及到String类的方法，ruby自动将其设置为对象有杀鸡用牛刀之嫌。</p>
		<p>
				<strong>symbol是什么<br /></strong>直译来说就是“符号”，在ruby就是形如:action这样的，一个冒号后跟一段字符串。显然，根据“一切都是对象”定律，它也是一个对象。<br />ruby -e ' puts :action.class '<br />Symbol<br />这个对象存在的意义在于，它解决了“同内容字符串，不同对象”带来的过多占用内存的问题。简单的说:action代表了'action'字符串，这里说的是字符串，不是字符串对象。<br />ruby -e ' puts :action '<br />action<br />更确切的讲就是一个symbol对象代表该对象的冒号后的字符串。<br />ruby -e ' puts :action '<br />action<br />ruby -e ' puts :"hello world" ' <br />hello world<br />所有同内容的字符串只需要一个标记对象就可以代替，这样减少了不必要的对象建立和内存占用。但是，正如我强调的“symbol代表的是字符串，不是对象”，因此不要希望标记可以使用String类的诸如capitalize，center等方法，如果使用的话只会得到提示方法未定义的错误报告：<br />ruby -e ' puts :action.capitalize ' <br />-e:1: undefined method 'capitalize' for :action:Symbol' (NoMethodError)<br />幸运的是，symbol提供了转换函数to_s用来生成一个字符串对象，它会提取字符串内容并将其升级为对象。<br />ruby -e ' puts :action.to_s.capitalize ' <br />Action<br />另外，很重要的一点是，symbol没有赋值方法，换句话说symbol一旦定义，将不能改变。<br />ruby -e ' :action="hello" ' <br />syntax error<br />很遗憾，即使使用了to_s，赋值依然无法顺利进行，因为ruby会认为“to_s=”是一个未定义函数。除非明确地为被转换生成的字符串对象指定一个引用（但事实上在复制之后该连接的指向又发生了变化）：<br />:action<br />myaction=:action.to_s<br />myaction="lala"<br />puts myaction<br />结果：<br />lala<br /><br /><strong>怎么使用symbol</strong><br />任何可以使用symbol的地方都可以使用与之向对应的字符串对象。在rails中有建立类似javabean的方法：<br />attr_reader :action<br />它建立了一个读取实例变量@action的方法，也可以写成这样：<br />attr_reader "action"<br />反之，只要<br />字符串在程序运行过程中不用改变<br />字符串不必使用String类方法<br />那么我们可以放心用symbol来代替字符串对象，从而大大减少内存的占用，在rails中尤为明显。因为需要频繁地在各个控制方法和页面之间跳转和传出数据，大量的方法名由symbol来代替，及节约了内存也提高了运行速度。</p>
<img src ="http://www.cnitblog.com/gyn/aggbug/15206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-08-13 19:17 <a href="http://www.cnitblog.com/gyn/archive/2006/08/13/15206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NetBeans开发jsp快速入门</title><link>http://www.cnitblog.com/gyn/archive/2006/07/11/13499.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Tue, 11 Jul 2006 09:24:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/07/11/13499.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/13499.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/07/11/13499.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/13499.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/13499.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: NetBeans				开发				jsp				快速入门																																		NetBeans				是				java				公司免费提供用于				java				网页开发的工具，在				java				的官方网站上有它的详细介绍说明。按照指南中关于				web	...&nbsp;&nbsp;<a href='http://www.cnitblog.com/gyn/archive/2006/07/11/13499.html'>阅读全文</a><img src ="http://www.cnitblog.com/gyn/aggbug/13499.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-07-11 17:24 <a href="http://www.cnitblog.com/gyn/archive/2006/07/11/13499.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>行风热线网站服务器技术支持手册</title><link>http://www.cnitblog.com/gyn/archive/2006/06/13/12171.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Tue, 13 Jun 2006 06:25:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/06/13/12171.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/12171.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/06/13/12171.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/12171.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/12171.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 行风热线网站服务器技术支持手册																																																																				行风热线网站服务器技术支持手册																																						... 																								1			...&nbsp;&nbsp;<a href='http://www.cnitblog.com/gyn/archive/2006/06/13/12171.html'>阅读全文</a><img src ="http://www.cnitblog.com/gyn/aggbug/12171.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-06-13 14:25 <a href="http://www.cnitblog.com/gyn/archive/2006/06/13/12171.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>采编系统客户端网络的改造</title><link>http://www.cnitblog.com/gyn/archive/2006/06/02/11472.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Fri, 02 Jun 2006 08:23:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/06/02/11472.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/11472.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/06/02/11472.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/11472.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/11472.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 采编系统客户端网络的改造																				 																										关键词：						postgresql														数据库，						vlan														，						acl														，三层交换，路由	...&nbsp;&nbsp;<a href='http://www.cnitblog.com/gyn/archive/2006/06/02/11472.html'>阅读全文</a><img src ="http://www.cnitblog.com/gyn/aggbug/11472.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-06-02 16:23 <a href="http://www.cnitblog.com/gyn/archive/2006/06/02/11472.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>tcl精鼎B5100上安装RH9的一些经验</title><link>http://www.cnitblog.com/gyn/archive/2006/05/22/10928.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Mon, 22 May 2006 13:57:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/05/22/10928.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/10928.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/05/22/10928.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/10928.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/10928.html</trackback:ping><description><![CDATA[之前是装过debian的，很方便的，但对中文的支持不好，所以就放弃了。<br />RH9已经很老了，所以一直担心对这台相对较新的电脑支持不好，事实上也验证了我的想法。<br />装完之后，显示器频率只能定在60Hz，相当闪烁。用redhat-config-xfreevid调了一下，不见效果。又在参数文件中锁定85Hz，重启还是没有用。到intel网站下载linux用显卡驱动，是tar.gz包，安装有点麻烦，但还算顺利，重启后依旧没用。最后想起在debian里时，好像是用的vesa驱动，立即试了一下，成功！<br />声卡无法检测，于是安装alsa万能驱动，重启后发现声卡，但检测发声不正常(放屁状)，只有升级内核，这就麻烦了，日后再说。<br />再root中service postgresql start，解锁postgres用户，重设密码，su进入后，createuser个人用户，允许createdb，不允许createuser，su个人用户。现在可以使用数据库了。<br />基本上还算可以，就是数据库版本老了点，7.3.4的。在postgresql官方网站上没用找到8.1.3的RH9安装包，连8.0的也没有，估计已经停止支持了。<br />凑活用吧～～:-&gt;<img src ="http://www.cnitblog.com/gyn/aggbug/10928.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/gyn/" target="_blank">gyn_tadao</a> 2006-05-22 21:57 <a href="http://www.cnitblog.com/gyn/archive/2006/05/22/10928.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用批处理文件和vbs脚本实现网站视频自动录制</title><link>http://www.cnitblog.com/gyn/archive/2006/04/03/8611.html</link><dc:creator>gyn_tadao</dc:creator><author>gyn_tadao</author><pubDate>Mon, 03 Apr 2006 06:50:00 GMT</pubDate><guid>http://www.cnitblog.com/gyn/archive/2006/04/03/8611.html</guid><wfw:comment>http://www.cnitblog.com/gyn/comments/8611.html</wfw:comment><comments>http://www.cnitblog.com/gyn/archive/2006/04/03/8611.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/gyn/comments/commentRss/8611.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/gyn/services/trackbacks/8611.html</trackback:ping><description><![CDATA[
		<h2 style="MARGIN: 13pt 0cm; TEXT-ALIGN: center" align="center">
				<span style="FONT-FAMILY: 黑体">利用批处理文件和</span>
				<span lang="EN-US">
						<font face="Arial">vbs</font>
				</span>
				<span style="FONT-FAMILY: 黑体">脚本实现网站视频自动录制</span>
		</h2>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b>
						<span style="FONT-FAMILY: 宋体">关键字：</span>
						<span lang="EN-US">helix</span>
				</b>
				<b>
						<span style="FONT-FAMILY: 宋体">，</span>
						<span lang="EN-US">vbs</span>
				</b>
				<b>
						<span style="FONT-FAMILY: 宋体">脚本，批处理，压码参数文件</span>
						<span lang="EN-US">
								<?xml:namespace prefix = o /?>
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US"> <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span style="FONT-FAMILY: 宋体">现在电视台基本上都有了自己的门户网站，我们可以充分利用网络的优势来扩大本地电视台的影响。事实上，将本地电视台的每日的王牌节目挂在网站上的做法已经成为建立电视台网站的必要组成步骤之一了。但随之而来的问题是：每天定时需要的手工录制过程，将给管理者带来极大的不便。在</span>
				<span lang="EN-US">windows</span>
				<span style="FONT-FAMILY: 宋体">定时任务的基础上，将批处理程序与脚本程序有机的集合，就可以有效地解决这一问题。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span lang="EN-US"> <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b>
						<span lang="EN-US" style="FONT-SIZE: 14pt">1</span>
				</b>
				<b>
						<span style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体">：建立压码任务</span>
				</b>
				<b>
						<span lang="EN-US" style="FONT-SIZE: 14pt">
								<o:p>
								</o:p>
						</span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span style="FONT-FAMILY: 宋体">我们将使用一台带有视频采集卡的电脑来完成压码过程。虽然压码不是本文的重点，但还是有必要交代一下。主要就是使用</span>
				<span lang="EN-US">helix producer plus9</span>
				<span style="FONT-FAMILY: 宋体">建立一个压码参数文件，事实上它只是一个带有</span>
				<span lang="EN-US">rpjf</span>
				<span style="FONT-FAMILY: 宋体">后缀的</span>
				<span lang="EN-US">xml</span>
				<span style="FONT-FAMILY: 宋体">文件（图</span>
				<span lang="EN-US">1</span>
				<span style="FONT-FAMILY: 宋体">）。需要注意的是，音频输入选项有线路输入与</span>
				<span lang="EN-US">microphone</span>
				<span style="FONT-FAMILY: 宋体">输入两种，这需要与实际的接入线路相吻合；另外，不必选择</span>
				<span lang="EN-US">2 pass vedio encoding</span>
				<span style="FONT-FAMILY: 宋体">选项，选择它除了显示一个</span>
				<span lang="EN-US">warning</span>
				<span style="FONT-FAMILY: 宋体">外不会有任何效果；再者，因为现阶段绝大多数的网络接入模式为拨号和</span>
				<span lang="EN-US">dsl</span>
				<span style="FONT-FAMILY: 宋体">，所以只需要生成</span>
				<span lang="EN-US">56k</span>
				<span style="FONT-FAMILY: 宋体">和</span>
				<span lang="EN-US">384k</span>
				<span style="FONT-FAMILY: 宋体">码率的视频文件；最后，录制完成的视频文件，其名称最好用日期来标识，比如：</span>
				<span lang="EN-US">20060301.rm</span>
				<span style="FONT-FAMILY: 宋体">。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span lang="EN-US">&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />&lt;job xmlns="<a href="http://ns.real.com/tools/job.1.0.1">http://ns.real.com/tools/job.1.0.1</a>"&gt;<br />  &lt;enableTwoPass type="bool"&gt;false&lt;/enableTwoPass&gt;<br />  &lt;clipInfo&gt;<br />    &lt;entry&gt;<br />      &lt;name&gt;Author&lt;/name&gt;<br />      &lt;value type="string"&gt;ZSTV&lt;/value&gt;<br />    &lt;/entry&gt;<br />    &lt;entry&gt;<br />      &lt;name&gt;Copyright&lt;/name&gt;<br />      &lt;value type="string"&gt;(c) ZSTV2006 &lt;/value&gt;<br />    &lt;/entry&gt;<br />    &lt;entry&gt;<br />      &lt;name&gt;Keywords&lt;/name&gt;<br />      &lt;value type="string"&gt;ZSNews[2006-03-21]&lt;/value&gt;<br />    &lt;/entry&gt;<br />    &lt;entry&gt;<br />      &lt;name&gt;Title&lt;/name&gt;<br />      &lt;value type="string"&gt;ZSNews[2006-03-21]&lt;/value&gt;<br />    &lt;/entry&gt;<br />  &lt;/clipInfo&gt;<br />  &lt;input&gt;<br />    &lt;captureInput&gt;<br />      &lt;audioDeviceID type="string"&gt;Intel(r) Integrated Audio&lt;/audioDeviceID&gt;<br />.................................... <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span style="FONT-FAMILY: 宋体">我们可以建立一个名为</span>
				<span lang="EN-US">shixian.bat</span>
				<span style="FONT-FAMILY: 宋体">的批处理文件来的调用上面所示的参数文件，内部具体如下：</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21.1pt">
				<b>
						<span lang="EN-US">producer -j "d:\shixian\shixian.rpjf" -daw -lc "e,i"<o:p></o:p></span>
				</b>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span style="FONT-FAMILY: 宋体">默认的录制过程会实时监控音频变化，并将它记录到一个叫</span>
				<span lang="EN-US">producer.log</span>
				<span style="FONT-FAMILY: 宋体">的文件之中，但是产生的</span>
				<span lang="EN-US">wanging</span>
				<span style="FONT-FAMILY: 宋体">记录很多，很快就使</span>
				<span lang="EN-US">log</span>
				<span style="FONT-FAMILY: 宋体">文件变得巨大而且可能引起录制过程的意外中断，所以我们可以使用</span>
				<span lang="EN-US">-daw</span>
				<span style="FONT-FAMILY: 宋体">参数关闭音频监视，再用</span>
				<span lang="EN-US">lc “e,i”</span>
				<span style="FONT-FAMILY: 宋体">指明只记录错误和信息。这样做之后，录制过程就比较稳定了。</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt">
				<span style="FONT-FAMILY: 宋体">只要在计划中添加每日执行</span>
				<span lang="EN-US">shixian.bat</span>
				<span style="FONT-FAMILY: 宋体">文件的任务，我们就会每天得到一个相同文件属性和名称的</span>
				<span lang="EN-US">rm</span>
				<span style="FONT-FAMILY: 宋体">文件。在这里将每天产生一个带有</span>
				<span lang="EN-US">2006-03-21</span>
				<span style="FONT-FAMILY: 宋体">属性的、名为</span>
				<span lang="EN-US">20060321.rm</span>
				<span style="FONT-FAMILY: 宋体">文件。听起来很拗口，更糟糕的是这并没有减轻管理者的工作，因为他不得不每天打开服务器为其改名称。而且即便有幸雇佣了一名勤奋的管理员（他不介意每天做这样重复的事情），但他还是没办法更改文件中显示日期的属性，在这录制过程中已经决定了。除非</span>
				<span lang="EN-US">…….</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US"> <o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<b>
						<span lang="EN-US" style="FONT-SIZE: 14pt">2</span>
				</b>
				<b>
						<span style="FONT-SIZE: 14pt; FONT-FAMILY: 宋体">：