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

<channel>
	<title>马说</title>
	<atom:link href="http://blog.titilima.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.titilima.com</link>
	<description>不过如此</description>
	<lastBuildDate>Sat, 18 Feb 2012 10:32:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>诡计，诡计</title>
		<link>http://blog.titilima.com/tricks.html</link>
		<comments>http://blog.titilima.com/tricks.html#comments</comments>
		<pubDate>Mon, 09 Jan 2012 02:41:57 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[随感录]]></category>
		<category><![CDATA[读书]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1382</guid>
		<description><![CDATA[读罢，心里感觉莫名。这似乎并不是一个故事，而是东野圭吾准备好的一个诡计谜题。许是由于他太执着于本格推理，因此这本书的故事性并不算强——当然，也许是因为这是东野的早期作品的缘故。和这本书一同购买的是《嫌疑人X的献身》，放在一起，高下立现。 相关日志2011 年 11 月 01 日 -- 一句话(26) (0)2010 年 06 月 19 日 -- 《Lua 程序设计》的一处笔误 (2)2008 年 08 月 25 日 -- 辛亥与头衔 (1)2008 年 06 月 16 日 -- 近两年购买的技术书籍 (7)2007 年 01 月 18 日 -- 《明史》 (7)]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.titilima.com/wp-content/uploads/2012/01/s4066862.jpg"><img class="alignleft size-thumbnail wp-image-1383" title="放学后" src="http://blog.titilima.com/wp-content/uploads/2012/01/s4066862-105x150.jpg" alt="" width="105" height="150" /></a>读罢，心里感觉莫名。这似乎并不是一个故事，而是东野圭吾准备好的一个诡计谜题。许是由于他太执着于本格推理，因此这本书的故事性并不算强——当然，也许是因为这是东野的早期作品的缘故。和这本书一同购买的是《嫌疑人X的献身》，放在一起，高下立现。</p>
<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2011 年 11 月 01 日 -- <a href="http://blog.titilima.com/t-26.html" title="一句话(26)">一句话(26)</a> (0)</li><li>2010 年 06 月 19 日 -- <a href="http://blog.titilima.com/show-588-1.html" title="《Lua 程序设计》的一处笔误">《Lua 程序设计》的一处笔误</a> (2)</li><li>2008 年 08 月 25 日 -- <a href="http://blog.titilima.com/show-262-1.html" title="辛亥与头衔">辛亥与头衔</a> (1)</li><li>2008 年 06 月 16 日 -- <a href="http://blog.titilima.com/show-245-1.html" title="近两年购买的技术书籍">近两年购买的技术书籍</a> (7)</li><li>2007 年 01 月 18 日 -- <a href="http://blog.titilima.com/show-169-1.html" title="《明史》">《明史》</a> (7)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/tricks.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2011 &#8211; 2012，一年又一年</title>
		<link>http://blog.titilima.com/2011-2012.html</link>
		<comments>http://blog.titilima.com/2011-2012.html#comments</comments>
		<pubDate>Sat, 31 Dec 2011 01:47:44 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[随感录]]></category>
		<category><![CDATA[一年又一年]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1371</guid>
		<description><![CDATA[又是一年总结时。照例，先总结下自己先前做的计划，以及完成程度。 挑选 iOS 和 Android 之中的一个平台进行学习，并有所成果。 年中的时候尝试学习 Android，但发现自己并不喜欢 Eclipse 以及 Java，于是无限期搁置了这个平台的学习计划。 年底购买了一台 iMac，学完了《Objective-C基础教程》，写出了 MacOS 与 iPhone 上的 Hello World。 学习数据结构和编译原理，并有所成果。 在自己的某个 framework 上实现了基本的数组、链表、哈希表等数据结构，并实现了一个简易的脚本解释器。仔细跟踪了 Lua 5.1.4 的语法分析器与虚拟机部分的代码。 那么接下来是对 2012 的计划。 开发出漫画控的 2.0 版本，尝试海外的付费模式。 开发出漫画控的 iPad 版本，尝试 App Store 的付费模式。 相关日志2011 年 01 月 05 日 -- 写于 2011 年初 (0)2009 年 12 月 31 日 -- &#8230; <a class="read-excerpt" href="http://blog.titilima.com/2011-2012.html">Continue reading <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>又是一年总结时。照例，先总结下<a title="写于 2011 年初" href="/begin-of-2011.html" target="_blank">自己先前做的计划</a>，以及完成程度。</p>
<blockquote><p>挑选 iOS 和 Android 之中的一个平台进行学习，并有所成果。</p></blockquote>
<p>年中的时候尝试学习 Android，但发现自己并不喜欢 Eclipse 以及 Java，于是无限期搁置了这个平台的学习计划。<br />
年底购买了一台 iMac，学完了<a href="http://book.360buy.com/10063606.html" target="_blank">《Objective-C基础教程》</a>，写出了 MacOS 与 iPhone 上的 Hello World。</p>
<blockquote><p>学习数据结构和编译原理，并有所成果。</p></blockquote>
<p>在自己的某个 framework 上实现了基本的数组、链表、哈希表等数据结构，并实现了一个简易的脚本解释器。仔细跟踪了 <a href="http://www.lua.org/" target="_blank">Lua</a> 5.1.4 的语法分析器与虚拟机部分的代码。</p>
<p>那么接下来是对 2012 的计划。</p>
<ul>
<li>开发出漫画控的 2.0 版本，尝试海外的付费模式。</li>
<li>开发出漫画控的 iPad 版本，尝试 App Store 的付费模式。</li>
</ul>
<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2011 年 01 月 05 日 -- <a href="http://blog.titilima.com/begin-of-2011.html" title="写于 2011 年初">写于 2011 年初</a> (0)</li><li>2009 年 12 月 31 日 -- <a href="http://blog.titilima.com/end-of-2009.html" title="写于 2009 年年底">写于 2009 年年底</a> (9)</li><li>2008 年 02 月 07 日 -- <a href="http://blog.titilima.com/show-225-1.html" title="新旧交替">新旧交替</a> (8)</li><li>2006 年 12 月 31 日 -- <a href="http://blog.titilima.com/show-168-1.html" title="2007">2007</a> (16)</li><li>2005 年 12 月 31 日 -- <a href="http://blog.titilima.com/show-84-1.html" title="年底">年底</a> (13)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/2011-2012.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>软件盈利那些事儿</title>
		<link>http://blog.titilima.com/my-soft-selling.html</link>
		<comments>http://blog.titilima.com/my-soft-selling.html#comments</comments>
		<pubDate>Mon, 12 Dec 2011 14:57:34 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[技术的角落]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1351</guid>
		<description><![CDATA[屈指算来，我编写漫画控这个软件已经有两年的时间了。在此，将这两年来所尝试的经验和想法写出来，以供诸君品评。 在中国，纯靠写软件来盈利实在是一件很难的事情。盗版和破解扼杀了零售的可能，木马或病毒又不是问心无愧的收入；思来想去，唯一成型可靠的渠道就是流量的变现。于是，Google Adsense 和百度联盟便成了我最初尝试的盈利模式。技术上的实现是在界面的显著位置嵌入一个 Trident 视图，在程序启动时访问一个指定的页面，这个页面上嵌入了 Google 或百度广告。但是，这个模式存在以下几个问题： Google Adsense 的审查是很严的，在我嵌入广告页面后没几天就受到了帐号被禁的待遇。 最重要的是，虽然嵌入了广告页，但是没有几个用户会主动点击广告的。 于是，我作弊了。我采用的方法极为隐秘：当用户在分析和谐漫画的时候，软件会提示用户点击广告才能继续下载。这个方法立竿见影，我的收入快速增长，从最初的每月几元提升到了每月 100 元，甚至最后提高到了 1000+ 的水平。当然，百度似乎发觉了我收入的不正常增长，便禁用了我的帐号。 那么，我再为广告联盟的模式补充一条问题（甚至可以说是隐患）： 最终解释权归联盟方所有，他们可以随时封禁你的帐号——即使你并没有作弊。虽然我的被封禁并不光彩，但你大可不惮以最坏的恶意来推测强势的一方。 塞翁失马焉知非福，百度联盟帐号的被封禁从客观上逼着我不得不寻找新的盈利模式。于是，我开始尝试一个很常见的方式——捐助。虽然我并不看好这个模式，不过仍然做出了这个捐助的页面。现在回忆起来，这个捐助列表从 0 到 1 的过程是最漫长的一段时期。但自从有了第一个之后，第二个、第三个甚至更多人就慢慢都来了。这个场景让我想起了路边叫卖的小贩：空摊子很难吸引顾客，但如果雇一群托儿来围成个大圈子，那么很快看热闹的人就会围得密不透风。现在看看，如果当时我虚构几个名字在捐助页面上面，也许很容易就可以吸引其他的捐助者。——当然，前提是这个软件自身要让人喜欢，毕竟没人愿意在一坨垃圾上花钱为之鼓励。 不过，与先前每月 1000+ 的收入相比，捐助的收入实在微不足道，而且很不稳定。于是，我开始构想新的盈利模式： 开发支持多语言的国际版本，并尝试注册机制。如果你是个关注 ehentai 之类站点的宅男，那么你就可能需要支付一笔小小的费用来满足自己的欲望。 开发 iPad 设备上的同名软件，用于阅览漫画。App Store 的零售模式较之扑通的软件零售更为靠谱，国人也更愿意为之付费。 这两个设想就作为 2012 年的计划之一吧。请期待漫画控的 2.0 版本。 最热日志2004 年 03 月 22 日 -- 劳动总结 (105)2007 年 07 月 05 日 -- &#8230; <a class="read-excerpt" href="http://blog.titilima.com/my-soft-selling.html">Continue reading <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>屈指算来，我编写<a title="漫画控" href="http://blog.titilima.com/mangacon.html" target="_blank">漫画控</a>这个软件已经有两年的时间了。在此，将这两年来所尝试的经验和想法写出来，以供诸君品评。<br />
在中国，纯靠写软件来盈利实在是一件很难的事情。盗版和破解扼杀了零售的可能，木马或病毒又不是问心无愧的收入；思来想去，唯一成型可靠的渠道就是流量的变现。于是，<a href="http://www.google.com/adsense/" target="_blank">Google Adsense</a> 和<a href="http://union.baidu.com/" target="_blank">百度联盟</a>便成了我最初尝试的盈利模式。技术上的实现是在界面的显著位置嵌入一个 Trident 视图，在程序启动时访问一个指定的页面，这个页面上嵌入了 Google 或百度广告。但是，这个模式存在以下几个问题：</p>
<ul>
<li>Google Adsense 的审查是很严的，在我嵌入广告页面后没几天就受到了帐号被禁的待遇。</li>
<li>最重要的是，虽然嵌入了广告页，但是没有几个用户会主动点击广告的。</li>
</ul>
<p>于是，我作弊了。我采用的方法极为隐秘：当用户在分析和谐漫画的时候，软件会提示用户点击广告才能继续下载。这个方法立竿见影，我的收入快速增长，从最初的每月几元提升到了每月 100 元，甚至最后提高到了 1000+ 的水平。当然，百度似乎发觉了我收入的不正常增长，便禁用了我的帐号。<br />
那么，我再为广告联盟的模式补充一条问题（甚至可以说是隐患）：</p>
<ul>
<li>最终解释权归联盟方所有，他们可以随时封禁你的帐号——即使你并没有作弊。虽然我的被封禁并不光彩，但你大可不惮以最坏的恶意来推测强势的一方。</li>
</ul>
<p>塞翁失马焉知非福，百度联盟帐号的被封禁从客观上逼着我不得不寻找新的盈利模式。于是，我开始尝试一个很常见的方式——捐助。虽然我并不看好这个模式，不过仍然做出了<a href="http://www.mangacon.net/donate.php" target="_blank">这个捐助的页面</a>。现在回忆起来，这个捐助列表从 0 到 1 的过程是最漫长的一段时期。但自从有了第一个之后，第二个、第三个甚至更多人就慢慢都来了。这个场景让我想起了路边叫卖的小贩：空摊子很难吸引顾客，但如果雇一群托儿来围成个大圈子，那么很快看热闹的人就会围得密不透风。现在看看，如果当时我虚构几个名字在捐助页面上面，也许很容易就可以吸引其他的捐助者。——当然，前提是这个软件自身要让人喜欢，毕竟没人愿意在一坨垃圾上花钱为之鼓励。<br />
不过，与先前每月 1000+ 的收入相比，捐助的收入实在微不足道，而且很不稳定。于是，我开始构想新的盈利模式：</p>
<ul>
<li>开发支持多语言的国际版本，并尝试注册机制。如果你是个关注 ehentai 之类站点的宅男，那么你就可能需要支付一笔小小的费用来满足自己的欲望。</li>
<li>开发 iPad 设备上的同名软件，用于阅览漫画。App Store 的零售模式较之扑通的软件零售更为靠谱，国人也更愿意为之付费。</li>
</ul>
<p>这两个设想就作为 2012 年的计划之一吧。请期待漫画控的 2.0 版本。</p>
<h2  class="related_post_title">最热日志</h2><ul class="related_post"><li>2004 年 03 月 22 日 -- <a href="http://blog.titilima.com/show-37-1.html" title="劳动总结">劳动总结</a> (105)</li><li>2007 年 07 月 05 日 -- <a href="http://blog.titilima.com/ssdt.html" title="城里城外看SSDT">城里城外看SSDT</a> (76)</li><li>2005 年 09 月 08 日 -- <a href="http://blog.titilima.com/show-65-1.html" title="DLL的远程注入技术">DLL的远程注入技术</a> (68)</li><li>2007 年 12 月 18 日 -- <a href="http://blog.titilima.com/show-220-1.html" title="新开贴，往这骂">新开贴，往这骂</a> (34)</li><li>2007 年 11 月 02 日 -- <a href="http://blog.titilima.com/july-4-0-5.html" title="July v4.05">July v4.05</a> (33)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/my-soft-selling.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>一句话(26)</title>
		<link>http://blog.titilima.com/t-26.html</link>
		<comments>http://blog.titilima.com/t-26.html#comments</comments>
		<pubDate>Tue, 01 Nov 2011 13:59:08 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[随感录]]></category>
		<category><![CDATA[一句话]]></category>
		<category><![CDATA[读书]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1348</guid>
		<description><![CDATA[读完了《动物庄园》，觉得奥威尔很善于构造一个完整的世界体系来为他的小说服务。较之《1984》而言，《庄园》更加短小精悍，读来也更加轻松幽默。但是，看似轻松幽默的背后是更为简洁、赤裸裸的讽刺。那种直接了当的杀气透过滑稽的文字刺穿了纸质的书页，直挺挺的顶在了我的心口上。 相关日志2012 年 01 月 09 日 -- 诡计，诡计 (0)2011 年 10 月 06 日 -- 一句话(25) (0)2011 年 09 月 10 日 -- 一句话(24) (0)2011 年 08 月 02 日 -- 一句话(23) (1)2011 年 07 月 26 日 -- 一句话(22) (0)]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1388" title="动物庄园" src="http://blog.titilima.com/wp-content/uploads/2011/11/untitled.jpg" alt="" width="280" height="280" />读完了《动物庄园》，觉得奥威尔很善于构造一个完整的世界体系来为他的小说服务。较之《1984》而言，《庄园》更加短小精悍，读来也更加轻松幽默。但是，看似轻松幽默的背后是更为简洁、赤裸裸的讽刺。那种直接了当的杀气透过滑稽的文字刺穿了纸质的书页，直挺挺的顶在了我的心口上。</p>
<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2012 年 01 月 09 日 -- <a href="http://blog.titilima.com/tricks.html" title="诡计，诡计">诡计，诡计</a> (0)</li><li>2011 年 10 月 06 日 -- <a href="http://blog.titilima.com/t-25.html" title="一句话(25)">一句话(25)</a> (0)</li><li>2011 年 09 月 10 日 -- <a href="http://blog.titilima.com/t-24.html" title="一句话(24)">一句话(24)</a> (0)</li><li>2011 年 08 月 02 日 -- <a href="http://blog.titilima.com/t-23.html" title="一句话(23)">一句话(23)</a> (1)</li><li>2011 年 07 月 26 日 -- <a href="http://blog.titilima.com/t-22.html" title="一句话(22)">一句话(22)</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/t-26.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>一句话(25)</title>
		<link>http://blog.titilima.com/t-25.html</link>
		<comments>http://blog.titilima.com/t-25.html#comments</comments>
		<pubDate>Thu, 06 Oct 2011 05:07:49 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[随感录]]></category>
		<category><![CDATA[一句话]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1344</guid>
		<description><![CDATA[史蒂夫·乔布斯希望做出一款能够改变世界的产品——是的，他做到了。但是有很多人拿着这款产品开始装 B，于是有更多人鄙视装 B 的人，进而鄙视这款产品。然后，我看到了很多人，他们操着各种恶毒的言语攻击着已逝的乔布斯。无语。 相关日志2011 年 11 月 01 日 -- 一句话(26) (0)2011 年 09 月 10 日 -- 一句话(24) (0)2011 年 08 月 02 日 -- 一句话(23) (1)2011 年 07 月 26 日 -- 一句话(22) (0)2011 年 07 月 16 日 -- 一句话(21) (0)]]></description>
			<content:encoded><![CDATA[<p>史蒂夫·乔布斯希望做出一款能够改变世界的产品——是的，他做到了。但是有很多人拿着这款产品开始装 B，于是有更多人鄙视装 B 的人，进而鄙视这款产品。然后，我看到了很多人，他们操着各种恶毒的言语攻击着已逝的乔布斯。无语。</p>
<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2011 年 11 月 01 日 -- <a href="http://blog.titilima.com/t-26.html" title="一句话(26)">一句话(26)</a> (0)</li><li>2011 年 09 月 10 日 -- <a href="http://blog.titilima.com/t-24.html" title="一句话(24)">一句话(24)</a> (0)</li><li>2011 年 08 月 02 日 -- <a href="http://blog.titilima.com/t-23.html" title="一句话(23)">一句话(23)</a> (1)</li><li>2011 年 07 月 26 日 -- <a href="http://blog.titilima.com/t-22.html" title="一句话(22)">一句话(22)</a> (0)</li><li>2011 年 07 月 16 日 -- <a href="http://blog.titilima.com/t-21.html" title="一句话(21)">一句话(21)</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/t-25.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>伤不起的多音字</title>
		<link>http://blog.titilima.com/polyphones.html</link>
		<comments>http://blog.titilima.com/polyphones.html#comments</comments>
		<pubDate>Tue, 27 Sep 2011 13:43:00 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[技术的角落]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1337</guid>
		<description><![CDATA[先从一段代码开始吧。这段代码来自于某个版本的灵图天行者，由于年代久远，所以我并不能保证它完全一致。不过，代码的用意和精髓我还是能够保证忠实还原的。 1 2 3 4 5 6 7 8 9 10 int __cdecl foo&#40;const void* p1, const void* p2&#41; &#123; PCWSTR pwz1 = &#40;PCWSTR&#41;p1; PCWSTR pwz2 = &#40;PCWSTR&#41;p2; if &#40;0 == wcscmp&#40;pwz1, L&#34;重庆&#34;&#41;&#41; pwz1 = L&#34;冲庆&#34;; if &#40;0 == wcscmp&#40;pwz2, L&#34;重庆&#34;&#41;&#41; pwz2 = L&#34;冲庆&#34;; return wcscmp&#40;pwz1, pwz2&#41;; &#125; 简单解释一下，这是一个回调函数，被传递给 CRT 的 qsort 函数，用于对省级行政区进行名称排序。代码的用意也很简单，当传入的字符串参数是“重庆”时，以“冲庆”代替之进行比较。 因为“重庆”的“重”是多音字。在普通的字符串之中，被按“zhong”处理了，如果直接排序的话，最后得到的结果将是错误的。考虑如下代码： int &#8230; <a class="read-excerpt" href="http://blog.titilima.com/polyphones.html">Continue reading <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>先从一段代码开始吧。这段代码来自于某个版本的灵图天行者，由于年代久远，所以我并不能保证它完全一致。不过，代码的用意和精髓我还是能够保证忠实还原的。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="cpp" style="font-family: Consolas, Courier New;"><span style="color: #0000ff;">int</span> __cdecl foo<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> p1, <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> p2<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    PCWSTR pwz1 <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PCWSTR<span style="color: #008000;">&#41;</span>p1<span style="color: #008080;">;</span>
    PCWSTR pwz2 <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span>PCWSTR<span style="color: #008000;">&#41;</span>p2<span style="color: #008080;">;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000080;">==</span> wcscmp<span style="color: #008000;">&#40;</span>pwz1, L<span style="color: #FF0000;">&quot;重庆&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        pwz1 <span style="color: #000080;">=</span> L<span style="color: #FF0000;">&quot;冲庆&quot;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span> <span style="color: #000080;">==</span> wcscmp<span style="color: #008000;">&#40;</span>pwz2, L<span style="color: #FF0000;">&quot;重庆&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        pwz2 <span style="color: #000080;">=</span> L<span style="color: #FF0000;">&quot;冲庆&quot;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">return</span> wcscmp<span style="color: #008000;">&#40;</span>pwz1, pwz2<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>简单解释一下，这是一个回调函数，被传递给 CRT 的 qsort 函数，用于对省级行政区进行名称排序。代码的用意也很简单，当传入的字符串参数是“重庆”时，以“冲庆”代替之进行比较。<br />
因为“重庆”的“重”是多音字。在普通的字符串之中，被按“zhong”处理了，如果直接排序的话，最后得到的结果将是错误的。考虑如下代码：</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family: Consolas, Courier New;"><span style="color: #0000ff;">int</span> x <span style="color: #000080;">=</span> wcscmp<span style="color: #008000;">&#40;</span>L<span style="color: #FF0000;">&quot;重庆&quot;</span>, L<span style="color: #FF0000;">&quot;河北&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">// wcscmp returns 1</span></pre></div></div>

<p>在我看来，虽然 foo 这个函数可以完成正确的排序，但未免不够优雅。但似乎又没有什么更好的解决方案，于是 foo 的做法保留了很长时间——2009 年后也许有了更好的处理方法，不过我不知道。而且由于我后来离开了 GIS 这个行业，所以逐渐淡忘了这个事情。</p>
<p>不过，一个偶然的机会，iOS 的通讯录给了我一个更好的答案。</p>
<p><img src="http://blog.titilima.com/wp-content/uploads/2011/09/傲游截图20110927212645.png" alt="" title="傲游截图20110927212645" width="313" height="288" class="aligncenter size-full wp-image-1338" /></p>
<p>如上图所示，一名曾姓童鞋被归入了 C 的索引，有如重庆之于 zhong 庆。不过，通讯录却为用户提供了一个解决方案：</p>
<p><img src="http://blog.titilima.com/wp-content/uploads/2011/09/傲游截图20110927213019.png" alt="" title="傲游截图20110927213019" width="316" height="297" class="aligncenter size-full wp-image-1339" /></p>
<p>简单来说，为记录增加了一个排序参考字段。如果该字段非空，则以该字段为排序标准，否则以名称为排序标准。问题得以解决。</p>
<p><img src="http://blog.titilima.com/wp-content/uploads/2011/09/傲游截图20110927213153.png" alt="" title="傲游截图20110927213153" width="317" height="327" class="aligncenter size-full wp-image-1340" /></p>
<h2  class="related_post_title">最热日志</h2><ul class="related_post"><li>2004 年 03 月 22 日 -- <a href="http://blog.titilima.com/show-37-1.html" title="劳动总结">劳动总结</a> (105)</li><li>2007 年 07 月 05 日 -- <a href="http://blog.titilima.com/ssdt.html" title="城里城外看SSDT">城里城外看SSDT</a> (76)</li><li>2005 年 09 月 08 日 -- <a href="http://blog.titilima.com/show-65-1.html" title="DLL的远程注入技术">DLL的远程注入技术</a> (68)</li><li>2007 年 12 月 18 日 -- <a href="http://blog.titilima.com/show-220-1.html" title="新开贴，往这骂">新开贴，往这骂</a> (34)</li><li>2007 年 11 月 02 日 -- <a href="http://blog.titilima.com/july-4-0-5.html" title="July v4.05">July v4.05</a> (33)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/polyphones.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>LDirScanner：非递归遍历文件夹</title>
		<link>http://blog.titilima.com/directory-scanner.html</link>
		<comments>http://blog.titilima.com/directory-scanner.html#comments</comments>
		<pubDate>Fri, 23 Sep 2011 02:34:13 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[技术的角落]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[开源]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1333</guid>
		<description><![CDATA[久不发码了。今天发个习作，非递归遍历文件夹。 示例： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include &#60;atlbase.h&#62; #include &#34;DirScanner.hpp&#34; &#160; void WINAPI OnFile&#40;PCTSTR ptzFullPath, const WIN32_FIND_DATA&#38; wfd, LPARAM&#41; &#123; ATLTRACE&#40;_T&#40;&#34;File: %s\n&#34;&#41;, ptzFullPath&#41;; &#125; &#160; int main&#40;void&#41; &#123; LDirScanner&#60;TCHAR&#62; ds; ds.DoScan&#40;_T&#40;&#34;d:\\temp\\&#34;&#41;, OnFile, 0&#41;; return 0; &#125; 完整的 DirScanner.hpp 在这里。 相关日志2011 年 08 月 05 日 &#8230; <a class="read-excerpt" href="http://blog.titilima.com/directory-scanner.html">Continue reading <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>久不发码了。今天发个习作，非递归遍历文件夹。<br />
示例：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="cpp" style="font-family: Consolas, Courier New;"><span style="color: #339900;">#include &lt;atlbase.h&gt;</span>
<span style="color: #339900;">#include &quot;DirScanner.hpp&quot;</span>
&nbsp;
<span style="color: #0000ff;">void</span> WINAPI OnFile<span style="color: #008000;">&#40;</span>PCTSTR ptzFullPath, <span style="color: #0000ff;">const</span> WIN32_FIND_DATA<span style="color: #000040;">&amp;</span> wfd, LPARAM<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    ATLTRACE<span style="color: #008000;">&#40;</span>_T<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;File: %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008000;">&#41;</span>, ptzFullPath<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">void</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    LDirScanner<span style="color: #000080;">&lt;</span>TCHAR<span style="color: #000080;">&gt;</span> ds<span style="color: #008080;">;</span>
    ds.<span style="color: #007788;">DoScan</span><span style="color: #008000;">&#40;</span>_T<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;d:<span style="color: #000099; font-weight: bold;">\\</span>temp<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #008000;">&#41;</span>, OnFile, <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>完整的 DirScanner.hpp 在<a href="http://code.titilima.com/opensource/Util/DirScanner/DirScanner.hpp" target="_blank">这里</a>。</p>
<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2011 年 08 月 05 日 -- <a href="http://blog.titilima.com/get-path-from-special-shortcuts.html" title="获取特殊快捷方式的指向路径">获取特殊快捷方式的指向路径</a> (3)</li><li>2010 年 10 月 01 日 -- <a href="http://blog.titilima.com/feedp.html" title="FeedP">FeedP</a> (0)</li><li>2010 年 08 月 30 日 -- <a href="http://blog.titilima.com/show-591-1.html" title="搜狗浏览器 2.2.0.1401 DLL 注入漏洞">搜狗浏览器 2.2.0.1401 DLL 注入漏洞</a> (17)</li><li>2010 年 07 月 09 日 -- <a href="http://blog.titilima.com/show-590-1.html" title="MFC 4.2 中 CFileDialog 的一处崩溃隐患">MFC 4.2 中 CFileDialog 的一处崩溃隐患</a> (1)</li><li>2010 年 06 月 15 日 -- <a href="http://blog.titilima.com/show-587-1.html" title="lua_jsondecode">lua_jsondecode</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/directory-scanner.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>一句话(24)</title>
		<link>http://blog.titilima.com/t-24.html</link>
		<comments>http://blog.titilima.com/t-24.html#comments</comments>
		<pubDate>Sat, 10 Sep 2011 03:17:36 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[随感录]]></category>
		<category><![CDATA[一句话]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1330</guid>
		<description><![CDATA[今天教师节，唱个反调吧。我上高中时与班主任不对眼，她看不上我我也看不上她。当时很多人说：等十年后你就知道老师这么着是为你好了。但十年后的今天，我还是看不上她。也许又有人让我再等十年？好吧，我可以等，不过请不要低估未成年人的情商。卡扎菲都撒丫子跑路了，更何况你们那保守的教育方式呢。 相关日志2011 年 11 月 01 日 -- 一句话(26) (0)2011 年 10 月 06 日 -- 一句话(25) (0)2011 年 08 月 02 日 -- 一句话(23) (1)2011 年 07 月 26 日 -- 一句话(22) (0)2011 年 07 月 16 日 -- 一句话(21) (0)]]></description>
			<content:encoded><![CDATA[<p>今天教师节，唱个反调吧。我上高中时与班主任不对眼，她看不上我我也看不上她。当时很多人说：等十年后你就知道老师这么着是为你好了。但十年后的今天，我还是看不上她。也许又有人让我再等十年？好吧，我可以等，不过请不要低估未成年人的情商。卡扎菲都撒丫子跑路了，更何况你们那保守的教育方式呢。</p>
<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2011 年 11 月 01 日 -- <a href="http://blog.titilima.com/t-26.html" title="一句话(26)">一句话(26)</a> (0)</li><li>2011 年 10 月 06 日 -- <a href="http://blog.titilima.com/t-25.html" title="一句话(25)">一句话(25)</a> (0)</li><li>2011 年 08 月 02 日 -- <a href="http://blog.titilima.com/t-23.html" title="一句话(23)">一句话(23)</a> (1)</li><li>2011 年 07 月 26 日 -- <a href="http://blog.titilima.com/t-22.html" title="一句话(22)">一句话(22)</a> (0)</li><li>2011 年 07 月 16 日 -- <a href="http://blog.titilima.com/t-21.html" title="一句话(21)">一句话(21)</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/t-24.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>获取特殊快捷方式的指向路径</title>
		<link>http://blog.titilima.com/get-path-from-special-shortcuts.html</link>
		<comments>http://blog.titilima.com/get-path-from-special-shortcuts.html#comments</comments>
		<pubDate>Fri, 05 Aug 2011 06:41:55 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[技术的角落]]></category>
		<category><![CDATA[com]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[雕虫小技]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1307</guid>
		<description><![CDATA[在通常的情况下，为了获取一个快捷方式 (.lnk) 指向的路径，可以通过调用 IShellLink 接口的 GetPath 方法来实现。但是，某些特殊的快捷方式是无法取得指向路径的，比如 Office 系列的快捷方式，如下图。 首先你可以看到，普通快捷方式中用于显示路径信息的“目标”一栏已经被禁用掉了。而且，对其调用 IShellLink::GetPath，会得到类似这样的结果： C:\Windows\Installer\{90120000-0012-0000-0000-0000000FF1CE}\wordicon.exe 我的直觉告诉我，问题的真正答案就藏在 IShellLink 之中。不过，那正确的路是哪一条呢？MSDN 的优点是完备，缺点则是过于完备，我已经数次被淹没其中了。故不取之。 那么还是自己分析吧。我打开 Process Monitor，设置过滤器，如下图。 接下来使用快捷方式来启动 Word，可以看到系统的确访问了 wordicon.exe。 继续往下找，找到 WINWORD.EXE 的第一个现身处。 查看其调用堆栈，如下所示。 从堆栈中，可以得到两个有用的信息： WINWORD.EXE 真实路径的获取与 CShellLink::_Resolve 有关。而 IShellLink 之中，也存在一个名为 Resolve 的接口。 WINWORD.EXE 真实路径的获取借助了 msi.dll (Microsoft Windows Installer) 的部分函数，而 IShellLink::Resolve 方法的 fFlags 参数恰有一个标志名为 SLR_INVOKE_MSI。 好了，现在已经猜出了那句最重要的代码，可以堆码一试了。 1 2 3 4 5 6 7 &#8230; <a class="read-excerpt" href="http://blog.titilima.com/get-path-from-special-shortcuts.html">Continue reading <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>在通常的情况下，为了获取一个快捷方式 (.lnk) 指向的路径，可以通过调用 IShellLink 接口的 GetPath 方法来实现。但是，某些特殊的快捷方式是无法取得指向路径的，比如 Office 系列的快捷方式，如下图。</p>
<p><img src="http://blog.titilima.com/wp-content/uploads/2011/08/1.png" alt="" title="1" width="377" height="480" class="aligncenter size-full wp-image-1308" /></p>
<p>首先你可以看到，普通快捷方式中用于显示路径信息的“目标”一栏已经被禁用掉了。而且，对其调用 IShellLink::GetPath，会得到类似这样的结果：</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family: Consolas, Courier New;">C:\Windows\Installer\{90120000-0012-0000-0000-0000000FF1CE}\wordicon.exe</pre></div></div>

<p>我的直觉告诉我，问题的真正答案就藏在 IShellLink 之中。不过，那正确的路是哪一条呢？MSDN 的优点是完备，缺点则是过于完备，我已经数次被淹没其中了。故不取之。</p>
<p>那么还是自己分析吧。我打开 Process Monitor，设置过滤器，如下图。</p>
<p><img src="http://blog.titilima.com/wp-content/uploads/2011/08/2.png" alt="" title="2" width="519" height="324" class="aligncenter size-full wp-image-1309" /></p>
<p>接下来使用快捷方式来启动 Word，可以看到系统的确访问了 wordicon.exe。</p>
<p><a href="http://blog.titilima.com/wp-content/uploads/2011/08/3.png" target="_blank"><img src="http://blog.titilima.com/wp-content/uploads/2011/08/3-300x68.png" alt="" title="3" width="300" height="68" class="aligncenter size-medium wp-image-1310" /></a></p>
<p>继续往下找，找到 WINWORD.EXE 的第一个现身处。</p>
<p><a href="http://blog.titilima.com/wp-content/uploads/2011/08/4.png" target="_blank"><img src="http://blog.titilima.com/wp-content/uploads/2011/08/4-300x72.png" alt="" title="4" width="300" height="72" class="aligncenter size-medium wp-image-1311" /></a></p>
<p>查看其调用堆栈，如下所示。</p>
<p><a href="http://blog.titilima.com/wp-content/uploads/2011/08/5.png" target="_blank"><img src="http://blog.titilima.com/wp-content/uploads/2011/08/5-300x216.png" alt="" title="5" width="300" height="216" class="aligncenter size-medium wp-image-1312" /></a></p>
<p>从堆栈中，可以得到两个有用的信息：</p>
<ol>
<li>WINWORD.EXE 真实路径的获取与 CShellLink::_Resolve 有关。而 IShellLink 之中，也存在一个名为 Resolve 的接口。</li>
<li>WINWORD.EXE 真实路径的获取借助了 msi.dll (Microsoft Windows Installer) 的部分函数，而 IShellLink::Resolve 方法的 fFlags 参数恰有一个标志名为 SLR_INVOKE_MSI。</li>
</ol>
<p>好了，现在已经猜出了那句最重要的代码，可以堆码一试了。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="cpp" style="font-family: Consolas, Courier New;">CComPtr<span style="color: #000080;">&lt;</span>IShellLink<span style="color: #000080;">&gt;</span> sl<span style="color: #008080;">;</span>
sl.<span style="color: #007788;">CoCreateInstance</span><span style="color: #008000;">&#40;</span>CLSID_ShellLink<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">// Load the link file...</span>
&nbsp;
TCHAR sz<span style="color: #008000;">&#91;</span>MAX_PATH<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
WIN32_FIND_DATA wfd<span style="color: #008080;">;</span>
sl<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Resolve<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span>, SLR_INVOKE_MSI<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">// C:\Windows\Installer\{90120000-0012-0000-0000-0000000FF1CE}\wordicon.exe</span>
sl<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetPath<span style="color: #008000;">&#40;</span>sz, MAX_PATH, <span style="color: #000040;">&amp;</span>wfd, SLGP_RAWPATH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">// D:\Program Files\Microsoft Office\Office12\WINWORD.EXE</span>
LPITEMIDLIST pidl <span style="color: #000080;">=</span> <span style="color: #0000ff;">NULL</span><span style="color: #008080;">;</span>
sl<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>GetIDList<span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>pidl<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
SHGetPathFromIDList<span style="color: #008000;">&#40;</span>pidl, sz<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></pre></td></tr></table></div>

<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2009 年 12 月 28 日 -- <a href="http://blog.titilima.com/show-574-1.html" title="向系统图像列表中添加图标">向系统图像列表中添加图标</a> (4)</li><li>2004 年 09 月 10 日 -- <a href="http://blog.titilima.com/show-400-1.html" title="注册 COM 服务器">注册 COM 服务器</a> (0)</li><li>2011 年 09 月 23 日 -- <a href="http://blog.titilima.com/directory-scanner.html" title="LDirScanner：非递归遍历文件夹">LDirScanner：非递归遍历文件夹</a> (7)</li><li>2011 年 07 月 05 日 -- <a href="http://blog.titilima.com/encapsulation.html" title="封装">封装</a> (4)</li><li>2011 年 03 月 04 日 -- <a href="http://blog.titilima.com/versions-campaign.html" title="版本号的战争">版本号的战争</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/get-path-from-special-shortcuts.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>一句话(23)</title>
		<link>http://blog.titilima.com/t-23.html</link>
		<comments>http://blog.titilima.com/t-23.html#comments</comments>
		<pubDate>Tue, 02 Aug 2011 01:27:44 +0000</pubDate>
		<dc:creator>李马</dc:creator>
				<category><![CDATA[随感录]]></category>
		<category><![CDATA[一句话]]></category>
		<category><![CDATA[观而评之]]></category>

		<guid isPermaLink="false">http://blog.titilima.com/?p=1305</guid>
		<description><![CDATA[我想借用鲁迅先生《社戏》的一段文字来评价《变形金刚 3》：“于是看小旦唱，看花旦唱，看老生唱，看不知什么角色唱，看一大班人乱打，看两三个人互打，从九点多到十点，从十点到十一点，从十一点到十一点半，从十一点半到十二点。” 相关日志2011 年 11 月 01 日 -- 一句话(26) (0)2011 年 10 月 06 日 -- 一句话(25) (0)2011 年 09 月 10 日 -- 一句话(24) (0)2011 年 07 月 26 日 -- 一句话(22) (0)2011 年 07 月 16 日 -- 一句话(21) (0)]]></description>
			<content:encoded><![CDATA[<p>我想借用鲁迅先生《社戏》的一段文字来评价《变形金刚 3》：“于是看小旦唱，看花旦唱，看老生唱，看不知什么角色唱，看一大班人乱打，看两三个人互打，从九点多到十点，从十点到十一点，从十一点到十一点半，从十一点半到十二点。”</p>
<h2  class="related_post_title">相关日志</h2><ul class="related_post"><li>2011 年 11 月 01 日 -- <a href="http://blog.titilima.com/t-26.html" title="一句话(26)">一句话(26)</a> (0)</li><li>2011 年 10 月 06 日 -- <a href="http://blog.titilima.com/t-25.html" title="一句话(25)">一句话(25)</a> (0)</li><li>2011 年 09 月 10 日 -- <a href="http://blog.titilima.com/t-24.html" title="一句话(24)">一句话(24)</a> (0)</li><li>2011 年 07 月 26 日 -- <a href="http://blog.titilima.com/t-22.html" title="一句话(22)">一句话(22)</a> (0)</li><li>2011 年 07 月 16 日 -- <a href="http://blog.titilima.com/t-21.html" title="一句话(21)">一句话(21)</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.titilima.com/t-23.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

