<?xml version="1.0" encoding="gb2312"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Trucy Weblog</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/" />
    <link rel="self" type="application/atom+xml" href="http://www.trucy.org/blog/atom.xml" />
   <id>tag:www.trucy.org,2010:/blog//2</id>
    <link rel="service.post" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2" title="Trucy Weblog" />
    <updated>2010-03-02T12:59:47Z</updated>
    <subtitle>楚 水 网 志</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.1</generator>
 

<entry>
    <title>nokia ovi 正在设置...</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2010/03/nokia_ovi_oyoue.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=3432" title="nokia ovi 正在设置..." />
    <id>tag:www.trucy.org,2010:/blog//2.3432</id>
    
    <published>2010-03-02T12:53:18Z</published>
    <updated>2010-03-02T12:59:47Z</updated>
    
    <summary>nokia ovi 正在设置... 免费GPS语音导航</summary>
    <author>
        <name>mQney</name>
        <uri>http://www.mqney.com</uri>
    </author>
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        　看到了Nokia的新的支持软件OVI，于是下载下来试用，据说还有免费语音导航，我也可以试试GPS了，虽然驾照刚被注销……
　　安装过程没问题，就是连接后一直显示“正在设置...”，无论是蓝牙连接还是USB数据线连接，sync all同步所有的按钮总是出不来，其他功能也都无法使用，好像是连接根本没有成功。
　　不知何故。
　　免费导航支持新推出的使用新平台的E72,71还不行，好像是处在免费试用90天，但是我也安装出声音了，就是不知道是不是走流量的高额收费，没敢太多试验。
　　据说，很快就会普及到E71等机型了。


　　装个英文版的ovi解决了正在设置...的问题。
        
    </content>
</entry>

<entry>
    <title>Movable Type 4.0</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2007/08/movable_type_40.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=2411" title="Movable Type 4.0" />
    <id>tag:www.trucy.org,2007:/blog//2.2411</id>
    
    <published>2007-08-16T11:24:23Z</published>
    <updated>2007-08-16T12:17:01Z</updated>
    
    <summary>What&apos;s New in Movable Type 4 Listed below is a comprehensive list of new features that you will find in Movable Type 4.0. Understanding Your Blogs BetterA completely reinvented user interfaceBuilt in reports on blog activityBlog-style presentation of your recent...</summary>
    <author>
        <name>Admin</name>
        
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<h2 id="archive-title">What's New in Movable Type 4</h2>

<div class="entry" id="entry-101">
    <div class="entry-content">

        <div class="entry-body">
            Listed below is a comprehensive list of new features that you will find in Movable Type 4.0. <br /><br /><font style="font-size: 1.25em;"><b>Understanding Your Blogs Better</b></font><br /><br /><ol><li>A completely reinvented user interface</li><li>Built in reports on blog activity</li><li>Blog-style presentation of your recent content makes it easy to skim and know at a glance how your blogs are doing</li><li>Customize your reports and user interface using the same MT template language that publishes your blog</li><li>A customizable dashboard to display just the information each user finds valuable</li><li>Smarter defaults throughout the system, offering more power with fewer configuration settings than MT 3.0</li><li>Powerful
listing screens with quick keyboard access keys and the ability to work
with multiple selections of entries, comments, or authors</li><li>Quick Filters on every listing screen let you jump to the most-frequently-accessed views of your information</li><li>Built-in
file manager for uploading and reusing assets like images or media
files lets you keep track of all the content in your blog, not just
entries</li></ol><font style="font-size: 1.25em;"><b>Better Publishing</b></font><br /><br /><ol start="10"><li> A powerful and simple re-sizable WYSIWYG Editor, with automatic
saving of drafts of entries and templates -- never lose a half-written
post again
</li><li> Built-in cross-blog aggregation: Publish pages that include data from some, all, or just one of your blogs
</li><li> The world's smartest template language, with boolean logic
for choosing which content to display. ("Show me posts by 'Jane' in the
category 'music' with tags 'bass NOT fish'.")
</li><li> Live preview shows you your entry before you publish, with full fidelity to your live blog
</li><li> Smart controls like auto-complete for tags, a calendar
selector for scheduling future-dated entries, and a completely redone
UI for selecting and creating categories
</li><li> Support for publishing standalone pages that automatically use blog templates and designs
</li><li> Better plain-text entry with built-in support for Markdown
and Textile, and conversion of MS Word "smart" quotes to HTML entities
</li><li> Even more SEO-friendly with customizable URLs per entry, per-template, or per-page
</li><li> A simple integrated IDE for templates, with smart error reporting for template typos
</li><li> Paginated archives -- easily walk your users through posts by date or author or category
</li></ol>

<font style="font-size: 1.25em;"><b>Build Real Community Sites<br /><br /></b></font>

<ol start="20"><li>OpenID support built in</li><li>Built-in user registration</li><li>Powerful profile pages for every user in your system</li><li>Customizable roles and even more granular user permissions let you control exactly what users can access</li><li>A
ratings framework that lets users rate any item in the system --
entries, comments, and in the future even authors or entire blogs</li><li>Easily reply to comments from right within the administration UI</li><li>Built in per-author archives let your readers connect with the people who publish the site</li><li>Automatically provision a new blog for each user who registers with the system</li><li>Built-in support for integrated spam fighting and optionally displaying a CAPTCHA for comments</li><li>Integrated email notifications -- let your readers know when a thread they're interested in has updated</li></ol><b><font style="font-size: 1.25em;">

The Most Powerful Management Tools Available</font></b>

<br /><br /><ol start="30"><li>A dramatically improved installation experience</li><li>Cross-blog management of entries, authors, comments, and community</li><li>Customizable, filterable RSS feeds for every management and listing screen in the application</li><li>Built-in diagnostic tools for system configuration information and troubleshooting</li><li>Blog cloning -- with one click, you can create a new blog that
inherits the styles, settings, templates, and configuration of any blog
in your system</li><li>Full Backup and Restore -- securely archives all your entries, comments, images, files, settings, and templates for safekeeping</li><li>Better import and export, with support for importing content all
previous versions of Movable Type as well as other popular blogging
platforms</li></ol><b><font style="font-size: 1.25em;">A Reinvigorated Community<br /><br /></font></b><ol start="37"><li> Create plugins without programming -- plain-text configuration files make it easier than ever to customize MT to your needs
</li><li> The world's largest single audience of shared templates and
themes -- the ability to reuse themes and templates from <a href="http://www.livejournal.com/">LiveJournal</a>,
<a href="http://www.vox.com/">Vox</a>, and <a href="http://www.typepad.com/">TypePad</a> lets MT developers create themes that work on over 15
million blogs, with support for the same styles in <a href="http://www.habariproject.org/en/">Habari</a> and <a href="http://www.drupal.org/">Drupal</a>
</li><li> A fully <a href="http://www.movabletype.org/opensource/">open-source GPL version of Movable Type</a>
</li><li> Powerful solution packs -- all the features you want, with no unnecessary complexity
</li><li> A reborn <a href="http://www.movabletype.org/">MovableType.org</a>, acting as a hub for the MT community
</li><li> A completely reinvented Movable Type Plugin directory, due to be released alongside MT4 -- MT
invented blogging plugins and had the <a href="http://www.sixapart.com/pronet/plugins">first plugin directory</a>, now you
can rate, rank, sort, search, and discover plugins, and learn more
about their creators
</li><li> Support for the open source infrastructure shared with other
Six Apart platforms, including <a href="http://www.movabletype.org/documentation/mt_and_memcached.html">Memcached support right out of the box</a>
</li><li> A public subversion repository for Movable Type, featuring nightly builds of fixes and improvements to the platform
</li><li> An all-new <a href="http://wiki.movabletype.org/">community wiki</a> that is just getting off the ground for capturing conversations and documentation for future reference by the community
</li><li> A single shared code base for all versions of Movable Type,
meaning personal users can benefit immediately from platform
improvements created for Enterprise users, or for other Six Apart
platforms
</li></ol>
        </div>





    </div>
</div>]]>
        
    </content>
</entry>

<entry>
    <title>Upgrading Your MT3 Templates to Movable Type 4.0</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2007/08/mt3eaaaeymt4.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=2296" title="Upgrading Your MT3 Templates to Movable Type 4.0" />
    <id>tag:www.trucy.org,2007:/blog//2.2296</id>
    
    <published>2007-08-15T06:42:40Z</published>
    <updated>2007-08-16T11:11:54Z</updated>
    
    <summary>大家请暂时不要升级，我们会在后台稳定后，想办法统一为大家升级，或者提供其他简便的升级方法。 官方升级方法如下：Movable Type 4.0 has introduced tons of new features including a completely re-envisioned templating and archiving system to make blog publishing faster in addition to making site wide design changes easier. This document will give users an overview of...</summary>
    <author>
        <name>Admin</name>
        
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<div class="entry-body"><font style="font-size: 1em;"><b>大家请暂时不要升级，我们会在后台稳定后，想办法统一为大家升级，或者提供其他简便的升级方法。</b></font>
            <br /><p><br /></p><p>官方升级方法如下：<br /></p><p>Movable Type 4.0 has introduced
tons of new features including a completely re-envisioned templating
and archiving system to make blog publishing faster in addition to
making site wide design changes easier. </p>

<p>This document will give users an overview of some the enhancements
made to Movable Type's templates and help users update their templates
to take advantage of these features.</p>

<h2>What's New - an Overview</h2>

<p>Here is a list of just some of the new features and enhancements made to Movable Type 4.0's templates:</p>

<ul><li><strong>New archive types</strong> giving publishers a greater range of the types of archives they can create including a variety of category and author archives.</li><li><strong>Paginated archives</strong> allowing publishers to generate more page views, increase ad revenue and speed up publishing.</li><li><strong>Consolidated archive templates</strong> preventing
designers from needlessly editing multiple templates that are virtually
identical - now edits can happen in one template to affect archives
site-wide.</li><li><strong>Restructured default blog templates</strong> to easily affect the look and feel of their entire site (not just archives) by editing fewer templates.</li><li><strong>New widgets</strong> have been added to make blogs more dynamic and richer in content, such as a "Recently Uploaded Photos" widget and more.</li></ul>

<h3>New Archive Types</h3>

<p>Here is a list of the archive types available in Movable Type 4.0:</p>

<ul><li>Entry</li><li>Daily</li><li>Weekly</li><li>Monthly</li><li>Yearly <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Author <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Author-Daily <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Author-Weekly <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Author-Monthly <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Author-Yearly <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Category</li><li>Category-Daily <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Category-Weekly <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Category-Monthly <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Category-Yearly <img src="http://www.movabletype.org/images/new_icon.gif" /></li><li>Page <img src="http://www.movabletype.org/images/new_icon.gif" /></li></ul>

<h3>New Archive Templates</h3>

<p>To reduce the number of templates a designer would need to edit to affect changes to their archives, the <em>Date-Based Archive</em> and <em>Category Archive</em>
templates found in Movable Type 3.x, which had about 99% in common with
one another, have been merged into a single template named "Entry
Listing." </p>

<p>Here then are the three archive templates that new blogs are populated with in Movable Type 4.0:</p>

<ol><li><strong>Entry</strong> - default template for publishing an entry (previously <em>individual entry archive</em>)</li><li><strong>Entry Listing</strong> - default template for all archive lists of entries</li><li><strong>Page</strong> - default template for publishing a page (sister to Entry archive template)</li></ol>

<p>Archive templates are mapped to archive types to determine which
template publishes which archive type. Archive types are managed at the
bottom of each edit template screen.</p>

<h2>Upgrading Your Movable Type 3.x Templates</h2>

<p>The archive pagination that is introduced by Movable Type 4.0 has
shown to increase build times by at least 20%. So while Movable Type
4.0 may actually be publishing more (in regards to the number of
files), publishing time overall is decreased because the size of each
file being published is smaller.</p>

<p>Users who have upgraded from an earlier version of Movable Type can
take advantage of this enhancement by making a few changes to their
existing Movable Type 3.x templates.</p>

<h3>Paginate Your Category Archives</h3>

<p>The first thing to make the changes necessary to paginate your category archives.</p>

