<?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>chengis.me &#187; Webdev</title>
	<atom:link href="http://chengis.me/category/web/feed" rel="self" type="application/rss+xml" />
	<link>http://chengis.me</link>
	<description>Cheng's Personal Portfolio and Homepage. Photos, Illustrations, CSS and Jquery things included.</description>
	<lastBuildDate>Mon, 03 May 2010 14:58:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Multilingual in Wordpress</title>
		<link>http://chengis.me/2009/08/multilingual-in-wordpress</link>
		<comments>http://chengis.me/2009/08/multilingual-in-wordpress#comments</comments>
		<pubDate>Mon, 03 Aug 2009 18:00:48 +0000</pubDate>
		<dc:creator>Cheng</dc:creator>
				<category><![CDATA[Webdev]]></category>

		<guid isPermaLink="false">http://chengis.me/?p=644173</guid>
		<description><![CDATA[Recently I'm doing some wordpress theme designing for <a href="http://xmind.net">XMind Ltd</a>. They want a blog for multi-language support. Since it could be useful for many people, I would like to share my experiences. 我最近在给Xmind做一个多语言的Blog模板，感觉效果还不错，把我的经验共享一下。[linkmore]]]></description>
			<content:encoded><![CDATA[<p><a href="http://chengis.me/fruity/wp-content/uploads/coldblue.zip">Click to Download the Theme for Free</a></p>
<p><a href="http://chengis.me/fruity/wp-content/uploads/2009/08/XMind-Blog.png"><img src="http://chengis.me/fruity/wp-content/uploads/2009/08/XMind-Blog-505x281.png" alt="XMind Blog" title="XMind Blog" width="505" height="281" class="alignnone size-medium wp-image-644182" /></a><br />
<a href="http://chengis.me/fruity/wp-content/uploads/2009/08/XMind-Blog-2.png"><img src="http://chengis.me/fruity/wp-content/uploads/2009/08/XMind-Blog-2-505x281.png" alt="XMind Blog 2" title="XMind Blog 2" width="505" height="281" class="alignnone size-medium wp-image-644181" /></a></p>
<p>Recently I&#8217;m doing some wordpress theme designing for <a href="http://xmind.net">XMind Ltd</a>. They want a blog for multi-language support. Since it could be useful for many people, I would like to share my experiences.</p>
<p>我最近在给Xmind这家公司做一个多语言的Blog模板，感觉效果还不错，把我的经验共享一下：</p>
<p>The theme is based on a clean blue theme <a href="http://webrevolutionary.com/coldblue/"> &#8220;Cold Blue&#8221; </a> which matches the company&#8217;s color scheme perfectly and it&#8217;s free. I made some changes so that it looks better for me. But the problem is the theme has no support for multilingual. So I have to dig into the theme <code>PHP</code> files and manually change that. So:</p>
<p>我的模板是下载的<a href="http://webrevolutionary.com/coldblue/"> &#8220;Cold Blue&#8221; </a> 这个比较简洁的模板，我很喜欢，但是它并没有多语言的支持，所以我只好手动修改PHP文件，下面介绍一下如何把一个模板加入多语言的支持。</p>
<h3> How to add multilingual support for a theme?</h3>
<p>The answer is: You have to tell wordpress which is a multilingual string.<br />
Like said in <a href="http://blog.ipattern.org/archives/12">this blog</a>, you first register a name for yourself in <code>function.php</code>.</p>
<p>你要做的就是在模板里把需要翻译的地方标记出来，先要在<code>function.php</code>里面给你的模板注册一个名字，这样才能在里面使用。</p>
<p><code><br />
load_theme_textdomain('coldblue')<br />
</code></p>
<p>And in other theme files, you can now tell wordpress which are multilingual strings in your file.  Basically there are following things you may want to use:</p>
<p>然后在模板里，看到一段字符串就把它们替换成下面的写法吧。注意一下<code>_e('','')</code>是直接输出，适用于一般的文字内容。而<code>__('','')</code>是返回一个字符串，这样可以放在其它函数里面调用。如果对于比较复杂的情况，可以使用<code>printf</code>来输出。不明白可以看我提供的下载里面是怎么用。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Hello world'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'coldblue'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!--Will output the string directly--!&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> some_function<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Hello world'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'coldblue'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!-- Returns a string for function use --!&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Sometimes %s and %s and %s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$a1</span><span style="color: #339933;">,</span><span style="color: #000088;">$a2</span><span style="color: #339933;">,</span><span style="color: #000088;">$a3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!-- Complicate things--!&gt;</pre></div></div>

<p><br/></p>
<p>So you need to change every possible strings in your theme into multilingual notations. And after that you can ask the tool <code><a href="http://www.google.com/search?q=gettext">gettext</a></code> to find those things for you! </p>
<p>一旦标记完成了之后，就可以用gettext工具把所有标记过的东西查找出来，如下：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> wp-content<span style="color: #000000; font-weight: bold;">/</span>themes<span style="color: #000000; font-weight: bold;">/</span>coldblue
<span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">&quot;*.php&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> files.tmp
xgettext <span style="color: #660033;">--language</span>=PHP <span style="color: #660033;">--indent</span> <span style="color: #660033;">--keyword</span>=__ <span style="color: #660033;">--keyword</span>=_e \ 
<span style="color: #660033;">--keyword</span>=__ngettext:<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span> <span style="color: #660033;">-s</span> <span style="color: #660033;">-n</span> <span style="color: #660033;">--from-code</span>=UTF-<span style="color: #000000;">8</span> <span style="color: #660033;">-f</span> files.tmp</pre></div></div>

<p>Then you will get a file called<code>message.po</code>. You may rename it for your locale setting, like <code>zh_CN.po</code>, and edit the first lines of the file like this:</p>
<p>然后得到一个<code>message.po</code>的文件，然后你可以把它重命名一下，把开头的一段话改成以下的样子：</p>
<pre>
msgstr  "Project-Id-Version: PACKAGE VERSION\n"
        "Report-Msgid-Bugs-To: \n"
        "POT-Creation-Date: 2009-08-03 17:35+0800\n"
        "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
        "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
        "Language-Team: LANGUAGE <LL@li.org>\n"
        "MIME-Version: 1.0\n"
<span style="color:red">        "Content-Type: text/plain; charset=UTF-8\n"</span>
<span style="color:red">        "Content-Transfer-Encoding: 8bit\n"</span>
<span style="color:red">        "Plural-Forms: nplurals=2; plural=1 != 1;\n"</span>
</pre>
<p><br/></p>
<p>And then translate items one by one in <code>.po</code>file. Once you finished, a compile job is needed:</p>
<p>当把<code>.po</code>文件里面的所有行都翻译过了之后，可以把它编译成机器识别的<code>.mo</code>文件</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">msgfmt</span> <span style="color: #660033;">-o</span> zh_CN.mo zh_CN.po</pre></div></div>

<p>There are some tricky things about the date format. My way is to make the date format string multilingual:</p>
<p>对于一些比较麻烦的事情比如日期格式，其实可以把它本身就设成多语言字符串，这样就可以分别独立进行设置了。其实不同语言的格式也是可以随便改的，把css地址也设成多语言字符串，然后你就知道怎么回事了吧。</p>
<p><code>get_the_time(__('F jS, Y','coldblue'))</code></p>
<pre>
msgid	"F jS, Y"
msgstr	"Y年n月j日"
</pre>
<p>You may need to edit <code>wp-config.php</code> to change <code>define ('WPLANG', 'zh_CN'); </code> for a refresh, or simply wait for the next thing:<br />
如果对于一般应用的话，可以直接改<code>wp-config.php</code>来设置语言，但这并不是真正的多语言。</p>
<h3> How to add multilingual contents?</h3>
<p>A very nice plugin called <a href="http://wpml.org/">WPML</a>. It will:</p>
<p>我找到的一个插件是WPML，简直是为我量身定做。</p>
<ul>
<li>Allow you to create translations of posts or pages manually. (I don&#8217;t want the &#8220;Google Translate&#8221; way. 可以为每篇日志创建不同语言的版本而不是用Google翻译的办法。</li>
<li>Skip contents if no translation is available. So the page will look native. 如果没有相关语言的文章版本，可以设置直接不显示。</li>
<li>Setup the theme locale for each language. 为不同的语言版本设置不同的模板语言文件，我们刚才做的那些东西就可以用上了。</li>
<li>Translate widget titles, blog titles, tags and categories. 可以设置翻译各处的小标题，标签名，分类名，保证不留死角。</li>
</ul>
<p><br/></p>
<p>You may follow the manual of the plugin which is very clear about everything. I just want to show some screenshots: 具体如何设置看它的手册已经写得很清楚了。我只是大概贴几张截图，大体介绍一下。</p>
<p>Setting translation for posts: 设置文章的版本<br />
<a href="http://chengis.me/fruity/wp-content/uploads/2009/08/Picture-3.png"><img src="http://chengis.me/fruity/wp-content/uploads/2009/08/Picture-3-506x147.png" alt="Picture 3" title="Picture 3" width="506" height="147" class="alignnone size-medium wp-image-644183" /></a></p>
<p>Setting widget titles: 设置小标题<br />
<a href="http://chengis.me/fruity/wp-content/uploads/2009/08/Picture-4.png"><img src="http://chengis.me/fruity/wp-content/uploads/2009/08/Picture-4-506x111.png" alt="Picture 4" title="Picture 4" width="506" height="111" class="alignnone size-medium wp-image-644184" /></a></p>
<p>Theme properties, you know how to use the <code>.mo, .po</code>translations now. 模板的语言设置<br />
<a href="http://chengis.me/fruity/wp-content/uploads/2009/08/Picture-5.png"><img src="http://chengis.me/fruity/wp-content/uploads/2009/08/Picture-5-506x110.png" alt="Picture 5" title="Picture 5" width="506" height="110" class="alignnone size-medium wp-image-644185" /></a></p>
<p>And of course I would like to share the modified theme to you. 就知道有人想坐享其成，欢迎笑纳。</p>
<p><a href="http://chengis.me/fruity/wp-content/uploads/coldblue.zip">Click to Download</a></p>
<p>However I&#8217;m not yet so interested in making a multilingual site myself, I think writing them together is fine for a normal blogger <img src='http://chengis.me/fruity/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>不过现在我还不打算用那种方式来多语言，对于我一个平头百姓来说，这样英汉混杂大家不影响理解也就好了。</p>
]]></content:encoded>
			<wfw:commentRss>http://chengis.me/2009/08/multilingual-in-wordpress/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Website Design: cctext.net</title>
		<link>http://chengis.me/2009/08/website-design-cctext-net</link>
		<comments>http://chengis.me/2009/08/website-design-cctext-net#comments</comments>
		<pubDate>Sat, 01 Aug 2009 09:23:12 +0000</pubDate>
		<dc:creator>Cheng</dc:creator>
				<category><![CDATA[Webdev]]></category>

		<guid isPermaLink="false">http://chengis.me/?p=644170</guid>
		<description><![CDATA[I'm recently on a project for <a href="http://cctext.net">http://cctext.net</a>.
It will be ready soon but now is inviting people for testing. The website is a wiki service for small companies. So if you want to cooperate with your team with something like that, you can go there and read the introductions.[linkmore]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m recently on a project for <a href="http://cctext.net">http://cctext.net</a>.<br />
It will be ready soon but now is inviting people for testing. The website is a wiki service for small companies. So if you want to cooperate with your team with something like that, you can go there and read the introductions.</p>
<p><a href="http://cctext.net"><img src="http://chengis.me/fruity/wp-content/uploads/2009/08/47aNKJspuMiKCBGcrtCY2L9l3tiCeusn_o-506x432.png" alt="cctext" title="cctext" width="506" height="432" class="alignnone size-medium wp-image-644171" /></a></p>
<p>It&#8217;s very quickly made (actually the whole page with images/html/css are finished in one day), so I don&#8217;t think it deserve to examine too carefully. But I really like the icons I made for the site. My friend said they are &#8220;Web 2.0 like&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://chengis.me/2009/08/website-design-cctext-net/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pixel Perfection in Adobe Illustrator</title>
		<link>http://chengis.me/2009/06/pixel-perfection-in-illustrator</link>
		<comments>http://chengis.me/2009/06/pixel-perfection-in-illustrator#comments</comments>
		<pubDate>Fri, 12 Jun 2009 18:03:00 +0000</pubDate>
		<dc:creator>Cheng</dc:creator>
				<category><![CDATA[Illustration]]></category>
		<category><![CDATA[Webdev]]></category>

		<guid isPermaLink="false">http://chengis.me/?p=644072</guid>
		<description><![CDATA[You are not alone if you want to use Illustrator to design your website or software icons. Even Illustrator provides built-in templates for Web now. But there are other tweaks which I will show you in this post.  AI作为矢量工具，从事像素级设计并不是它的特长，但它确实能够做到，只是需要一些调整。[linkmore]]]></description>
			<content:encoded><![CDATA[<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/Adobe-Illustrator-CS4.png" alt="Adobe Illustrator CS4" title="Adobe Illustrator CS4" width="500" height="252" class="alignnone size-full wp-image-644092" /></p>
<h3>Pixel Perfection in Web/UI Designs 像素级设计</h3>
<p>Webpages and software UI are all things that meet your eyes on the computer screen. The minimal unit of the screen is the <a href="http://en.wikipedia.org/wiki/Pixel">pixel</a>, just like everything is consisted of atoms. All best designers provide pixel-perfect designs, which means they have already polished all details they could (there is no half-pixel any more). Pixels are small, but they are not invisible. On the screen there are 1-pixel-thin lines everywhere: many of the link underlines, cursor in the text fields, outlines of boxes, etc. You may call them &#8220;hairy&#8221; but they are useful. </p>
<p>像素级设计在网页和软件界面中是一个经常见到的名词，因为它们是显示在屏幕上的。电脑屏幕上最小的元素就是像素，正如物体的最小元素是原子一样。顶尖的设计师们都会提供像素级的设计，也就是说：他们已经尽力把所有细节都美化了(再没有半个像素了)。像素虽然小，但并非看不见。比如文本框里面的光标，链接上面的下划线，还有很多边框都是1像素。纤细，但是同时有用。</p>
<h3>Vector Tool not for Pixels? 矢量vs像素</h3>
<p>Adobe Illustrator is a widely loved tool for vector-based designs. Vectors are good for printing because they can be scaled up to any size without losing quality. But they also don&#8217;t (or hardly) have a minimal unit so you can scaled down everything without losing information. There is a problem for the screen: it displays things in pixels, but the positions of the vectors are not necessarily constrained by pixels. A line can be 0.5px (for pixel) wide, and a box can have a position at (100.1px, 100.2px). The half-pixels are displayed as semi-transparent, blurry pixels on screen. The freedom is a headache when you really meant to design pixel by pixel.</p>
<p>Adobe Illustrator是一个矢量绘图软件，也可以说是最好的一个。矢量图片非常适合印刷，因为它能保证无论如何放大都能保持清晰。无限制地可放大同时也就意味着无限制地可缩小，这对于屏幕来说就是一个问题。在屏幕上最小就是1像素，如果一个图形比1像素还小，那屏幕上只好用一个半透明的像素去显示它。在矢量软件中，我们是可以画一条半像素宽的线，或者让一个框的位置出现在非整数的像素上的。这样固然很自由，但是如果你真的需要逐像素去设计的时候，就会发现很难保证单个像素显示的效果。</p>
<p>For most designers, they choose to use Photoshop or Fireworks to work in pixels. But every tool has its own advantages, illustrator is still a very sweet 2D graphic designing tool for its numerous shape editing tools, multiple appearance options. And best of all, it&#8217;s nondestructive editing and the selection tools are more powerful and convenient than photoshop. &#8212; Think if there are 100 shapes!</p>
<p>所以设计者们一般会借助Photoshop和Fireworks去实现像素级的设计。但是每种工具都有它的优点，Illustrator的形状编辑等功能，还有对形状设定多种&#8221;外观&#8221;以实现复杂的效果都是其它软件不具备的。Illustrator作为矢量软件，在编辑过程中一切是无损进行的，同时还有着最好用的节点和形状选择工具 (如果有100个路径的话，PS尚能饭否?)。</p>
<h3>Yes Illustrator Loves Pixels. AI也喜欢像素</h3>
<p>You are not alone if you want to use Illustrator to design your website or software icons. Even Illustrator provides built-in templates for Web now. But there are other tweaks which I will show you in this post. So let&#8217;s get started.</p>
<p>首先要相信希望用Illustrator做网页和图标设计的人大有其人，现在Illustrator已经自带了Web的一些模板，但是要实现真正的像素级效果，还是需要进行一定的调整。我们现在开始：</p>
<p>Begin with a new document like this, make sure the options are set to pixel and RGB.<br />
首先新建一个文档，注意设定为像素和RGB模式的地方。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/New-Document.png" alt="New Document"/></p>
<p>And make some changes in the preferences in Illustrator:<br />
然后还要对Illustrator的软件设置进行修改：</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/dot5key.jpg" alt="Half Pixel Nudge" /><br />
This will make your keyboard nudges objects half a pixel each time, we&#8217;ll see how this works.<br />
这个选项让每次方向键移动半个像素，接下来会说明为什么。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/allpixel.jpg" alt="Pixel Settings" /><br />
Make sure everything we talk in Illustrator is in pixels.<br />
同时把所有的单位都改成像素。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/grids.png" alt="grids" title="grids"/><br />
Same here, even you will not use this most of the time.<br />
栅格的设定也改一下，虽然一般时候用不到。</p>
<p>But we&#8217;re not done, you need to turn off the &#8220;Snap&#8221; options in &#8220;View&#8221; menu. They will snap your 0.5px nudges to 1px and thus make our tweaks useless.<br />
最后还要把视图菜单中的对齐选项关掉，否则的话我们每次半像素的移动就自动被对齐成一像素，之前的设定就没意义了。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/viewmenu.png" alt="View Menu" /></p>
<h3>Draw Your Shapes at 100% 放大到100%再画</h3>
<p>Now you have a pixel to pixel connection from the screen to the document. When you draw something on the screen, the positions and lengths are in whole numbers (integers). See in your &#8220;Transform&#8221; panel.</p>
<p>现在我们已经把屏幕和文档建立了一一对应的关系，这时要保证你的放大比例在100%，这样所有的长度和位置都会是整数了。在“变换”面板中可以看到这些信息。</p>
<h3>Sharpen Our Vectors! 让我们的图形变清晰</h3>
<p>It still doesn&#8217;t mean nice and sharp pixels, but we are not too far. You&#8217;ll still have a god damn blurry line when you draw a 1px line (yes I double checked!).<br />
现在离我们的像素级目标已经不远了，但是你如果画一条1px的线的话，会发现它居然还是虚的！</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/fuzzyline.png" alt="Fuzzy 1px line" /></p>
<p>But what if we nudge it 0.5px? (use keyboard)<br />
但是如果我们移它半像素呢？也就是一次方向键</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/sharpline.png" alt="sharpline" title="sharpline" width="380" height="321" class="alignnone size-full wp-image-644082" /></p>
<p>It&#8217;s nice and sharp now, isn&#8217;t it? You may have a think about why it behaves like this, but it does works this simple.<br />
果然它变清晰了，抛却原因，这样确实有效而且简单。</p>
<p>Again, a blurry box out of the box (with integer informations). It has a 1px stroke.<br />
再试一次，一个模糊的1像素矩形，但是所有的信息都是整数像素的。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/fuzzybox.png" alt="Blurry Box" /></p>
<p>So we nudge it in two directions. See! It&#8217;s sharp now.<br />
移动两下，它现在马上清晰了。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/sharpbox.png" alt="Sharpbox" /></p>
<p>Luckily if a box only has fills and no strokes, it&#8217;s sharp enough without nudge.<br />
当然如果矩形只有填充的话这个步骤就简单得多，直接画好就行了。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/sharpblack.png" alt="Black Box" /></p>
<p>Round corner boxes can be sharp enough as demand. I prefer the appearance way because it can always be easily changed.<br />
圆角矩形也能保证它的清晰，我通常喜欢画一个矩形然后加上圆角的效果。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/sharpround.png" alt="Round Box" /></p>
<p>Sometimes we need dotted lines (1px by 1px). But you can&#8217;t use the &#8220;Dashed Line&#8221; option in the stroke panel, it simply doesn&#8217;t work as promised. So the best way is to use the patten to fake a dotted line.<br />
1像素的虚线也是经常需要用到的，但别指望描边选项里面的虚线功能，你设成1px 1px也会发现它其实还是虚的。最简单的办法是用图案去伪造虚线。</p>
<p>I assume you already how to make this tiny pattern, the black dot is 1px x 1px and the empty box is 2px x 2px.<br />
制作图案的步骤不再多说，黑点是1像素，而图案本身是2像素见方。<br />
<img src="http://chengis.me/fruity/wp-content/uploads/2009/06/2x2pattern.png" alt="Pattern" /></p>
<p>And the line is indeed a 1px tall box. But it&#8217;s not too complex I think.<br />
现在这条虚线实际上是1像素高的矩形，但这并不算什么麻烦的技巧。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/sharpdot.png" alt="Dotted Line" /></p>
<p>So we have already make things sharp, especially for horizontal and vertical lines (they are often blurry by default). And there is one thing more: the text. But it&#8217;s quite easy for us now. We just use the &#8220;Rasterize&#8221; function from &#8220;Effects&#8221; menu. It works well for most latin fonts just like the old windows times if you turn off the anti-aliasing. The texts are still editable because the rasterize is only a nondestructive effect.<br />
现在我们已经知道如何保证像素级精确的直线效果，还有一个需要考虑的事情就是文字。但这个设定起来就简单得多，只要有效果菜单中的“像素化”功能针对文字设定就可以，在其中关掉反锯齿的选项。加上这个效果之后，文字还是可以编辑的，但是它们更像是我们熟悉的像素字体了。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/rasterize.png" alt="rasterize" /></p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/pixeltext.png" alt="pixel text" /><br />
If it looks strange in letter spaces, try to nudge it a bit.<br />
如果文字间距有点奇怪的话，移动一下可能就会正常。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/pixelchinese.png" alt="Chinese Font" /><br />
A very big problem for me before was to find a way to display the bitmap Chinese font in windows. You may need to install a modified &#8220;Simsun&#8221; from <a href="http://www.newsmth.net/bbscon.php?bid=99&#038;id=1434993&#038;ftype=11">here</a>, and then simply rasterize it.<br />
曾经困扰我的一个问题就是汉字的像素字体如何在AI里面重现，我发现水木上面的这个<a href="http://www.newsmth.net/bbscon.php?bid=99&#038;id=1434993&#038;ftype=11">像素宋体</a>效果很好，其它的设置都一样，美中不足的是粗体还是没法做到。</p>
<p>Now we are ready to make some real things. The blue button is made of two objects, a reflection and a box. I just added multiple appearance for the 1px highlights and shadows. (That&#8217;s why I love Illustrator.)<br />
现在可以进行实际的设计了，图中的蓝色按钮有1像素的高光和阴影，我们已经实现了清晰的像素级效果。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/complex.png" alt="Complex" /></p>
<p>As you expected, the sharpness remains in exported images. Yay!<br />
正如你想象的那样，导出的图片中同样如此清晰。</p>
<p><img src="http://chengis.me/fruity/wp-content/uploads/2009/06/Test.png" alt="Test" /></p>
<h3>Good But You&#8217;ll Still Use Photoshop? 还是想用Ps</h3>
<p>I&#8217;d say Photoshop, Illustrator, Fireworks are just tools. A good designer only use them to finish their ideas. I make this tutorial just want to tell those Illustrator lovers, you can make pixel perfect designs in it and this is not compromise. You just export your images and use it directly and expect the sharpness. Hope you find it useful. And thanks for watching!</p>
<p>即使你还是喜欢用Ps也没关系，对于设计师来说软件只是实现想法的工具。我只是想让喜欢用Illustrator的人们知道，用AI做像素级的设计是完全可行的，不需要什么妥协或者转换就能做到。用AI导出来的图片也是直接可用的。</p>
<p>The 0.5px nudge and the preferences things are from this <a href="http://www.creativebush.com/tutorials/web_setup.php">screencast</a>, and I made some additions like the dotted line and the text, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://chengis.me/2009/06/pixel-perfection-in-illustrator/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Parallel SIESTA &amp; VASP on Mac Pro</title>
		<link>http://chengis.me/2009/03/parallel-siesta-vasp-on-mac-pro</link>
		<comments>http://chengis.me/2009/03/parallel-siesta-vasp-on-mac-pro#comments</comments>
		<pubDate>Fri, 13 Mar 2009 09:38:22 +0000</pubDate>
		<dc:creator>Cheng</dc:creator>
				<category><![CDATA[Mac Life]]></category>
		<category><![CDATA[Webdev]]></category>
		<category><![CDATA[gfortran]]></category>
		<category><![CDATA[ifort]]></category>
		<category><![CDATA[mac pro]]></category>
		<category><![CDATA[openmpi]]></category>
		<category><![CDATA[scalapack]]></category>
		<category><![CDATA[siesta]]></category>
		<category><![CDATA[vasp]]></category>

		<guid isPermaLink="false">http://chengis.me/?p=643934</guid>
		<description><![CDATA[SIESTA (Spanish Initiative for Electronic Simulations with Thousands of Atoms) and VASP are two commonly-used ab initio packages, for mad physicists to calculate the interesting stuffs of the atoms. But compiling the codes is a very tricky job, especially you want to compile it flawless. [linkmore]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.icmab.es/siesta/">SIESTA</a> (Spanish Initiative for Electronic Simulations with Thousands of Atoms) and <a href="http://cms.mpi.univie.ac.at/vasp/">VASP</a> are two commonly-used ab initio packages, for mad physicists to calculate the interesting stuffs of the atoms. But compiling the codes is a very tricky job, especially you want to compile it flawless. Both the packages supports parallel, which means you can use all your available CPU to speed up your work. Our lab got a 8-core Mac Pro, it looks awesome. I compiled one-CPU versions of both packages, and they already runs faster than I used 2-3 cpus on the university&#8217;s cluster. But I still want the challenge for a true parallel version on this sexy workstation.</p>
<p>So what&#8217;s the problems took me so long to complete?</p>
<ul>
<li>A Case-sensitive Volume! The default and trouble-free format is case-insensitive on Mac. But if you wanna build these things, at least make a .dmg and mount it. (of course you can make another partition on disk)</li>
<li>The Fortran/C Compiler.</li>
<li>Compile MPI support: The packages need this framework to communicate among CPUs, like network support or something.</li>
<li>Compile Math Libraries: i.e. BLAS, LAPACK, BLACS, SCALAPACK. Looks geeky? Think them to be your math symbols like cos, sin, lg, etc; the packages simply use them instead of code them one by one. Of course the libraries are in fact for matrix operations instead of simple math functions, but you get it. </li>
<li>Linking them. We may got many specialists as a team, but you still need to make sure they could talk to each other.</li>
</ul>
<h3>The Fortran/C Compiler</h3>
<p>On a mac (it should be intel now) the best available compiler would be the <code><a href="http://www.intel.com/cd/software/products/asmo-na/eng/267426.htm">ifort</a>, <a href="http://www.intel.com/cd/software/products/asmo-na/eng/266992.htm">icc</a></code> provided by intel themselves. Believe me, they are fast. But they need tricker configurations when you compile. Also, they need to pay for licenses. Of course you can apply a trial license and compile your codes. If you really care about that, you may think about the open source <code>gfortran</code>/<code>gcc</code>. And some kind guys(<a href="http://hpc.sf.net/">http://hpc.sf.net</a>) provides usable version for Mac OSX. All you need is just un-archive and use. The intel compilers are easy to install also, they use the standard .dmg and .pkg install routines.</p>
<p>Mission 1 Checked.</p>
<h3>The MPI Support</h3>
<p>In Leopard (OSX 10.5), apple have included OpenMPI framework. But very sadly, it comes with no fortran support. So we need to re-compile <a href="http://www.open-mpi.org/">OpenMPI</a>, or you can choose <a href="http://www.lam-mpi.org/">LAMMPI</a>, <a href="http://www.mcs.anl.gov/research/projects/mpich2/">MPICH 2</a> etc. They work basically the same, but you can still choose your favorite. I&#8217;d say I used OpenMPI because they had a <a href="http://www.open-mpi.org/faq/?category=osx">FAQ for OSX</a>. If you use gcc/gfortran, just follow the steps, except you need to make it 64bit! This is a lesson, so beware it: the default setting of gcc/gfortran compile 32bit files.</p>
<p>My options for gcc/gfortran:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>openmpi.gcc \
             <span style="color: #660033;">--with-wrapper-ldflags</span>=<span style="color: #ff0000;">&quot;-Wl,-search_paths_first&quot;</span> \
             <span style="color: #007800;">CFLAGS</span>=-m64 <span style="color: #007800;">CXXFLAGS</span>=-m64</pre></div></div>

<p>The intel compilers seems to compile 64bit files by default, but you can&#8217;t be too careful. My options:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>openmpi.intel\
             <span style="color: #660033;">--with-wrapper-ldflags</span>=<span style="color: #ff0000;">&quot;-Wl,-search_paths_first&quot;</span> \
             <span style="color: #007800;">CFLAGS</span>=-m64 <span style="color: #007800;">CXXFLAGS</span>=-m64 \
             <span style="color: #007800;">CC</span>=icc <span style="color: #007800;">CXX</span>=icpc <span style="color: #007800;">F77</span>=ifort <span style="color: #007800;">FC</span>=ifort</pre></div></div>

<p>And then enjoy the sexy scrolling matrix Terminal window, and then <code>make; sudo make install</code> to enjoy for another chance. This step is easy enough too.</p>
<p>Checked Mission 2!</p>
<h3>The Math Libraries</h3>
<p>Also I would like to mention the built-in LAPACK and ATLAS packages in Leopard, but they don&#8217;t quite seem to work neither. SIESTA needs BLAS, LAPACK, BLACS and SCALAPACK (yes, all of them) to build a parallel version. VASP seems a little more merciful, you just need BLAS and LAPACK.</p>
<p>As always, there is a simple way and a tricky way to do this. The simple way: you can use the <a href="http://www.netlib.org/scalapack/scalapack_installer.tgz">SCALAPACK installer</a>. And ask it to download and compile the libs (the coolest thing is, it builds all of them) for you. Remind you, the <code>-m64</code> flag for gcc/gfortran!</p>
<p>The tricky way, you can use Intel&#8217;s <a href="http://www.intel.com/cd/software/products/asmo-na/eng/307757.htm">Math Kernel Library</a> (MKL). Don&#8217;t worry, you should already installed them with your compilers on Mac. But the worst thing is, it provides BLAS, LAPACK support except SCALAPACK. They have it on Linux/Win, but not Mac. So you should use the installer mentioned above, just download and compile. But you don&#8217;t need to use all the libs, only the SCALAPACK and BLACS.</p>
<p>OK, Mission 3 done.</p>
<h3>Linking and Compiling</h3>
<p>We finally get to the final part. But before SIESTA/VASP really work, your efforts still mean nothing. Generally speaking, you need to take care of the configuration files in the following ways:</p>
<ul>
<li>Compiler: <code>mpif77/mpif90</code> depends on the specific package. But you should make sure it if you have several versions and do not use gfortran/ifort because they won&#8217;t compile parallel apps.</li>
<li>Flags: What did I say time after time? 64bit for gfortran! And for intel compilers, you surely want a best option to work well and fast. I&#8217;m not sure about everything, but this works for me:<code>-O3 -m64 -axSSE4.1,SSSE3 -xSSSE3 -mp1 -prec-div -pc80 -pad -ip</code></li>
<li>Linking Libraries: for gcc/gfortran, I simply use the libraries installed by the scalapack installer. and for intel, I use the following settings: (again, it works for me and don&#8217;t make me to explain <img src='http://chengis.me/fruity/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )<br/><br/>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MKLPATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>intel<span style="color: #000000; font-weight: bold;">/</span>Compiler<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">11.0</span><span style="color: #000000; font-weight: bold;">/</span>059<span style="color: #000000; font-weight: bold;">/</span>Frameworks<span style="color: #000000; font-weight: bold;">/</span>mkl<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>em64t<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #007800;">INTEL_MKL</span>=-L$<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span>\
      -I<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>intel<span style="color: #000000; font-weight: bold;">/</span>Compiler<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">11.0</span><span style="color: #000000; font-weight: bold;">/</span>059<span style="color: #000000; font-weight: bold;">/</span>Frameworks<span style="color: #000000; font-weight: bold;">/</span>mkl<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>  \
      -lmkl_lapack\
      $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>libmkl_intel_lp64.a\
      $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>libmkl_intel_thread.a \
      $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>libmkl_core.a\
      $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>libmkl_intel_thread.a \
      $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>libmkl_core.a\
      $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>libmkl_intel_thread.a \
      $<span style="color: #7a0874; font-weight: bold;">&#40;</span>MKLPATH<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">/</span>libmkl_core.a\
      <span style="color: #660033;">-liomp5</span> <span style="color: #660033;">-lpthread</span>
<span style="color: #007800;">LIBS</span>=  $<span style="color: #7a0874; font-weight: bold;">&#40;</span>SCALAPACK_LIBS<span style="color: #7a0874; font-weight: bold;">&#41;</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>BLACS_LIBS<span style="color: #7a0874; font-weight: bold;">&#41;</span>  \
       $<span style="color: #7a0874; font-weight: bold;">&#40;</span>INTEL_MKL<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

</li>
</ul>
<p>You should know the linking LIBS are just making everything together, so it doesn&#8217;t matter what intermediate variables in the makefile(or arch.make for SIESTA). Just make sure the compiler link the libraries in this way.</p>
<p>Mission Complete!</p>
<h3>Ta-da</h3>
<p>The apps should be working for now. If not, let me provide these tricky <a href="http://chengis.me/fruity/wp-content/uploads/osx_makefiles.zip">makefiles</a> for ya. They may not work for you immediately, but I think they could be a better start than those in the package.</p>
<h3 style="color:red">Updates</h3>
<p><a href="http://titus.phy.qub.ac.uk/group/Peter/">Peter Klaver</a> suggested the heavy optimization <code>-O3</code> could be problematic for some of the libs in VASP. If the executable is not working, please check the optimization options. Thanks Peter!</p>
<blockquote><p>I did have to reduce the optimization level on one file, fftmpi.F90. With -O3 I get an executable that gives me errors &#8216;Input and output electron density differ&#8217;. But reducing optimization for fftmpi.F90 to -O1 fixes it. I had emailed someone who was using linux/ifort earlier. He too found that the mpi version produces those errors unless optimization was reduced.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://chengis.me/2009/03/parallel-siesta-vasp-on-mac-pro/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Customizing Threaded Comments in WP 2.7</title>
		<link>http://chengis.me/2009/03/customizing-threaded-comments-in-wordpress-27</link>
		<comments>http://chengis.me/2009/03/customizing-threaded-comments-in-wordpress-27#comments</comments>
		<pubDate>Sat, 28 Feb 2009 16:03:41 +0000</pubDate>
		<dc:creator>Cheng</dc:creator>
				<category><![CDATA[Webdev]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[threaded comments]]></category>
		<category><![CDATA[wordpress 2.7]]></category>

		<guid isPermaLink="false">http://chengis.me/?p=643844</guid>
		<description><![CDATA[ 虽然树型评论功能不是什么新奇的东西了，但在Wordpress2.7里作为标准功能引入，无疑还是一个非常大的进步，同时，如何根据自己的喜好修改这个评论的界面，又成了折腾的新目标。我搜了一下，网上关于这方面的介绍还并不太多，于是给大家介绍一下我的做法。[linkmore]]]></description>
			<content:encoded><![CDATA[<p> 虽然树型评论功能不是什么新奇的东西了，但在Wordpress2.7里作为标准功能引入，无疑还是一个非常大的进步，同时，如何根据自己的喜好修改这个评论的界面，又成了折腾的新目标。我搜了一下，网上关于这方面的介绍还并不太多，除了介绍如何在<a href="http://www.topcss.cn/?p=11">模板中打开树型评论功能支持</a>，以及<a href="http://ottodestruct.com/blog/2008/09/29/wordpress-27-comments-enhancements/">如何让模板兼容旧系统的评论功能</a>，之外，还有都是在<a href="http://cdharrison.com/2008/12/threaded-comments/">默认的结构上作一些css上的设置</a>，毫无疑问那样那是头晕得很而且事倍功半的。</p>
<p><h3>What if I want to make the output in my way ?</h3>
<p>其实Wordpress的官方已经给了一个<a href="http://codex.wordpress.org/Template_Tags/wp_list_comments">足够清楚的解释</a>，那就是修改模板的<code>function.php</code>文件。首先，在你的<code>comments.php</code>里面用到<code>wp_list_comments</code>函数的地方用这样的代码：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;ol id=&quot;comment_list&quot;&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_comments<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type=comment&amp;callback=fruity_comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;li class=&quot;navigation clearfix&quot;&gt;...&lt;/li&gt;
&lt;/ol&gt;</pre></div></div>

<p>问题的关键就是<code>callback</code>这个参数，它会调用<code>function.php</code>里设置的函数，比如我自己这个<code>fruity_comment</code>，在这里你终于可以为所欲为了。</p>
<p>
下面就是我在<code>function.php</code>里面定义的相关情况：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000000; font-weight: bold;">function</span> fruity_comment<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #000088;">$depth</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
  &lt;li <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_class<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'clearfix'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;li-comment-<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
    &lt;div id=&quot;comment-<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_avatar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">,</span><span style="color: #000088;">$size</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'40'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;div class=&quot;reply&quot;&gt;
        &lt;h4&gt;
          <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_reply_link<span style="color: #009900;">&#40;</span>
                <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
                                       <span style="color: #0000ff;">'reply_text'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Reply'</span><span style="color: #339933;">,</span>
                                       <span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> 
                                       <span style="color: #0000ff;">'max_depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                                   <span style="color: #009900;">&#41;</span>
               <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;/h4&gt;
      &lt;/div&gt;
      &lt;h4 class=&quot;comment-author&quot;&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%s:'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_comment_author_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;/h4&gt;
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_approved</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;em&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Your comment is awaiting moderation.'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/em&gt;
        &lt;br /&gt;
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;small class=&quot;comment-meta&quot;&gt;
        &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span> 
                         get_comment_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
          <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> get_comment_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;/a&gt;
      &lt;/small&gt;
      &lt;div class=&quot;the_comment&quot;&gt; 
      <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_text<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
      &lt;/div&gt;
    &lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>有点乱，但是毕竟这一切都是透明的了。需要特别注意的一点，</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Do not write &lt;/li&gt;!</span></pre></div></div>

<p>Wordpress会自动把不匹配的闭合掉，这样你的评论才能层层包进来。<br />
这样你在写css的时候肯定会得心应手多了，而且由于function.php是模板的一部分，你对评论的设置在别人那里也是肯定会被应用的。</p>
]]></content:encoded>
			<wfw:commentRss>http://chengis.me/2009/03/customizing-threaded-comments-in-wordpress-27/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Welcome to My New Home!</title>
		<link>http://chengis.me/2009/02/welcome-to-my-new-home</link>
		<comments>http://chengis.me/2009/02/welcome-to-my-new-home#comments</comments>
		<pubDate>Fri, 27 Feb 2009 19:04:20 +0000</pubDate>
		<dc:creator>Cheng</dc:creator>
				<category><![CDATA[Webdev]]></category>

		<guid isPermaLink="false">http://chengis.me/?p=643817</guid>
		<description><![CDATA[This is my first ever wordpress theme. Thanks for coming. Click more to read the content. [linkmore]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-643679" title="Fruit Jam" src="http://chengis.me/fruity/wp-content/uploads/2009/02/2649149083_e5fa17bd0djpg.jpeg" alt="Fruit Jam" width="333" height="500" /></p>
<p>It&#8217;s long since I last updated <a href="http://chumsdock.yo2.cn">my blog</a>, simply because I&#8217;m building the new home here brick by brick. I don&#8217;t like my previous blog theme and function and I think I can &#8220;CHANGE&#8221;. And so, change happens. Remind you, this is my first ever wordpress theme. It still needs some more refinement, but I&#8217;m loving this.</p>
<p>The codename of the theme is &#8220;fruity&#8221; in my mind. I wanted to create a fresh and sweet theme that brings joy to my blog. And so you see the jars on the front page of the website. It is not easy to illustrate realistically with vector tools, I illustrate one for a day in my holiday. I did not tell my parents what I&#8217;m doing and they felt me &#8220;insane&#8221;. Of course their opinions for not sitting too long is right, but  it would be better if they can understand me.</p>
<p>I wanted to reuse the elements in the inner pages but I gave up the idea because there are always graphical contents in my blog, my portfolio and other pages, a blank theme could be better for you to focus on the actual content instead of the shiny jars. The paper-like style is inspired from a book with different printed book designs. I feel the subtle gradient can be good visual dividers for the web and so I tried. It looks OK for now. But I still find it a little plain and I&#8217;m thinking about another change before I find some other inspiration.</p>
<p>Developing Wordpress theme is not very easy for you need to dive into PHP, provided you can mockup HTML and CSS from a picture. Fortunately I can handle this (maybe for the most). As long as you constructed something &#8216;working&#8217;, you began to think about making it work better. That&#8217;s why I made a photo album function with Jquery by myself. I searched many tools or plugins, they did look awesome in some way, but I just wanted a constant way like apps like &#8220;iPhoto&#8221; or &#8220;Windows Photo Browser&#8221;. I have to admit I knew little about jquery before, but now things are easier for me to understand and make. Practice makes perfect, true.</p>
<p>The theme is not for release I think, since it&#8217;s a personal styled rather than a common used. But if anyone interested in anything in my theme: Cross browser CSS compatibility, Jquery usage, Wordpress customization, and also vector illustration, feel free to contact with me. And by the way, I tested browsers like IE6, IE7, Firefox 3, Safari 3 (Opera not yet).</p>
<p>I would like to thank <a rel="external" href="http://css-tricks.com">CSS-Tricks</a> and <a rel="external" href="http://bestwebgallery.com/">Best Web Gallery</a> for inspirations and necessary learning. I will write about other details later.</p>
<p>欢迎大家来到我的新家，我放假回家之前就想做一个自己的主页，而且想好了用Wordpress来做，断断续续从画画到写html,css再到改模板，加javascript(主要是jquery)效果，花了到今天为止差不多一个月吧。我查了一下我文件夹的第一张图片，是1月26号创建的。这段时间没少到处骚扰大家，不知道大家是不是已经都烦了。我这个模板还是不提供下载了，倒不是因为别的原因，主要是这个模板并不太适合做通用，有很多自己才知道的hack。但是如果大家对其中的功能感兴趣，我也很乐意和大家交流。马上快毕业了，希望给自己留个出路，比如说万一做IT什么的。</p>
]]></content:encoded>
			<wfw:commentRss>http://chengis.me/2009/02/welcome-to-my-new-home/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