<ol><li>Navigate to the edit screen for your Date-Based Archive template.
At the bottom of the page click the "Create New Archive Mapping" button.</li><li>Select "Category Monthly" (or Daily, Weekly or Yearly)</li><li>Click the "Add" button</li></ol>

<h3>Edit Your Category Archive Template</h3>

<p>Now, let's reduce the number of entries that get displayed on your
Category Archive pages to decrease the time it takes to publish them.</p>

<ol><li>Edit your Category Archive template.</li><li>Look for the <code>&lt;MTEntries&gt;</code> tag found in that template and change it to <code>&lt;MTEntries limit="auto"&gt;</code> or <code>&lt;MTEntries limit="10"&gt;</code></li></ol>

<p>Setting <code>limit</code> to "auto" limits the output to the number
of entries or the number of days of entries specified as the Entry
Listing Default in Entry Settings. Specifing a specific number limits
the output to that number of entries. The <code>limit</code> modifier is only available in the context of an archive template.</p>

<h3>Link to Your New Archives</h3>

<p>Now that your category archives do not display the entire contents
for that category, you will need to provide links to the category
archives. The following code will produce an index of the various
months within the current category that have entries available:</p>

<pre><code>&lt;mt:ArchiveList archive_type="Category-Monthly"&gt;<br />  &lt;a href="&lt;mt:ArchiveLink /&gt;"&gt;&lt;mt:ArchiveTitle /&gt; (&lt;mt:ArchiveCount /&gt;)&lt;/a&gt;<br />&lt;/mt:ArchiveList&gt;<br /></code></pre>

<p>Place this code at bottom of your Category Archive template. An
advanced option would be to place this code in a conditioned block of
code in a sidebar template; find an example of this code in one of the
sidebar templates of the MT4 default blog templates.</p>

<h3>Create a Page Archive Template</h3>

<p>To take advantage of Movable Type's Pages feature, you will need to create a page archive template and mapping. </p>

<ol><li>Create a new archive template called "Page"</li><li>Copy the contents of the "Individual Entry Archive" template in to the new "Page" template</li><li>At the bottom of the template click the "Create New Archive Mapping" button.</li><li>Select "Page" and click "Add"</li><li dragover="true">Save the template</li><li dragover="true">Now when you create new pages, they will use this template.</li></ol>

<p>You can optionally use an <a href="http://www.movabletype.org/default_templates/3.3/page_archive.tmpl">adapted version of the Individual Archive Template</a> for your pages.</p>

<h2>For the Brave at Heart</h2>

<p>Though it may be time consuming... in order to take advantage of all
the new features, new archive types, new template tags, new widgets,
new template strucure and more... we highly recommend using the Movable
Type 4.0 default blog templates and re-implementing your site's design.</p>

<p dragover="true">Implementing your site's design using the new blog
templates will be much simpler than it was with MT3 blog templates due
to the restructured templates.</p>

        </div>]]>
        
    </content>
</entry>

<entry>
    <title>blog save出错请看这里，谢谢！</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2007/07/blog-saveoiceoa.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=2266" title="blog save出错请看这里，谢谢！" />
    <id>tag:www.trucy.org,2007:/blog//2.2266</id>
    
    <published>2007-07-31T09:55:11Z</published>
    <updated>2007-07-31T10:26:04Z</updated>
    
    <summary><![CDATA[如果您保存文件出错，则需要手动修改一下模板，因为我们取消scode这个输入码回复的功能，更方便大家留言，后台采用了别的方法来防止作弊。这次模板变动比较大，请大家不用更新模板，我们会在稳定后统一给大家更新模板，谢谢！进入方法：进入后台 -&gt; Design菜单 -&gt; 打开Templates&nbsp; -&gt; 右侧打开Archieve Templates -&gt; 打开 Individual Entry Archive查找下面的代码：1,&lt;p&gt;&lt;MTSCodeInsert&gt;&lt;/MTSCodeInsert&gt;&lt;/p&gt;&nbsp;&nbsp;&nbsp;&nbsp; 2,&lt;!-- Security Code Check --&gt;&lt;label for="scode"&gt;Security Code:&lt;/label&gt;&lt;br /&gt; &lt;input type="hidden" id="code" name="code" value="&lt;$MTSecurityCode$&gt;" /&gt;&lt;img border="0" src="&lt;$MTCGIPath$&gt;&lt;$MTSecurityImage$&gt;?code=&lt;$MTSecurityCode$&gt;"&gt;&lt;br /&gt;&lt;input tabindex=3 id="scode" name="scode" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;!-- end of Security Code...]]></summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="其他杂记" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[如果您保存文件出错，则需要手动修改一下模板，因为我们取消scode这个输入码回复的功能，更方便大家留言，后台采用了别的方法来防止作弊。这次模板变动比较大，请大家不用更新模板，我们会在稳定后统一给大家更新模板，谢谢！<br><br>进入方法：<br>进入后台 -&gt; Design菜单 -&gt; 打开Templates&nbsp; -&gt; 右侧打开Archieve Templates -&gt; 打开 Individual Entry Archive<br><br>查找下面的代码：<br><br><blockquote>1,<br>&lt;p&gt;&lt;MTSCodeInsert&gt;&lt;/MTSCodeInsert&gt;&lt;/p&gt;<br></blockquote>&nbsp;&nbsp;&nbsp;&nbsp; <blockquote>2,<br>&lt;!-- Security Code Check --&gt;<br>&lt;label for="scode"&gt;Security Code:&lt;/label&gt;&lt;br /&gt; <br>&lt;input type="hidden" id="code" name="code" <br>value="&lt;$MTSecurityCode$&gt;" /&gt;<br>&lt;img border="0" src="&lt;$MTCGIPath$&gt;&lt;$MTSecurityImage$&gt;?<br>code=&lt;$MTSecurityCode$&gt;"&gt;&lt;br /&gt;<br>&lt;input tabindex=3 id="scode" name="scode" /&gt;&lt;br /&gt;&lt;br /&gt;<br>&lt;!-- end of Security Code Check --&gt;</blockquote><br><br>您的模板可能含有以上一种代码，请您手动删除，重新编辑帖子即可发帖成功，如果您有其他问题，请到论坛或者直接和我们联系，谢谢！<br>]]>
        
    </content>
</entry>

<entry>
    <title>楚水邮局</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/12/eeoeoe_1.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1966" title="楚水邮局" />
    <id>tag:www.trucy.org,2006:/blog//2.1966</id>
    
    <published>2006-12-12T13:40:04Z</published>
    <updated>2006-12-12T13:51:24Z</updated>
    
    <summary><![CDATA[基于Gmail的信任，我认为我们可以给大家提供邮箱服务了，因为我们的服务没有特殊原因会一直为大家提供，所以可以认为是永久服务，如果有意外发生，我们也会提前和大家沟通，让大家保存所有信息。 采用了google提供的domains服务，可以为大家提供YourName@Trucy.Org的邮箱服务了。该帐户信息也可以享受google提供的其他服务内容：譬如gtalk，日历等服务，而且一般的gmail相关的插件都可以很方便的使用，pop3，smtp和gmail一样可以配置使用。 如果大家有兴趣请到论坛发帖提出需求，或给我们邮件：admin@trucy.org 譬如： &nbsp;&nbsp;&nbsp; 我想要的邮箱名：cyril@trucy.org &nbsp;&nbsp;&nbsp; 我想设置的密码是：****** *&nbsp; (自然只能信件中使用；发帖的请求，我们会设置一个默认密码，并邮件通知你)。&nbsp;邮局登录地址： http://gmail.trucy.org 或 https://www.google.com/a/trucy.org/...]]></summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>基于Gmail的信任，我认为我们可以给大家提供邮箱服务了，因为我们的服务没有特殊原因会一直为大家提供，所以可以认为是永久服务，如果有意外发生，我们也会提前和大家沟通，让大家保存所有信息。  </p><p>采用了google提供的domains服务，可以为大家提供YourName@Trucy.Org的邮箱服务了。该帐户信息也可以享受google提供的其他服务内容：譬如gtalk，日历等服务，而且一般的gmail相关的插件都可以很方便的使用，pop3，smtp和gmail一样可以配置使用。  </p><p>如果大家有兴趣请到论坛发帖提出需求，或给我们邮件：admin@trucy.org </p><p>譬如： </p><p>&nbsp;&nbsp;&nbsp; 我想要的邮箱名：cyril@trucy.org </p><p>&nbsp;&nbsp;&nbsp; 我想设置的密码是：****** *&nbsp; (自然只能<strong>信件</strong>中使用；发帖的请求，我们会设置一个默认密码，并邮件通知你)。</p><p>&nbsp;邮局登录地址： </p><p><a href="http://gmail.trucy.org">http://gmail.trucy.org</a>  </p><p>或</p><p> <a href="https://www.google.com/a/trucy.org/">https://www.google.com/a/trucy.org/</a></p>]]>
        
    </content>
</entry>

<entry>
    <title>Pro*c编程</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/08/procuaee.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1820" title="Pro*c编程" />
    <id>tag:www.trucy.org,2006:/blog//2.1820</id>
    
    <published>2006-08-22T07:17:54Z</published>
    <updated>2006-08-24T10:32:22Z</updated>
    
    <summary><![CDATA[&nbsp;&nbsp;&nbsp; PROC是ORACLE数据库提供的编程接口之一，其应用十分的广泛，本文通过一个具体的例子，介绍PROC编程的一些经验及应注意的地方。　　　　例子程序：　　#include &lt;stdio.h&gt;　　#include &lt;string.h&gt;　　#include &lt;stdlib.h&gt;　　#include &lt;sqlda.h&gt;　　#include &lt;sqlcpr.h&gt;　　　　EXEC SQL INCLUDE sqlca;　　/*RELEASE_CURSOR=YES 使PROC 在执行完后释放与嵌入SQL有关资源*/　　EXEC ORACLE OPTION (RELEASE_CURSOR = YES);　　　　EXEC SQL BEGIN DECLARE SECTION;　　varchar vc_user[20];　　long al_empno=0;　　char ac_ename[11]=&quot;&quot;;　　char ac_hiredate[20]=&quot;&quot;;　　double af_sal=0;　　　　EXEC SQL VAR ac_ename IS STRING(11);　　EXEC SQL VAR ac_hiredate IS STRING(20);　　　　EXEC SQL END DECLARE SECTION;　　　　/*错误处理函数*/　　void...]]></summary>
    <author>
        <name>Admin</name>
        
    </author>
    
        <category term="技术文档" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>&nbsp;&nbsp;&nbsp; PROC是ORACLE数据库提供的编程接口之一，其应用十分的广泛，本文通过一个具体的例子，介绍PROC编程的一些经验及应注意的地方。<br />　　<br />　　例子程序：<br />　　#include &lt;stdio.h&gt;<br />　　#include &lt;string.h&gt;<br />　　#include &lt;stdlib.h&gt;<br />　　#include &lt;sqlda.h&gt;<br />　　#include &lt;sqlcpr.h&gt;<br />　　<br />　　EXEC SQL INCLUDE sqlca;<br />　　/*RELEASE_CURSOR=YES 使PROC 在执行完后释放与嵌入SQL有关资源*/<br />　　EXEC ORACLE OPTION (RELEASE_CURSOR = YES);<br />　　<br />　　EXEC SQL BEGIN DECLARE SECTION;<br />　　varchar vc_user[20];<br />　　long al_empno=0;<br />　　char ac_ename[11]=&quot;&quot;;<br />　　char ac_hiredate[20]=&quot;&quot;;<br />　　double af_sal=0;<br />　　<br />　　EXEC SQL VAR ac_ename IS STRING(11);<br />　　EXEC SQL VAR ac_hiredate IS STRING(20);<br />　　<br />　　EXEC SQL END DECLARE SECTION;<br />　　<br />　　/*错误处理函数*/<br />　　void sql_error(char *msg)<br />　　{<br />　　printf(&quot;\n%s,%ld,%s\n&quot;, msg,sqlca.sqlcode,(char *)sqlca.sqlerrm.sqlerrmc);<br />　　EXEC SQL ROLLBACK RELEASE;<br />　　exit(-1);<br />　　}<br />　　<br />　　main()<br />　　{<br />　　EXEC SQL WHENEVER SQLERROR DO sql_error(&quot;ORACLE ERROR: &quot;);<br />　　<br />　　/*连接数据库*/<br />　　strcpy(vc_user.arr,&quot;<a href="mailto:scott/tiger@DEMO">scott/tiger@DEMO</a>&quot;);<br />　　vc_user.len=16;<br />　　exec sql connect :vc_user;<br />　　<br />　　EXEC SQL DECLARE cur_emp CURSOR FOR<br />　　SELECT EMPNO, ENAME,to_char(HIREDATE,'yyyy/mm/dd hh24:mi:ss'),SAL FROM EMP;<br />　　<br />　　EXEC SQL OPEN cur_emp;<br />　　while(1)<br />　　{<br />　　al_empno=0;<br />　　strcpy(ac_ename,&quot;&quot;);<br />　　strcpy(ac_hiredate,&quot;&quot;);<br />　　af_sal=0;<br />　　EXEC SQL FETCH cur_emp INTO :al_empno, :ac_ename:ename_ind,<br /> :ac_hiredate:hiredate_ind, :af_sal:sal_ind;<br />　　if( sqlca.sqlcode == 1403)<br />　　{<br />　　break;<br />　　}<br />　　printf(&quot;empno=%ld,ename=%s,hiredate=%s,<br />sal=%lf\n&quot;,al_empno,ac_ename,ac_hiredate,af_sal);<br />　　}<br />　　EXEC SQL CLOSE cur_emp;<br />　　EXEC SQL ROLLBACK WORK RELEASE;<br />　　}<br />　　<br /></p>]]>
        <![CDATA[　　1、宿主变量的声明<br />　　<br />　　在PROC中,在SQL语句中用到的变量称为宿主变量。他们应在EXEC SQL BEGIN DECLARE SECTION;与EXEC SQL EDN DECLARE SECTION;<br />　　<br />　　之间声明，如上面所示.在声明宿主变量时应注意以下几点：<br />　　<br />　　(1) 在数据库表中定义为VARCHAR2，VARCHAR，CHAR的字段，在PROC中可声明为CHAR，但长度应为它们在表中定义的长度加1，因为PROC中<br />　　<br />　　CHAR型变量用做结尾。<br />　　<br />　　如：ENAME在表中的定义为ename varchar2(10)，在PROC中可定义为：<br />　　EXEC SQL BEGIN DECLARE SECTION;<br />　　char ename[11];<br />　　EXEC SQL END DECLARE SECTION;<br />　　<br />　　常见错误说明:<br />　　<br />　　如果插入的字符串长度大于10，如：EXEC SQL INSERT INTO EMP(ENAME) VALUES('12345678901');会出现以下错误:<br />　　error:ORA-01480: STR 赋值变量缺少空后缀。<br />　　<br />　　如果定义为:<br />　　EXEC SQL BEGIN DECLARE SECTION;<br />　　char ename[15];<br />　　EXEC SQL END DECLARE SECTION;<br />　　<br />　　当插入的字符串长度大于10，小于15时,如：EXEC SQL INSERT INTO EMP(ENAME) VALUES('12345678901');会出现以下错误:<br />　　error:ORA-01401: 插入的值对于列过大。<br />　　<br />　　当插入的字符串长度大于15，如：EXEC SQL INSERT INTO EMP(ENAME) VALUES('12345678901234');会出现以下错误:<br />　　error:ORA-01401:STR 赋值变量缺少空后缀。<br />　　<br />　　(2) 从SQL语句中取字段的值到宿主变量中时，PROC不会自动给宿主变量去掉右空格。而是以在DECLARE SECTION 中定义的长度为准(与 表中定义的无关)不足补右空格.如果不注意这一点，在PROC中进行字符串操作时（如比较相等）会出错。如:<br />　　EXEC SQL BEGIN DECLARE SECTION;<br />　　char ename[10];<br />　　EXEC SQL END DECLARE SECTION;<br />　　如果ENAME在表中的值为'abc',则取出的值为'abc ';<br />　　<br />　　可用语句EXEC SQL VAR重定义CHAR型变量。这样宿主变量会自动去掉右空格。如下:<br />　　EXEC SQL BEGIN DECLARE SECTION;<br />　　char ename[11];<br />　　EXEC SQL VAR ac_ename IS STRING(11);<br />　　EXEC SQL END DECLARE SECTION;<br />　　如果ENAME在表中的值为'abc',则取出的值为'abc';<br />　　<br />　　(3) 对浮点型的变量，为保证精度，最好是声明成DOUBLE型的.因为DOUBLE型的精度比FLOAT型高很多.<br />　　<br />　　(4) 整型可声明为LONG型(对较长的整型,而且所用的平台支持的话,如在SUN平台上,可声明为LONG LONG型).<br />　　<br />　　(5) DATE型的处理：DATE型一般声明为CHAR(20)。<br />　　<br />　　往表中插入DATE型数据时,一般用TO_DATE()函数进行类型转换,取出值时一般用TO_CHAR()函数进行类型转换.<br />　　EXEC SQL select to_char(hiredate,'yyyy/mm/dd hh24:mi:ss') into :ac_hire_date from EMP where empno=1234;<br />　　EXEC SQL insert into EMP(EMPNO,HIREDATE) values(123,to_date(:ac_hiredate,'yyyy/mm/dd hh24:mi:ss');<br />　　<br />　　2、宿主变量的作用范围<br />　　<br />　　如果宿主变量在所有的函数之外声明，则他们是全局变量。在使用之前要注意把变量的值初始化，宿主变量也可以在某个函数的内部定义。 这时他们是局部变量。一般都习惯把宿主变量声明为全局变量。<br />　　<br />　　3、数据库的连接与断开<br />　　<br />　　数据库的连接有以下两种方法：<br />　　(1)<br />　　strcpy(vc_user.arr,&quot;scott/tiger&quot;);<br />　　vc_user.len=11;<br />　　exec sql connect :vc_user;<br />　　<br />　　(2)<br />　　strcpy(user,&quot;scott&quot;);<br />　　strcpy(pass,&quot;tiger&quot;);<br />　　exec sql connect :user identified by :pass;<br />　　<br />　　注意：在有些平台上两种都可以,在有些平台上只能用第一种方法.<br />　　<br />　　在PROC程序中，要记住用EXEC SQL ROLLBACK WORK RELEASE;断开与数据库的连接,并释放相关的数据库资源。<br />　　<br />　　4、PROC中的NULL值的处理<br />　　<br />　　如果某一字段取出的值是NULL,会报:sqlcode=-1405, sqlerr=ORA-01405: 读取的列值为 NULL<br />　　<br />　　并且相应的宿主变量的值不会被改变,为执行该SQL语句之前的值. 常用的处理NULL值的方法有：<br />　　<br />　　(1)采用指示器变量,此时不会有-1405错误,当必须是所以为NULL的字段都有相应的指示器变量,如果某一字段没有指示器变量,但取出的值<br />　　<br />　　为NULL值,则仍然会有-1405错误.当取出的值是NULL时，相应的指示器变量变量为-1，可根据指示器变量的值做响应的处理。<br />　　<br />　　(2)如果字段较多,可取字段到一个结构体中及与该结构体对应的指示器结构体中.如上面的例子中可定义结构体：<br />　　struct str_emp{<br />　　long al_empno;<br />　　char ac_ename;<br />　　char ac_hiredate;<br />　　double af_sal;<br />　　};<br />　　struct str_emp_ind{<br />　　long al_empno;<br />　　char ac_ename;<br />　　char ac_hiredate;<br />　　double af_sal;<br />　　};<br />　　<br />　　struct str_emp str_emp;<br />　　strcut str_emp_ind str_emp_ind;<br />　　<br />　　在取之前可用memset(&amp;str_emp,0,sizeof(str_emp)).清空该结构体,这样如果是字符型的NULL,会为&quot;&quot;,整型的NULL会为0,<br />　　<br />　　浮点型的会为0.00。此时不会有-1405错误。<br />　　<br />　　(3)也可采用NVL()函数:举例如下：<br />　　EXEC SQL DECLARE authors CURSOR FOR<br />　　SELECT EMPNO, NVL(ENAME,chr(0)),nvl(to_char(HIREDATE,'yyyy/mm/dd hh24:mi:ss'),chr(0)),NVL(SAL,0) FROM EMP;<br />　　<br />　　这样也不会有-1405错误不,当取出的值是NULL时,自动用NVL()中指定的值代替.<br />　　<br />　　CHR(0)也可直接用''代替,如下:<br />　　SELECT EMPNO, NVL(ENAME,''),nvl(to_char(HIREDATE,'yyyy/mm/dd hh24:mi:ss'),''),NVL(SAL,0) FROM EMP;<br />　　<br />　　5、PROC中的错误的处理<br />　　<br />　　所有的SQL语句都有可能出错.所以都要加以判断,但每个SQL语句后都加错误判断,太麻烦,可用一个函数如sql_error()来进行错误处理,<br />　　<br />　　方法:<br />　　<br />　　(1)定义ql_error()函数。<br />　　<br />　　(2)在开头加上EXEC SQL WHENEVER SQLERROR DO sql_error();这样当发生sqlca.sqlcode &lt;0 的错误时,程序自动转到sql_error()中执行. 注意:对sqlca.sqlcode &gt;0的错误如 sqlca.sqlcode =1403 是不会转到sql_error()中执行的.<br />　　<br />　　另外:在UNIX下，可以用OERR 来查找错误的描述。如： ora ORA -1405 查找错误号为-1405的描述.<br />　　<br />　　6、PROC中调用存储过程的方法<br />　　<br />　　要把存储过程放在EXEC SQL EXECUTE 和 END-EXEC;之间，如下所示：<br />　　<br />　　其中：al_empno,ac_ename 为输入参数,l_return,l_errno,c_errtext 为输出参数。<br />　　al_empno=8888;<br />　　strcpy(ac_ename,&quot;ABCD&quot;);<br />　　EXEC SQL EXECUTE<br />　　BEGIN<br />　　up_db_emp(:al_empno,:ac_ename,:l_return,:l_errno,:c_errtext);<br />　　END;<br />　　END-EXEC;<br />　　if (l_return != 0)<br />　　{<br />　　printf(&quot;调用UP_PB_EMP存储过程出错,errno=%ld,errtext=%s\n&quot;,l_errno,c_errtext);<br />　　}<br />　　<br />　　7、PROC的命令行选项：PROC编译器有很多的命令行选项，在命令行下直接不带参数运行PROC，会列出所有的命令行选项来，并有说明。<br />　　<br />　　(1)储存过程:编译储存过程是要带上用户名及密码<br />　　proc USERID=scott/tiger sqlcheck=SEMANTICS ireclen=512 iname=test.cpp<br />　　<br />　　(2)PARSE=NONE 对非SQL代码不进行语法分析，默认对非SQL代码也进行语法分析.<br />　　<br />　　在RED HAD6.3上的ORACLE8.1.5中用PROC时,会提示:/USR/INCLUDE/STDIO.H 及其他的.H文件中有错. 可把PARSE=NONE加上,就好了.<br />　　<br />　　8、注意加上：EXEC ORACLE OPTION (RELEASE_CURSOR = YES);<br />　　<br />　　RELEASE_CURSOR=YES 使PROC 在执行完后释放与嵌入SQL有关资源，保证在该PROC程序执行完后，ORACLE不会锁住数据库资源，如锁表等。<br />　　<br />　　如果在PROC中用到ORACA，还要在程序头加上：<br />　　EXEC ORACLE OPTION (ORACA=YES);<br />　　<br />　　9、PROC中的类型转换<br />　　<br />　　一、在C语言中:<br />　　<br />　　(1)字符型到整型可用ATOI() ATOL(),SSCANF()<br />　　<br />　　(2)整型,浮点型到字符型,可用SPRINTF()<br />　　<br />　　(3)字符型到浮点型用ATOF()不行,最好用SSCANF(),举例如下:<br />　　<br />　　EXEC SQL BEGIN DECLARE SECTION;<br />　　double d_demo;<br />　　float f_demo;<br />　　char ac_text[20]=&quot;222&quot;;<br />　　EXEC SQL END DECLARE SECTION;<br />　　<br />　　(1)sscanf(ac_text, &quot;%f&quot;, &amp;d_demo);<br />　　printf(&quot;ac_text=%s,d_demo=%f\n&quot;,ac_text,d_demo);<br />　　<br />　　(2)sscanf(ac_text, &quot;%lf&quot;, &amp;d_demo);<br />　　printf(&quot;ac_text=%s,d_demo=%f\n&quot;,ac_text,d_demo);<br />　　<br />　　(3)sscanf(ac_text, &quot;%f&quot;, &amp;d_demo);<br />　　printf(&quot;ac_text=%s,d_demo=%lf\n&quot;,ac_text,d_demo);<br />　　<br />　　(4)sscanf(ac_text, &quot;%lf&quot;, &amp;d_demo);<br />　　printf(&quot;ac_text=%s,d_demo=%lf\n&quot;,ac_text,d_demo);<br />　　<br />　　printf(&quot;*******************\n&quot;);<br />　　<br />　　(5)sscanf(ac_text, &quot;%f&quot;, &amp;f_demo);<br />　　printf(&quot;ac_text=%s,f_demo=%f\n&quot;,ac_text,f_demo);<br />　　<br />　　(6)sscanf(ac_text, &quot;%lf&quot;, &amp;f_demo);<br />　　printf(&quot;ac_text=%s,f_demo=%f\n&quot;,ac_text,f_demo);<br />　　<br />　　(7)sscanf(ac_text, &quot;%f&quot;, &amp;f_demo);<br />　　printf(&quot;ac_text=%s,f_demo=%lf\n&quot;,ac_text,f_demo);<br />　　<br />　　(sscanf(ac_text, &quot;%lf&quot;, &amp;f_demo);<br />　　printf(&quot;ac_text=%s,f_demo=%lf\n&quot;,ac_text,f_demo); <p>&gt;　　输出的结果:<br />　　ac_text=222.00,d_demo=0.000000<br />　　ac_text=222.00,d_demo=222.000000<br />　　ac_text=222.00,d_demo=222.000032<br />　　ac_text=222.00,d_demo=222.000000<br />　　*******************<br />　　ac_text=222.00,f_demo=222.000000<br />　　ac_text=222.00,f_demo=0.000000<br />　　ac_text=222.00,f_demo=222.000000<br />　　ac_text=222.00,f_demo=0.000000<br />　　d_demo=atof(ac_text);<br />　　printf(&quot;ac_text=%s,atof(ac_text)=%f\n&quot;,ac_text,d_demo);<br />　　<br />　　d_demo=atof(ac_text);<br />　　printf(&quot;ac_text=%s,atof(ac_text)=%lf\n&quot;,ac_text,d_demo);<br />　　<br />　　f_demo=atof(ac_text);<br />　　printf(&quot;ac_text=%s,atof(ac_text)=%f\n&quot;,ac_text,f_demo);<br />　　<br />　　f_demo=atof(ac_text);<br />　　printf(&quot;ac_text=%s,atof(ac_text)=%lf\n&quot;,ac_text,f_demo);<br />　　<br />　　输出的结果:<br />　　ac_text=222.00,atof(ac_text)=1243288.000000<br />　　ac_text=222.00,atof(ac_text)=1243288.000000<br />　　ac_text=222.00,atof(ac_text)=1243288.000000<br />　　ac_text=222.00,atof(ac_text)=1243288.000000<br />　　<br />　　从上面的结果可见:<br />　　<br />　　DOUBLE型应采用sscanf(ac_app_capcity, &quot;%lf&quot;, &amp;d_app); 打印用&quot;%lf&quot;,&quot;%f&quot; 都可以. (2),(4)正确<br />　　<br />　　FLOAT型应采用sscanf(ac_app_capcity, &quot;%f&quot;, &amp;d_app); 打印用&quot;%lf&quot;,&quot;%f&quot; 都可以. (5),(7)正确<br />　　<br />　　采用ATOF()转换的结果都是错的,所以不要用它。<br />　　<br />　　二、写表或从表中取数据时:<br />　　<br />　　(1)字符型与整型之间可不用转换,采用默认方式。<br />　　<br />　　(2)字符型与浮点型之间可不用转换,采用默认方式。<br />　　<br />　　(3)日期型与字符型之间可用TO_CHAR(),TO_DATE()。<br />　　<br />　　10、PROC中的4种动态SQL简介<br />　　<br />　　(1)动态SQL1: 不能是查询(SELECT)语句,并且没有宿主变量.<br />　　<br />　　用法:拼一串动态SQL语句,并用EXECUTE IMMEDIATE执行,如:<br />　　EXEC SQL EXECUTE IMMEDIATE &quot;CREATE TABLE dyn1 (col1 VARCHAR2(4))&quot;;<br />　　<br />　　(2)动态SQL2: 不能是查询(SELECT)语句,并且输入的宿主变量数目是知道的,<br />　　<br />　　用法:拼一串动态SQL语句,用PREPARE,EXECUTE语句执行.<br />　　strcpy(c_sql, &quot;DELETE FROM EMP WHERE EMPNO = &quot;);<br />　　EXEC SQL PREPARE sql_stmt FROM :c_sql;<br />　　EXEC SQL EXECUTE sql_stmt USING :emp_number;<br />　　<br />　　(3)动态SQL3: 用于创建动态查询, 并且要查询的字段及输入的宿主变量数目是知道的<br />　　<br />　　用法: 拼一串动态SQL语句,用PREPARE分析该语句,并要定义一个CURSOR进行取值<br />　　<br />　　如:如要查询的数据按一年12月放到12张表中。表名为user_fee_1mon, user_fee_2mon,....可采用动态SQL3来进行查询<br />　　strcpy(c_sql,&quot;select c_user_id,c_user_name,to_char(t_date,'yyyy/mm/dd hh:mi:ss'),n_fee\n&quot;);<br />　　strcat(c_sql,&quot;from USER_FEE_&quot;);<br />　　strcat(c_sql,ac_mon);<br />　　strcat(c_sql,&quot; \n where c_user_id = :v1&quot;);<br />　　<br />　　EXEC SQL PREPARE s FROM :c_sql;<br />　　<br />　　EXEC SQL DECLARE cur_user_fee CURSOR FOR s;<br />　　<br />　　EXEC SQL OPEN cur_user_fee USING :ac_user_id;<br />　　<br />　　while(1)<br />　　{<br />　　<br />　　EXEC SQL FETCH cur_user_fee into :c_user_id,:c_user_name,:c_date,:n_fee);<br />　　<br />　　if (sqlca.sqlcode &lt; 0)<br />　　{<br />　　/*FETCH CURSOR失败*/<br />　　printf(&quot;fetch cursor cur_user_fee fail,sqlcode=%ld,sqlserr=%s&quot;,sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);<br />　　}<br />　　if( sqlca.sqlcode == SQLNOTFOUND)<br />　　{<br />　　break;<br />　　}<br />　　}<br />　　EXEC SQL CLOSE cur_user_fee;<br />　　<br />　　(4)动态SQL4:要处理的字段及输入的宿主变量数目和主变量的类型事先是不知道的,如：<br />　　INSERT INTO EMP (&lt;unknown&gt; VALUES (&lt;unknown&gt;<br />　　<br />　　是最复杂的动态SQL,很少用,在此不做介绍。<br />　　<br />　　10、SQLCA：SQL是ORACLE的一个结构体，它的域用于最近的一条SQL语句执行后的一些信息，如错误号，错误描述，警告，状态等。常用的<br />　　<br />　　域介绍如下:<br />　　SQLCA.sqlcode:错误号,=0正确,=1403没取到数据<br />　　SQLCA.sqlserrm.sqlerrmc:错误描述<br />　　SQLCA.sqlerrd[3]:最近的一条SQL语句所处理的行数,如果该语句处理失败,则它的值是不定的,如果错误在一个CURSOR操作中发生,则<br />　　<br />　　它的值指已成功处理的行数.在DELETE,UPDATE中,它不包含因外键约束而删除,更新的那些行,<br />　　DELETE FROM EMP WHERE DEPT='SALE';<br />　　<br />　　在表EMP中删除20行,但如果表EMP与表ADDRESS有外键约束,导致表ADDRESS也被删除20行,则SQLCA.sqlerrd[3]=20,而不是40。 </p>]]>
    </content>
</entry>

<entry>
    <title>毕业回首</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/06/ieooee_1.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1745" title="毕业回首" />
    <id>tag:www.trucy.org,2006:/blog//2.1745</id>
    
    <published>2006-06-21T06:50:43Z</published>
    <updated>2006-06-21T06:56:02Z</updated>
    
    <summary><![CDATA[读书的日子对我来说是如此漫长!从1985年的9月到现在2006年的6月，这差不多21年来，我都在读书！古人曾经曰过：十年寒窗苦。对我来说，这可是二十年寒窗苦啊。其实，仔细想想，这多年来也不见得有多苦，倒是老爸老妈辛苦阿。遥想21年前，说实在的，其实也不记得什么了。只不过入学面试那天背诵的《卖炭翁》和《木兰辞》如今已然忘却，只记得当时却技惊四座，连校长都为之感叹：小小年纪，不简单啊！呵呵，现在想来，自己都觉得不可思议。转眼就匆匆六年过去，上了初中。那时候，读的学校不是重点中学，班级也不是重点班级，但我们班在黑道上很是有名。记得有一次，我们班一个男生被人拦路打劫，当他说出他是我们班的之后，那些个打劫的居然乖乖的双手把钱奉上，还请他大人不要记小人过。人说：近朱者赤，近墨者黑。我在这班里凭着每次考试都入前五，就变得骄傲，不可一世。风光无限的初中之后，我考入了重点高中。高中，那简直就是大海，任凭如何坚硬的石头都会被磨得圆润，光滑。在高中，我学会了把不会做的题目丢在一边，学会了虚心向别人请教问题，学会了有很多事情即使自己再努力，也有可能不成功的道理。在接连的挫折之后，我以比平时低大约50分左右的成绩考入了大学。幸亏比较好命，虽然当初考上的不是名牌大学，但在经历大学合并之后，我的大学居然变成了浙江大学，传说中的名校。虽然没有清华北大的有名，但也是不错了。本科的四年被一个政治老师归纳为四句话：大一时不知道自己不知道，大二时知道自己不知道，大三时不知道自己知道，大四时知道自己知道。如今想来果然如此。不知不觉地就读了硕士，在硕士还没毕业的时候就转了博士，呵呵，成了一般人眼中的第三类人。以前，我觉得&ldquo;博士&rdquo;是多么让人敬仰的人啊，如此高不可攀！可如今，我才发现，博士也没什么了不起的，反正一个字混，两个字混混。只不过听上去很牛就是了。这年头，听上去很牛的，又有几个是真的很牛的呢？当然，也有牛的，只不过多乎哉，不多也。读了这多年的书，别的不多，同学多。同学是我最可宝贵的财富！如果没有他们，我想我一定不会如现在这般快乐。小学，初中，高中，本科，硕士，博士，都有我的知心好友。和他们一起的岁月，让我不觉得学习的烦闷，不觉得读书的孤寂。读书的日子就要结束了，即将踏上工作岗位，我充满期待。...]]></summary>
    <author>
        <name></name>
        <uri>http://www.trucy.org/blog/shally/</uri>
    </author>
    
        <category term="其他杂记" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p class="style7" style="word-break: break-all">读书的日子对我来说是如此漫长!从1985年的9月到现在2006年的6月，这差不多21年来，我都在读书！古人曾经曰过：十年寒窗苦。对我来说，这可是二十年寒窗苦啊。其实，仔细想想，这多年来也不见得有多苦，倒是老爸老妈辛苦阿。<br /><br />遥想21年前，说实在的，其实也不记得什么了。只不过入学面试那天背诵的《卖炭翁》和《木兰辞》如今已然忘却，只记得当时却技惊四座，连校长都为之感叹：小小年纪，不简单啊！呵呵，现在想来，自己都觉得不可思议。<br /><br />转眼就匆匆六年过去，上了初中。那时候，读的学校不是重点中学，班级也不是重点班级，但我们班在黑道上很是有名。记得有一次，我们班一个男生被人拦路打劫，当他说出他是我们班的之后，那些个打劫的居然乖乖的双手把钱奉上，还请他大人不要记小人过。人说：近朱者赤，近墨者黑。我在这班里凭着每次考试都入前五，就变得骄傲，不可一世。<br /><br />风光无限的初中之后，我考入了重点高中。高中，那简直就是大海，任凭如何坚硬的石头都会被磨得圆润，光滑。在高中，我学会了把不会做的题目丢在一边，学会了虚心向别人请教问题，学会了有很多事情即使自己再努力，也有可能不成功的道理。在接连的挫折之后，我以比平时低大约50分左右的成绩考入了大学。<br /><br />幸亏比较好命，虽然当初考上的不是名牌大学，但在经历大学合并之后，我的大学居然变成了浙江大学，传说中的名校。虽然没有清华北大的有名，但也是不错了。本科的四年被一个政治老师归纳为四句话：大一时不知道自己不知道，大二时知道自己不知道，大三时不知道自己知道，大四时知道自己知道。如今想来果然如此。<br /><br />不知不觉地就读了硕士，在硕士还没毕业的时候就转了博士，呵呵，成了一般人眼中的第三类人。以前，我觉得&ldquo;博士&rdquo;是多么让人敬仰的人啊，如此高不可攀！可如今，我才发现，博士也没什么了不起的，反正一个字混，两个字混混。只不过听上去很牛就是了。这年头，听上去很牛的，又有几个是真的很牛的呢？当然，也有牛的，只不过多乎哉，不多也。<br /><br />读了这多年的书，别的不多，同学多。同学是我最可宝贵的财富！如果没有他们，我想我一定不会如现在这般快乐。小学，初中，高中，本科，硕士，博士，都有我的知心好友。和他们一起的岁月，让我不觉得学习的烦闷，不觉得读书的孤寂。<br /><br />读书的日子就要结束了，即将踏上工作岗位，我充满期待。 </p>]]>
        
    </content>
</entry>

<entry>
    <title>正则表达式系统教程(转)</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/06/oooiieeieiii.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1736" title="正则表达式系统教程(转)" />
    <id>tag:www.trucy.org,2006:/blog//2.1736</id>
    
    <published>2006-06-15T16:05:15Z</published>
    <updated>2006-06-15T16:06:11Z</updated>
    
    <summary>前言　　正则表达式是烦琐的，但是强大的，学会之后的应用会让你除了提高效率外，会给你带来绝对的成就感。只要认真去阅读这些资料，加上应用的时候进行一定的参考，掌握正则表达式不是问题。...</summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="技术文档" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<strong>前言<br /><br /></strong>　　正则表达式是烦琐的，但是强大的，学会之后的应用会让你除了提高效率外，会给你带来绝对的成就感。只要认真去阅读这些资料，加上应用的时候进行一定的参考，掌握正则表达式不是问题。]]>
        <![CDATA[<strong>索引</strong><br /><br /><strong>1. 引子<br /></strong>　　目前，正则表达式已经在很多软件中得到广泛的应用，包括*nix（Linux, Unix等），HP等操作系统，PHP，C#，Java等开发环境，以及很多的应用软件中，都可以看到正则表达式的影子。<br /><br />　　正则表达式的使用，可以通过简单的办法来实现强大的功能。为了简单有效而又不失强大，造成了正则表达式代码的难度较大，学习起来也不是很容易，所以需要付出一些努力才行，入门之后参照一定的参考，使用起来还是比较简单有效的。<br /><br />　　例子： ^.+@.+\\..+$ <br /><br />　　这样的代码曾经多次把我自己给吓退过。可能很多人也是被这样的代码给吓跑的吧。继续阅读本文将让你也可以自由应用这样的代码。<br /><br />　　注意：这里的第7部分跟前面的内容看起来似乎有些重复，目的是把前面表格里的部分重新描述了一次，目的是让这些内容更容易理解。<br /><strong>2. 正则表达式的历史<br /><br /></strong>　　正则表达式的&ldquo;祖先&rdquo;可以一直上溯至对人类神经系统如何工作的早期研究。Warren McCulloch 和 Walter Pitts 这两位神经生理学家研究出一种数学方式来描述这些神经网络。<br /><br />　 　1956 年, 一位叫 Stephen Kleene 的数学家在 McCulloch 和 Pitts 早期工作的基础上，发表了一篇标题为&ldquo;神经网事件的表示法&rdquo;的论文，引入了正则表达式的概念。正则表达式就是用来描述他称为&ldquo;正则集的代数&rdquo;的表达式，因 此采用&ldquo;正则表达式&rdquo;这个术语。<br /><br />　　随后，发现可以将这一工作应用于使用 Ken Thompson 的计算搜索算法的一些早期研究，Ken Thompson 是 Unix 的主要发明人。正则表达式的第一个实用应用程序就是 Unix 中的 qed 编辑器。<br /><br />　　如他们所说，剩下的就是众所周知的历史了。从那时起直至现在正则表达式都是基于文本的编辑器和搜索工具中的一个重要部分。<br /><strong>3. 正则表达式定义<br /><br /></strong>　　正则表达式(regular expression)描述了一种字符串匹配的模式，可以用来检查一个串是否含有某种子串、将匹配的子串做替换或者从某个串中取出符合某个条件的子串等。<br /><br />　　列目录时，　dir *.txt或ls *.txt中的*.txt就不是一个正则表达式,因为这里*与正则式的*的含义是不同的。 <br /><br />　　正则表达式是由普通字符（例如字符 a 到 z）以及特殊字符（称为元字符）组成的文字模式。正则表达式作为一个模板，将某个字符模式与所搜索的字符串进行匹配。<br /><br />　　3.1 普通字符<br /><br />　　由所有那些未显式指定为元字符的打印和非打印字符组成。这包括所有的大写和小写字母字符，所有数字，所有标点符号以及一些符号。 <br /><br />　　3.2 非打印字符<br /><br /> <table cellspacing="1" cellpadding="3" border="0" bgcolor="#eaeaea" align="center"> <tbody> <tr bgcolor="#f0f0f0"> <th align="left" style="font-size: 12px">字符 </th> <th align="left" style="font-size: 12px">含义</th></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px; width: 40px">\cx </td> <td style="font-size: 12px">匹配由x指明的控制字符。例如， \cM 匹配一个 Control-M 或回车符。x 的值必须为 A-Z 或 a-z 之一。否则，将 c 视为一个原义的 'c' 字符。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\f </td> <td style="font-size: 12px">匹配一个换页符。等价于 \x0c 和 \cL。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\n </td> <td style="font-size: 12px">匹配一个换行符。等价于 \x0a 和 \cJ。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\r </td> <td style="font-size: 12px">匹配一个回车符。等价于 \x0d 和 \cM。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\s </td> <td style="font-size: 12px">匹配任何空白字符，包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\S </td> <td style="font-size: 12px">匹配任何非空白字符。等价于 [^ \f\n\r\t\v]。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\t </td> <td style="font-size: 12px">匹配一个制表符。等价于 \x09 和 \cI。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\v </td> <td style="font-size: 12px">匹配一个垂直制表符。等价于 \x0b 和 \cK。</td></tr></tbody></table><br />　<br />　　3.3 特殊字符<br /><br />　　所谓特殊字符，就是一些有特殊含义的字符，如上面说的&quot;*.txt&quot;中的*，简单的说就是表示任何字符串的意思。如果要查找文件名中有＊的文件，则需要对＊进行转义，即在其前加一个\。ls \*.txt。正则表达式有以下特殊字符。<br /><br /> <table cellspacing="1" cellpadding="3" border="0" bgcolor="#eaeaea" align="center"> <tbody> <tr bgcolor="#f0f0f0"> <th width="60" align="left" style="font-size: 12px">特别字符</th> <th align="left" style="font-size: 12px">说明</th></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">$</td> <td style="font-size: 12px">匹配输入字符串的结尾位置。如果设置了 RegExp 对象的 Multiline 属性，则 $ 也匹配 '\n' 或 '\r'。要匹配 $ 字符本身，请使用 \$。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">( )</td> <td style="font-size: 12px">标记一个子表达式的开始和结束位置。子表达式可以获取供以后使用。要匹配这些字符，请使用 \( 和 \)。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">*</td> <td style="font-size: 12px">匹配前面的子表达式零次或多次。要匹配 * 字符，请使用 \*。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">+</td> <td style="font-size: 12px">匹配前面的子表达式一次或多次。要匹配 + 字符，请使用 \+。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">.</td> <td style="font-size: 12px">匹配除换行符 \n之外的任何单字符。要匹配 .，请使用 \。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">[ </td> <td style="font-size: 12px">标记一个中括号表达式的开始。要匹配 [，请使用 \[。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">?</td> <td style="font-size: 12px">匹配前面的子表达式零次或一次，或指明一个非贪婪限定符。要匹配 ? 字符，请使用 \?。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\</td> <td style="font-size: 12px">将下一个字符标记为或特殊字符、或原义字符、或向后引用、或八进制转义符。例如， 'n' 匹配字符 'n'。'\n' 匹配换行符。序列 '\\' 匹配 &quot;\&quot;，而 '\(' 则匹配 &quot;(&quot;。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">^</td> <td style="font-size: 12px">匹配输入字符串的开始位置，除非在方括号表达式中使用，此时它表示不接受该字符集合。要匹配 ^ 字符本身，请使用 \^。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">{</td> <td style="font-size: 12px">标记限定符表达式的开始。要匹配 {，请使用 \{。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">|</td> <td style="font-size: 12px">指明两项之间的一个选择。要匹配 |，请使用 \|。</td></tr></tbody></table><br /><br />　　构造正则表达式的方法和创建数学表达式的方法一样。也就是用多种元字符与操作符将小的表达式结合在一起来创建更大的表达式。正则表达式的组件可以是单个的字符、字符集合、字符范围、字符间的选择或者所有这些组件的任意组合。 <br />　<br /><br />　　3.4 限定符<br /><br />　　限定符用来指定正则表达式的一个给定组件必须要出现多少次才能满足匹配。有*或+或?或{n}或{n,}或{n,m}共6种。<br /><br />　　*、+和?限定符都是贪婪的，因为它们会尽可能多的匹配文字，只有在它们的后面加上一个?就可以实现非贪婪或最小匹配。<br /><br />　　正则表达式的限定符有：<br /><br /> <table cellspacing="1" cellpadding="3" border="0" bgcolor="#eaeaea" align="center"> <tbody> <tr bgcolor="#f0f0f0"> <th width="40" align="left" style="font-size: 12px">字符 </th> <th align="left" style="font-size: 12px">描述</th></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">* </td> <td style="font-size: 12px">匹配前面的子表达式零次或多次。例如，zo* 能匹配 &quot;z&quot; 以及 &quot;zoo&quot;。* 等价于{0,}。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">+ </td> <td style="font-size: 12px">匹配前面的子表达式一次或多次。例如，'zo+' 能匹配 &quot;zo&quot; 以及 &quot;zoo&quot;，但不能匹配 &quot;z&quot;。+ 等价于 {1,}。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">? </td> <td style="font-size: 12px">匹配前面的子表达式零次或一次。例如，&quot;do(es)?&quot; 可以匹配 &quot;do&quot; 或 &quot;does&quot; 中的&quot;do&quot; 。? 等价于 {0,1}。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">{n} </td> <td style="font-size: 12px">n 是一个非负整数。匹配确定的 n 次。例如，'o{2}' 不能匹配 &quot;Bob&quot; 中的 'o'，但是能匹配 &quot;food&quot; 中的两个 o。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">{n,} </td> <td style="font-size: 12px">n 是一个非负整数。至少匹配n 次。例如，'o{2,}' 不能匹配 &quot;Bob&quot; 中的 'o'，但能匹配 &quot;foooood&quot; 中的所有 o。'o{1,}' 等价于 'o+'。'o{0,}' 则等价于 'o*'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">{n,m} </td> <td style="font-size: 12px">m 和 n 均为非负整数，其中n &lt;= m。最少匹配 n 次且最多匹配 m 次。例如，&quot;o{1,3}&quot; 将匹配 &quot;fooooood&quot; 中的前三个 o。'o{0,1}' 等价于 'o?'。请注意在逗号和两个数之间不能有空格。</td></tr></tbody></table><br /><br />　　<strong>3.5 定位符</strong><br /><br />　　用来描述字符串或单词的边界，^和$分别指字符串的开始与结束，\b描述单词的前或后边界，\B表示非单词边界。<span style="color: #ff0000">不能对定位符使用限定符。 </span><br /><br />　　3.6 选择<br /><br />　　用圆括号将所有选择项括起来，相邻的选择项之间用|分隔。但用圆括号会有一个副作用，是相关的匹配会被缓存，此时可用?:放在第一个选项前来消除这种副作用。<br /><br />　　其中?:是非捕获元之一，还有两个非捕获元是?=和?!，这两个还有更多的含义，前者为正向预查，在任何开始匹配圆括号内的正则表达式模式的位置来匹配搜索字符串，后者为负向预查，在任何开始不匹配该正则表达式模式的位置来匹配搜索字符串。 <br /><br />　　3.7 后向引用<br /><br />　 　对一个正则表达式模式或部分模式两边添加圆括号将导致相关匹配存储到一个临时缓冲区中，所捕获的每个子匹配都按照在正则表达式模式中从左至右所遇到的内 容存储。存储子匹配的缓冲区编号从 1 开始，连续编号直至最大 99 个子表达式。每个缓冲区都可以使用 '\n' 访问，其中 n 为一个标识特定缓冲区的一位或两位十进制数。<br /><br />　　可以使用非捕获元字符 '?:', '?=', or '?!' 来忽略对相关匹配的保存。 <br /><strong>4. 各种操作符的运算优先级<br /><br /></strong>　　相同优先级的从左到右进行运算，不同优先级的运算先高后低。各种操作符的优先级从高到低如下：<br /><br /> <table cellspacing="1" cellpadding="3" border="0" bgcolor="#eaeaea" align="center"> <tbody> <tr bgcolor="#f0f0f0"> <th width="200" align="left" style="font-size: 12px">操作符 </th> <th align="left" style="font-size: 12px">描述</th></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\ </td> <td style="font-size: 12px">转义符</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">(), (?:), (?=), [] </td> <td style="font-size: 12px">圆括号和方括号</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">*, +, ?, {n}, {n,}, {n,m} </td> <td style="font-size: 12px">限定符</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">^, $, \anymetacharacter </td> <td style="font-size: 12px">位置和顺序</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">| </td> <td style="font-size: 12px">&ldquo;或&rdquo;操作</td></tr></tbody></table><strong>5. 全部符号解释<br /><br /></strong> <table cellspacing="1" cellpadding="3" border="0" bgcolor="#eaeaea" align="center"> <tbody> <tr bgcolor="#f0f0f0"> <th width="80" align="left" style="font-size: 12px">字符 </th> <th align="left" style="font-size: 12px">描述</th></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\ </td> <td style="font-size: 12px">将下一个字符标记为一个特殊字符、或一个原义字符、或一个 向后引用、或一个八进制转义符。例如，'n' 匹配字符 &quot;n&quot;。'\n' 匹配一个换行符。序列 '\\' 匹配 &quot;\&quot; 而 &quot;\(&quot; 则匹配 &quot;(&quot;。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">^ </td> <td style="font-size: 12px">匹配输入字符串的开始位置。如果设置了 RegExp 对象的 Multiline 属性，^ 也匹配 '\n' 或 '\r' 之后的位置。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">$ </td> <td style="font-size: 12px">匹配输入字符串的结束位置。如果设置了RegExp 对象的 Multiline 属性，$ 也匹配 '\n' 或 '\r' 之前的位置。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">* </td> <td style="font-size: 12px">匹配前面的子表达式零次或多次。例如，zo* 能匹配 &quot;z&quot; 以及 &quot;zoo&quot;。* 等价于{0,}。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">+ </td> <td style="font-size: 12px">匹配前面的子表达式一次或多次。例如，'zo+' 能匹配 &quot;zo&quot; 以及 &quot;zoo&quot;，但不能匹配 &quot;z&quot;。+ 等价于 {1,}。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">? </td> <td style="font-size: 12px">匹配前面的子表达式零次或一次。例如，&quot;do(es)?&quot; 可以匹配 &quot;do&quot; 或 &quot;does&quot; 中的&quot;do&quot; 。? 等价于 {0,1}。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">{n} </td> <td style="font-size: 12px">n 是一个非负整数。匹配确定的 n 次。例如，'o{2}' 不能匹配 &quot;Bob&quot; 中的 'o'，但是能匹配 &quot;food&quot; 中的两个 o。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">{n,} </td> <td style="font-size: 12px">n 是一个非负整数。至少匹配n 次。例如，'o{2,}' 不能匹配 &quot;Bob&quot; 中的 'o'，但能匹配 &quot;foooood&quot; 中的所有 o。'o{1,}' 等价于 'o+'。'o{0,}' 则等价于 'o*'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">{n,m} </td> <td style="font-size: 12px">m 和 n 均为非负整数，其中n &lt;= m。最少匹配 n 次且最多匹配 m 次。例如，&quot;o{1,3}&quot; 将匹配 &quot;fooooood&quot; 中的前三个 o。'o{0,1}' 等价于 'o?'。请注意在逗号和两个数之间不能有空格。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">? </td> <td style="font-size: 12px">当该字符紧跟在任何一个其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面时，匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串，而默认的贪婪模式则尽可能多的匹配所搜索的字符串。例如，对于字符串 &quot;oooo&quot;，'o+?' 将匹配单个 &quot;o&quot;，而 'o+' 将匹配所有 'o'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">. </td> <td style="font-size: 12px">匹配除 &quot;\n&quot; 之外的任何单个字符。要匹配包括 '\n' 在内的任何字符，请使用象 '[.\n]' 的模式。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">(pattern) </td> <td style="font-size: 12px">匹配 pattern 并获取这一匹配。所获取的匹配可以从产生的 Matches 集合得到，在VBScript 中使用 SubMatches 集合，在JScript 中则使用 $0&hellip;$9 属性。要匹配圆括号字符，请使用 '\(' 或 '\)'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">(?:pattern) </td> <td style="font-size: 12px">匹配 pattern 但不获取匹配结果，也就是说这是一个非获取匹配，不进行存储供以后使用。这在使用 &quot;或&quot; 字符 (|) 来组合一个模式的各个部分是很有用。例如， 'industr(?:y|ies) 就是一个比 'industry|industries' 更简略的表达式。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">(?=pattern) </td> <td style="font-size: 12px">正向预查，在任何匹配 pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配，也就是说，该匹配不需要获取供以后使用。例如，'Windows (?=95|98|NT|2000)' 能匹配 &quot;Windows 2000&quot; 中的 &quot;Windows&quot; ，但不能匹配 &quot;Windows 3.1&quot; 中的 &quot;Windows&quot;。预查不消耗字符，也就是说，在一个匹配发生后，在最后一次匹配之后立即开始下一次匹配的搜索，而不是从包含预查的字符之后开始。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">(?!pattern) </td> <td style="font-size: 12px">负向预查，在任何不匹配 pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配，也就是说，该匹配不需要获取供以后使用。例如'Windows (?!95|98|NT|2000)' 能匹配 &quot;Windows 3.1&quot; 中的 &quot;Windows&quot;，但不能匹配 &quot;Windows 2000&quot; 中的 &quot;Windows&quot;。预查不消耗字符，也就是说，在一个匹配发生后，在最后一次匹配之后立即开始下一次匹配的搜索，而不是从包含预查的字符之后开始</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">x|y </td> <td style="font-size: 12px">匹配 x 或 y。例如，'z|food' 能匹配 &quot;z&quot; 或 &quot;food&quot;。'(z|f)ood' 则匹配 &quot;zood&quot; 或 &quot;food&quot;。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">[xyz] </td> <td style="font-size: 12px">字符集合。匹配所包含的任意一个字符。例如， '[abc]' 可以匹配 &quot;plain&quot; 中的 'a'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">[^xyz] </td> <td style="font-size: 12px">负值字符集合。匹配未包含的任意字符。例如， '[^abc]' 可以匹配 &quot;plain&quot; 中的'p'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">[a-z] </td> <td style="font-size: 12px">字符范围。匹配指定范围内的任意字符。例如，'[a-z]' 可以匹配 'a' 到 'z' 范围内的任意小写字母字符。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">[^a-z] </td> <td style="font-size: 12px">负值字符范围。匹配任何不在指定范围内的任意字符。例如，'[^a-z]' 可以匹配任何不在 'a' 到 'z' 范围内的任意字符。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\b </td> <td style="font-size: 12px">匹配一个单词边界，也就是指单词和空格间的位置。例如， 'er\b' 可以匹配&quot;never&quot; 中的 'er'，但不能匹配 &quot;verb&quot; 中的 'er'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\B </td> <td style="font-size: 12px">匹配非单词边界。'er\B' 能匹配 &quot;verb&quot; 中的 'er'，但不能匹配 &quot;never&quot; 中的 'er'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\cx </td> <td style="font-size: 12px">匹配由 x 指明的控制字符。例如， \cM 匹配一个 Control-M 或回车符。x 的值必须为 A-Z 或 a-z 之一。否则，将 c 视为一个原义的 'c' 字符。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\d </td> <td style="font-size: 12px">匹配一个数字字符。等价于 [0-9]。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\D </td> <td style="font-size: 12px">匹配一个非数字字符。等价于 [^0-9]。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\f </td> <td style="font-size: 12px">匹配一个换页符。等价于 \x0c 和 \cL。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\n </td> <td style="font-size: 12px">匹配一个换行符。等价于 \x0a 和 \cJ。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\r </td> <td style="font-size: 12px">匹配一个回车符。等价于 \x0d 和 \cM。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\s </td> <td style="font-size: 12px">匹配任何空白字符，包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\S </td> <td style="font-size: 12px">匹配任何非空白字符。等价于 [^ \f\n\r\t\v]。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\t </td> <td style="font-size: 12px">匹配一个制表符。等价于 \x09 和 \cI。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\v </td> <td style="font-size: 12px">匹配一个垂直制表符。等价于 \x0b 和 \cK。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\w </td> <td style="font-size: 12px">匹配包括下划线的任何单词字符。等价于'[A-Za-z0-9_]'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\W </td> <td style="font-size: 12px">匹配任何非单词字符。等价于 '[^A-Za-z0-9_]'。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\xn </td> <td style="font-size: 12px">匹配 n，其中 n 为十六进制转义值。十六进制转义值必须为确定的两个数字长。例如，'\x41' 匹配 &quot;A&quot;。'\x041' 则等价于 '\x04' &amp; &quot;1&quot;。正则表达式中可以使用 ASCII 编码。.</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\num </td> <td style="font-size: 12px">匹配 num，其中 num 是一个正整数。对所获取的匹配的引用。例如，'(.)\1' 匹配两个连续的相同字符。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\n </td> <td style="font-size: 12px">标识一个八进制转义值或一个向后引用。如果 \n 之前至少 n 个获取的子表达式，则 n 为向后引用。否则，如果 n 为八进制数字 (0-7)，则 n 为一个八进制转义值。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\nm </td> <td style="font-size: 12px">标识一个八进制转义值或一个向后引用。如果 \nm 之前至少有 nm 个获得子表达式，则 nm 为向后引用。如果 \nm 之前至少有 n 个获取，则 n 为一个后跟文字 m 的向后引用。如果前面的条件都不满足，若 n 和 m 均为八进制数字 (0-7)，则 \nm 将匹配八进制转义值 nm。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\nml </td> <td style="font-size: 12px">如果 n 为八进制数字 (0-3)，且 m 和 l 均为八进制数字 (0-7)，则匹配八进制转义值 nml。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">\un </td> <td style="font-size: 12px">匹配 n，其中 n 是一个用四个十六进制数字表示的 Unicode 字符。例如， \u00A9 匹配版权符号 (?)。</td></tr></tbody></table><strong>6. 部分例子<br /><br /></strong> <table cellspacing="1" cellpadding="3" border="0" bgcolor="#eaeaea" align="center"> <tbody> <tr bgcolor="#f0f0f0"> <th width="250" align="left" style="font-size: 12px">正则表达式</th> <th align="left" style="font-size: 12px">说明</th></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">/\b([a-z]+) \1\b/gi</td> <td style="font-size: 12px">一个单词连续出现的位置</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">/(\w+):\/\/([^/:]+)(:\d*)?([^# ]*)/ </td> <td style="font-size: 12px">将一个URL解析为协议、域、端口及相对路径</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">/^(?:Chapter|Section) [1-9][0-9]{0,1}$/</td> <td style="font-size: 12px">定位章节的位置</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">/[-a-z]/</td> <td style="font-size: 12px">A至z共26个字母再加一个-号。</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">/ter\b/</td> <td style="font-size: 12px">可匹配chapter，而不能terminal</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">/\Bapt/</td> <td style="font-size: 12px">可匹配chapter，而不能aptitude</td></tr> <tr bgcolor="#fafafa"> <td style="font-size: 12px">/Windows(?=95 |98 |NT )/</td> <td style="font-size: 12px">可匹配Windows95或Windows98或WindowsNT,当找到一个匹配后，从Windows后面开始进行下一次的检索匹配。</td></tr></tbody></table><strong>7. 正则表达式匹配规则<br /></strong><br />　　7.1 基本模式匹配<br /><br />　　一切从最基本的开始。模式，是正规表达式最基本的元素，它们是一组描述字符串特征的字符。模式可以很简单，由普通的字符串组成，也可以非常复杂，往往用特殊的字符表示一个范围内的字符、重复出现，或表示上下文。例如：<br /><br />　　^once <br /><br />　 　这个模式包含一个特殊的字符^，表示该模式只匹配那些以once开头的字符串。例如该模式与字符串&quot;once upon a time&quot;匹配，与&quot;There once was a man from NewYork&quot;不匹配。正如如^符号表示开头一样，$符号用来匹配那些以给定模式结尾的字符串。<br /><br />　　bucket$ <br /><br />　　这个模式与&quot;Who kept all of this cash in a bucket&quot;匹配，与&quot;buckets&quot;不匹配。字符^和$同时使用时，表示精确匹配（字符串与模式一样）。例如：<br /><br />　　^bucket$ <br /><br />　　只匹配字符串&quot;bucket&quot;。如果一个模式不包括^和$，那么它与任何包含该模式的字符串匹配。例如：模式<br /><br />　　once <br /><br />　　与字符串<br /><br />　　There once was a man from NewYork<br />　　Who kept all of his cash in a bucket.<br /><br />　　是匹配的。<br /><br />　 　在该模式中的字母(o-n-c-e)是字面的字符，也就是说，他们表示该字母本身，数字也是一样的。其他一些稍微复杂的字符，如标点符号和白字符（空 格、制表符等），要用到转义序列。所有的转义序列都用反斜杠(\)打头。制表符的转义序列是：\t。所以如果我们要检测一个字符串是否以制表符开头，可以 用这个模式：<br /><br />　　^\t <br /><br />　　类似的，用\n表示&ldquo;新行&rdquo;，\r表示回车。其他的特殊符号，可以用在前面加上反斜杠，如反斜杠本身用\\表示，句号.用\.表示，以此类推。<br /><br />　　7.2 字符簇<br /><br />　　在INTERNET的程序中，正规表达式通常用来验证用户的输入。当用户提交一个FORM以后，要判断输入的电话号码、地址、EMAIL地址、信用卡号码等是否有效，用普通的基于字面的字符是不够的。<br /><br />　　所以要用一种更自由的描述我们要的模式的办法，它就是字符簇。要建立一个表示所有元音字符的字符簇，就把所有的元音字符放在一个方括号里：<br /><br />　　[AaEeIiOoUu] <br /><br />　　这个模式与任何元音字符匹配，但只能表示一个字符。用连字号可以表示一个字符的范围，如：<br /><br />　　[a-z] //匹配所有的小写字母 <br />　　[A-Z] //匹配所有的大写字母 <br />　　[a-zA-Z] //匹配所有的字母 <br />　　[0-9] //匹配所有的数字 <br />　　[0-9\.\-] //匹配所有的数字，句号和减号 <br />　　[ \f\r\t\n] //匹配所有的白字符 <br /><br />　　同样的，这些也只表示一个字符，这是一个非常重要的。如果要匹配一个由一个小写字母和一位数字组成的字符串，比如&quot;z2&quot;、&quot;t6&quot;或&quot;g7&quot;，但不是&quot;ab2&quot;、&quot;r2d3&quot; 或&quot;b52&quot;的话，用这个模式：<br /><br />　　^[a-z][0-9]$ <br /><br />　　尽管[a-z]代表26个字母的范围，但在这里它只能与第一个字符是小写字母的字符串匹配。<br /><br />　　前面曾经提到^表示字符串的开头，但它还有另外一个含义。当在一组方括号里使用^是，它表示&ldquo;非&rdquo;或&ldquo;排除&rdquo;的意思，常常用来剔除某个字符。还用前面的例子，我们要求第一个字符不能是数字：<br /><br />　　^[^0-9][0-9]$ <br /><br />　　这个模式与&quot;&amp;5&quot;、&quot;g7&quot;及&quot;-2&quot;是匹配的，但与&quot;12&quot;、&quot;66&quot;是不匹配的。下面是几个排除特定字符的例子：<br /><br />　　[^a-z] //除了小写字母以外的所有字符 <br />　　[^\\\/\^] //除了(\)(/)(^)之外的所有字符 <br />　　[^\&quot;\'] //除了双引号(&quot;)和单引号(')之外的所有字符 <br /><br />　　特殊字符&quot;.&quot; (点，句号)在正规表达式中用来表示除了&ldquo;新行&rdquo;之外的所有字符。所以模式&quot;^.5$&quot;与任何两个字符的、以数字5结尾和以其他非&ldquo;新行&rdquo;字符开头的字符串匹配。模式&quot;.&quot;可以匹配任何字符串，除了空串和只包括一个&ldquo;新行&rdquo;的字符串。<br /><br />　　PHP的正规表达式有一些内置的通用字符簇，列表如下：<br /><br />　　字符簇含义 <br /><br />　　[[:alpha:]] 任何字母 <br />　　[[:digit:]] 任何数字 <br />　　[[:alnum:]] 任何字母和数字 <br />　　[[:space:]] 任何白字符 <br />　　[[:upper:]] 任何大写字母 <br />　　[[:lower:]] 任何小写字母 <br />　　[[:punct:]] 任何标点符号 <br />　　[[:xdigit:]] 任何16进制的数字，相当于[0-9a-fA-F] <br /><br />　　7.3 确定重复出现<br /><br />　　到现在为止，你已经知道如何去匹配一个字母或数字，但更多的情况下，可能要匹配一个单词或一组数字。一个单词有若干个字母组成，一组数字有若干个单数组成。跟在字符或字符簇后面的花括号({})用来确定前面的内容的重复出现的次数。 <br /><br />　　字符簇 含义 <br />　　^[a-zA-Z_]$ 所有的字母和下划线 <br />　　^[[:alpha:]]{3}$ 所有的3个字母的单词 <br />　　^a$ 字母a <br />　　^a{4}$ aaaa <br />　　^a{2,4}$ aa,aaa或aaaa <br />　　^a{1,3}$ a,aa或aaa <br />　　^a{2,}$ 包含多于两个a的字符串 <br />　　^a{2,} 如：aardvark和aaab，但apple不行 <br />　　a{2,} 如：baad和aaa，但Nantucket不行 <br />　　\t{2} 两个制表符 <br />　　.{2} 所有的两个字符 <br /><br />　 　这些例子描述了花括号的三种不同的用法。一个数字，{x}的意思是&ldquo;前面的字符或字符簇只出现x次&rdquo;；一个数字加逗号，{x,}的意思是&ldquo;前面的内容出 现x或更多的次数&rdquo;；两个用逗号分隔的数字，{x,y}表示&ldquo;前面的内容至少出现x次，但不超过y次&rdquo;。我们可以把模式扩展到更多的单词或数字：<br /><br />　　^[a-zA-Z0-9_]{1,}$ //所有包含一个以上的字母、数字或下划线的字符串 <br />　　^[0-9]{1,}$ //所有的正数 <br />　　^\-{0,1}[0-9]{1,}$ //所有的整数 <br />　　^\-{0,1}[0-9]{0,}\.{0,1}[0-9]{0,}$ //所有的小数 <br /><br />　 　最后一个例子不太好理解，是吗？这么看吧：与所有以一个可选的负号(\-{0,1})开头(^)、跟着0个或更多的数字([0-9]{0,})、和一个 可选的小数点(\.{0,1})再跟上0个或多个数字([0-9]{0,})，并且没有其他任何东西($)。下面你将知道能够使用的更为简单的方法。<br /><br />　　特殊字符&quot;?&quot;与{0,1}是相等的，它们都代表着：&ldquo;0个或1个前面的内容&rdquo;或&ldquo;前面的内容是可选的&rdquo;。所以刚才的例子可以简化为：<br /><br />　　^\-?[0-9]{0,}\.?[0-9]{0,}$ <br /><br />　　特殊字符&quot;*&quot;与{0,}是相等的，它们都代表着&ldquo;0个或多个前面的内容&rdquo;。最后，字符&quot;+&quot;与 {1,}是相等的，表示&ldquo;1个或多个前面的内容&rdquo;，所以上面的4个例子可以写成：<br /><br />　　^[a-zA-Z0-9_]+$ //所有包含一个以上的字母、数字或下划线的字符串 <br />　　^[0-9]+$ //所有的正数 <br />　　^\-?[0-9]+$ //所有的整数 <br />　　^\-?[0-9]*\.?[0-9]*$ //所有的小数 <br /><br />　　当然这并不能从技术上降低正规表达式的复杂性，但可以使它们更容易阅读。]]>
    </content>
</entry>

<entry>
    <title>关于mt升级后，无法生成javascript的问题</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/05/oeoumteoieuejav.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1671" title="关于mt升级后，无法生成javascript的问题" />
    <id>tag:www.trucy.org,2006:/blog//2.1671</id>
    
    <published>2006-05-11T16:37:43Z</published>
    <updated>2006-05-11T16:41:37Z</updated>
    
    <summary>Javascript Errors on Individual Entry Archives Question I upgraded to 3.2 and updated my Individual Entry Archive template to use the latest default; but I&apos;m getting Javascript errors when viewing those pages and/or there is no comment posting form or...</summary>
    <author>
        <name>Admin</name>
        
    </author>
    
        <category term="技术文档" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p><a href="http://www.sixapart.com/movabletype/kb/entries/javascript_erro.html">Javascript Errors on Individual Entry Archives</a><br />
<strong>Question</strong></p>

<p>I upgraded to 3.2 and updated my Individual Entry Archive template to use the latest default; but I'm getting Javascript errors when viewing those pages and/or there is no comment posting form or sign-in link for TypeKey commenters.<br />
<strong>Answer</strong></p>

<p>If you're seeing Javascript errors which say individualArchivesOnLoad is not defined and/or writeTypeKeyGreeting is not defined, then this means Movable Type cannot find the mt-site.js file. This is a new file introduced in version 3.2 which contains all of the Javascript used for commenting, and is generated from the Site Javascript Index Template.</p>

<p>See Creating The Site Javascript Template so you can generate this file for your weblog and eliminate the Javascript errors.</p>

<p><a href="http://www.sixapart.com/movabletype/kb/upgrading/creating_the_si.html">Creating the Site Javascript Template</a><br />
<strong>Question</strong></p>

<p>How do I create the new "Site Javascript" template after upgrading to version 3.2?<br />
<strong>Answer</strong></p>

<p>There are two basic ways to create this template.</p>

<p>You can go to System Overview > Weblogs, choose your weblog, and then select Refresh Template(s). This this will revert all relevant templates in the weblog to the defaults, and also create a Site JavaScript template in that weblog for you.</p>

<p>OR</p>

<p>You can take the following steps to create only this template with the correct default code:</p>

<p>1. In your weblog, on the Templates > Indexes tab, select Create New Index Template.<br />
2. Specify Site JavaScript1 as the Template Name, and mt-site.js as the Output File.<br />
3. Make sure that "Rebuild this template automatically when rebuilding index templates" is checked, and then click SAVE.<br />
4. Click Templates in either the left sidebar or the breadcrumbs menu to return to the Templates listing.<br />
5. Select the new Site JavaScript template you just created.<br />
6. Select Refresh Template(s) from the More Actions dropdown menu, and click GO.</p>

<p>This will create a new Site JavaScript template with the default code, as well as a "backup" template which can just be deleted (since it will be empty).</p>

<p>After creating this new template, you'll need to rebuild it to generate the mt-site.js file in your blog path. </p>]]>
        
    </content>
</entry>

<entry>
    <title>免费计数器和公益广告代码</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/04/aaneioauaee.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1045" title="免费计数器和公益广告代码" />
    <id>tag:www.trucy.org,2005:/blog//2.1045</id>
    
    <published>2006-04-14T15:49:36Z</published>
    <updated>2006-04-15T08:29:50Z</updated>
    
    <summary><![CDATA[推荐需要计数器的朋友到： http://www.statcounter.com 申请该站提供的免费计数器。 另外本站的免费公益广告也欢迎大家放置，虽然本站为非盈利的个人站点，但不反对大家在自己的blog上放置google ads这样的广告。大家可以按自己的喜好和兴趣设定。 本站的免费公益代码如下：(前一段时间该代码曾经失效，目前已经恢复正常了) &lt;script language='JavaScript' type='text/javascript' src='http://www.trucy.org/link/adx.js'&gt;&lt;/script&gt; &lt;script language='JavaScript' type='text/javascript'&gt; &lt;!-- if (!document.phpAds_used) document.phpAds_used = ','; phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11); document.write ("&lt;" + "script language='JavaScript' type='text/javascript' src='"); document.write ("http://www.trucy.org/link/adjs.php?n=" + phpAds_random); document.write ("&amp;exclude="...]]></summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>推荐需要计数器的朋友到：<br />
<a href="http://www.statcounter.com">http://www.statcounter.com</a><br />
申请该站提供的免费计数器。</p>

<p>另外本站的免费公益广告也欢迎大家放置，虽然本站为非盈利的个人站点，但不反对大家在自己的blog上放置google ads这样的广告。大家可以按自己的喜好和兴趣设定。</p>

<p>本站的免费公益代码如下：(前一段时间该代码曾经失效，目前已经恢复正常了)</p>

<blockquote>
&lt;script language='JavaScript' type='text/javascript' src='http://www.trucy.org/link/adx.js'&gt;&lt;/script&gt;<br>
&lt;script language='JavaScript' type='text/javascript'&gt;<br>
&lt;!--<br>
   if (!document.phpAds_used) document.phpAds_used = ',';<br>
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);<br>
   
   document.write ("&lt;" + "script language='JavaScript' type='text/javascript' src='");<br>
   document.write ("http://www.trucy.org/link/adjs.php?n=" + phpAds_random);<br>
   document.write ("&amp;exclude=" + document.phpAds_used);<br>
   if (document.referrer)<br>
      document.write ("&amp;referer=" + escape(document.referrer));<br>
   document.write ("'&gt;&lt;" + "/script&gt;");<br>
//--&gt;<br>
&lt;/script&gt;&lt;noscript&gt;&lt;a href='http://www.trucy.org/link/adclick.php?n=afe93307' target='_blank'&gt;&lt;img src='http://www.trucy.org/link/adview.php?n=afe93307' border='0' alt=''&gt;&lt;/a&gt;&lt;/noscript&gt;<br>
</blockquote>]]>
        <![CDATA[<p>效果如下：<br />
<a href='http://www.trucy.org/link/adclick.php?n=afe93307' target='_blank'><img src='http://www.trucy.org/link/adview.php?n=afe93307' border='0' width='468' height='60'></a></p>]]>
    </content>
</entry>

<entry>
    <title>后台本次更新说明</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/04/oiiueaeea.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1573" title="后台本次更新说明" />
    <id>tag:www.trucy.org,2006:/blog//2.1573</id>
    
    <published>2006-04-06T10:36:44Z</published>
    <updated>2006-04-06T07:40:30Z</updated>
    
    <summary>主要更新了mt后台到3.2版: 添加google 网站分析代码到各个主要模板。 添加scode到相应模板。 增加wysiwyg编辑器插件。 采用插件支持楚水首页自动更新，取消了修改源码的做法，便于调整。 我们会在以后多为大家尽力提供更多的模板。...</summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>主要更新了mt后台到3.2版:</p>

<p>添加google 网站分析代码到各个主要模板。</p>

<p>添加scode到相应模板。</p>

<p>增加wysiwyg编辑器插件。</p>

<p>采用插件支持楚水首页自动更新，取消了修改源码的做法，便于调整。</p>

<p>我们会在以后多为大家尽力提供更多的模板。</p>]]>
        
    </content>
</entry>

<entry>
    <title>更新模板说明</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/04/ceeueascodeuaee.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1533" title="更新模板说明" />
    <id>tag:www.trucy.org,2006:/blog//2.1533</id>
    
    <published>2006-04-06T08:30:18Z</published>
    <updated>2006-04-06T07:35:59Z</updated>
    
    <summary>模板操作下方会有：“Select a Design using StyleCatcher”字样。打开即可查看和选择式样。 使用该插件的blog示范： http://www.trucy.org/blog/ 使用方法：先打开Templates，把各类模板通过more actions进行refresh操作，更新到mt3.2的默认模板，这样就可以通过上方的插件选择您的显示风格了。原来的模板会得到自动备份。 然后进入模板，下方会有：“Select a Design using StyleCatcher”字样。打开可以选择您所喜欢的模板。 然后进入您的后台，Settings--&gt;&gt;Plugins--&gt;&gt;Scode的Show Settings 打开scode功能即可。 如果没有scode，你的读者留言将直接进入垃圾留言中，您可以查看修正。（更新为直接过滤掉，为了减少服务器的数据库访问压力） 然后重建所有网页，即可更新。...</summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="其他杂记" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>模板操作下方会有：“Select a Design using StyleCatcher”字样。打开即可查看和选择式样。</p>

<p>使用该插件的blog示范：</p>

<p><a href="http://www.trucy.org/blog/">http://www.trucy.org/blog/</a></p>

<p>使用方法：先打开Templates，把各类模板通过more actions进行refresh操作，更新到mt3.2的默认模板，这样就可以通过上方的插件选择您的显示风格了。原来的模板会得到自动备份。</p>

<p>然后进入模板，下方会有：“Select a Design using StyleCatcher”字样。打开可以选择您所喜欢的模板。</p>

<p>然后进入您的后台，Settings-->>Plugins-->>Scode的Show Settings 打开scode功能即可。</p>

<p>如果没有scode，你的读者留言将直接进入垃圾留言中，您可以查看修正。（更新为直接过滤掉，为了减少服务器的数据库访问压力）</p>

<p>然后重建所有网页，即可更新。</p>]]>
        
    </content>
</entry>

<entry>
    <title>mt升级到3.2的一个问题</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/03/mte32aeooeieia.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1532" title="mt升级到3.2的一个问题" />
    <id>tag:www.trucy.org,2006:/blog//2.1532</id>
    
    <published>2006-03-24T21:14:56Z</published>
    <updated>2006-03-25T04:51:06Z</updated>
    
    <summary>mt3.2直接上传准备更新，但是主程序无法运行，提示如下： The specified CGI application misbehaved by not returning a complete set of HTTP headers. 但是mt-check.cgi执行无误。 iis的问题，直接修改各个程序，把lib调用写成绝对路径即可。...</summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>mt3.2直接上传准备更新，但是主程序无法运行，提示如下：<br />
<blockquote>The specified CGI application misbehaved by not returning a complete set of HTTP headers.</blockquote><br />
但是mt-check.cgi执行无误。</p>

<p>iis的问题，直接修改各个程序，把lib调用写成绝对路径即可。</p>]]>
        
    </content>
</entry>

<entry>
    <title>如何在发贴的时候自动更新索引页面</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2006/02/ecuouiuaeeoouea.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1490" title="如何在发贴的时候自动更新索引页面" />
    <id>tag:www.trucy.org,2006:/blog//2.1490</id>
    
    <published>2006-02-19T23:19:58Z</published>
    <updated>2006-03-25T04:51:05Z</updated>
    
    <summary><![CDATA[应胖子的要求，每个用户发布blog的时候，楚水网站的相应索引页面需要自动进行相应的更新。 $app-&gt;rebuild_indexes( BlogID =&gt; $special_blog_id ) or return; 在mt适当的流程中添加这样一句即可，暂时放在了CMS.pm中，省去了mt-rebuild类似的插件。...]]></summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>应胖子的要求，每个用户发布blog的时候，楚水网站的相应索引页面需要自动进行相应的更新。</p>

<blockquote>$app-&gt;rebuild_indexes( BlogID =&gt; $special_blog_id ) or return;</blockquote>

<p>在mt适当的流程中添加这样一句即可，暂时放在了CMS.pm中，省去了mt-rebuild类似的插件。</p>]]>
        
    </content>
</entry>

<entry>
    <title>Http://www.google.com/analytics/</title>
    <link rel="alternate" type="text/html" href="http://www.trucy.org/blog/archives/2005/12/httpwwwgoogleco.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://www.trucy.org/cgi-bin/blog/mt-atom.cgi/weblog/blog_id=2/entry_id=1298" title="Http://www.google.com/analytics/" />
    <id>tag:www.trucy.org,2005:/blog//2.1298</id>
    
    <published>2005-12-01T02:12:41Z</published>
    <updated>2006-03-25T04:50:56Z</updated>
    
    <summary><![CDATA[为楚水做了访问记录，大家如果有需要，请拷贝下面代码： &lt;script src="http://www.trucy.org/urchin.js" type="text/javascript"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; _uacct = "UA-103566-1"; urchinTracker(); &lt;/script&gt; 将代码输入到所有你要监测的网页中，位于 &lt;head&gt; 和 &lt;/head&gt; 标记之间，以及该段的所有 &lt;meta&gt; 标记之后。blog一般直接使用模板修改则可。 楚水相关网页都已经加上了该代码，包括论坛提供的blog服务，另外独立的blog用户请自行按上述方式操作。 大家可以查看谁来访问了自己的网页，从哪儿来的等统计信息和详细信息，具体功能由google提供，大家需要，请按上面的操作，然后查看结果请和胖子联络 ：）...]]></summary>
    <author>
        <name>Cyril</name>
        <uri>http://www.trucy.org/blog</uri>
    </author>
    
        <category term="楚水历史" />
    
    <content type="html" xml:lang="en" xml:base="http://www.trucy.org/blog/">
        <![CDATA[<p>为楚水做了访问记录，大家如果有需要，请拷贝下面代码：</p>

<blockquote>
&lt;script src="http://www.trucy.org/urchin.js" type="text/javascript"&gt;<br>
&lt;/script&gt;<br>
&lt;script type="text/javascript"&gt;<br>
_uacct = "UA-103566-1";<br>
urchinTracker();<br>
&lt;/script&gt;
</blockquote>

<p><br />
将代码输入到所有你要监测的网页中，位于 &lt;head&gt; 和 &lt;/head&gt; 标记之间，以及该段的所有 &lt;meta&gt; 标记之后。blog一般直接使用模板修改则可。</p>

<p>楚水相关网页都已经加上了该代码，包括论坛提供的blog服务，另外独立的blog用户请自行按上述方式操作。</p>

<p><br />
大家可以查看谁来访问了自己的网页，从哪儿来的等统计信息和详细信息，具体功能由google提供，大家需要，请按上面的操作，然后查看结果请和<a href="mailto:sunshaoxuan@gmail.com">胖子</a>联络 ：）</p>]]>
        
    </content>
</entry>

</feed> 

