<?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>鬼の领地 &#187; 我的计划</title>
	<atom:link href="http://blog.upsuper.org/category/%e6%88%91%e7%9a%84%e8%ae%a1%e5%88%92/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.upsuper.org</link>
	<description>the place where there are some ghost appearing...</description>
	<lastBuildDate>Thu, 17 Jun 2010 08:12:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>转入 Arch Linux</title>
		<link>http://blog.upsuper.org/turn-to-arch-linux/</link>
		<comments>http://blog.upsuper.org/turn-to-arch-linux/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 15:01:48 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=1064</guid>
		<description><![CDATA[过去的一段时间里看到很多关于 Arch Linux 的文章，我也对此有那么一点感兴趣了。据说这个是比 Ubuntu 要难折腾一些的，我想，这也正好测试一下我的 Linux 水平，扩充一下关于 Linux 的见识嗯~（其实说白了就是装一下13嗯……）
准备工作肯定是要有的。由于我这次又准备对硬盘分区做一番大动作，资料备份是必不可少的了。整理了一下移动硬盘里的东西，然后把 /home/upsuper 里面的大量资料和部分配置文件移入了移动硬盘，费了大概一个多小时的时间。接下去打开了我的上网本，打开当时在 LinuxToy 刊登的 Arch Linux 安装指南，这是非常必要的。对于一个用惯了 Ubuntu 这样几乎纯图形界面配置的人来说，一个更接近于 LFS 的系统没有参考自然是不敢随便动手的。

不过有了这个参考，其实 Arch Linux 说实话也就比 Ubuntu 要麻烦那么一点点了……安装的过程中虽然有很多与那个指南不一样的地方，不过因为各种原因没有一一记录下来……比较有印象的是分区，是2个主分区，4个逻辑分区。虽然很多人说过，现在已经不再需要把 /boot 单独分出来了。不过考虑到我准备将默认文件系统弄成 ext4，而 Arch Linux 默认又不提供 Grub2 作为启动器，那我就只能非常无奈的单独分出一个 /boot 了……这就是第一个主分区。另外一个主分区留了 500MB，准备改天在里面放个 FreeBSD 什么的耍耍~4个逻辑分区是不能免俗的 /tmp、根分区、/home 和交换区。本来有点想像上网本里弄得那样把 /tmp 弄到内存里面去。不过想来想去，觉得 1GB 的内存对于上网本来说够了，可是对于台机来说还是不算很大的，于是就作罢了，单独分区。给了 /tmp 1GB，交换区 512MB，根目录 20GB，剩下的就照例都给了 /home。
我在安装的时候没有如安装指南所说的使用 Arch Linux 原本的源，而是转而直接使用了网易的源。由于这个原因，后面的安装配置过程异常迅速，因为网易的源在我这里的下载速度可以达到 1MB+/s！突然想起 Arch [...]]]></description>
			<content:encoded><![CDATA[<p>过去的一段时间里看到很多关于 Arch Linux 的文章，我也对此有那么一点感兴趣了。据说这个是比 Ubuntu 要难折腾一些的，我想，这也正好测试一下我的 Linux 水平，扩充一下关于 Linux 的见识嗯~（其实说白了就是装一下13嗯……）</p>
<p>准备工作肯定是要有的。由于我这次又准备对硬盘分区做一番大动作，资料备份是必不可少的了。整理了一下移动硬盘里的东西，然后把 /home/upsuper 里面的大量资料和部分配置文件移入了移动硬盘，费了大概一个多小时的时间。接下去打开了我的上网本，打开当时在 <a href="http://linuxtoy.org">LinuxToy</a> 刊登的 <a href="http://linuxtoy.org/archives/install-guide-for-arch-linux.html">Arch Linux 安装指南</a>，这是非常必要的。对于一个用惯了 Ubuntu 这样几乎纯图形界面配置的人来说，一个更接近于 LFS 的系统没有参考自然是不敢随便动手的。<br />
<span id="more-1064"></span><br />
不过有了这个参考，其实 Arch Linux 说实话也就比 Ubuntu 要麻烦那么一点点了……安装的过程中虽然有很多与那个指南不一样的地方，不过因为各种原因没有一一记录下来……比较有印象的是分区，是2个主分区，4个逻辑分区。虽然很多人说过，现在已经不再需要把 /boot 单独分出来了。不过考虑到我准备将默认文件系统弄成 ext4，而 Arch Linux 默认又不提供 Grub2 作为启动器，那我就只能非常无奈的单独分出一个 /boot 了……这就是第一个主分区。另外一个主分区留了 500MB，准备改天在里面放个 FreeBSD 什么的耍耍~4个逻辑分区是不能免俗的 /tmp、根分区、/home 和交换区。本来有点想像上网本里弄得那样把 /tmp 弄到内存里面去。不过想来想去，觉得 1GB 的内存对于上网本来说够了，可是对于台机来说还是不算很大的，于是就作罢了，单独分区。给了 /tmp 1GB，交换区 512MB，根目录 20GB，剩下的就照例都给了 /home。</p>
<p>我在安装的时候没有如安装指南所说的使用 Arch Linux 原本的源，而是转而直接使用了网易的源。由于这个原因，后面的安装配置过程异常迅速，因为网易的源在我这里的下载速度可以达到 1MB+/s！突然想起 Arch Linux 貌似还有多点下载的技术，我就不去研究了，不然可能 4MB/s、5MB/s 都能给我飙出来……接下去就直接赶英超美了……事实证明，福建电信还是比较厚道的~</p>
<p>我记得，那个 20GB 的空间，刚刚装完 Arch Linux 的核心部分，大概只占用了 8%，接着我开始大装软件。什么 python、erlang、texlive、gnome、jdk、jre、openoffice 之流都装上去，现在看看，已经占用了 33% 了……</p>
<p>因为一开始记了一张软件单子，按着单子安装软件也是十分的方便，在进入图形界面前就已经把需要的软件安装好大半了。话说 Arch Linux 的启动没有启动画面，这点让我有点不适应。而且看启动也没有加入 quiet 参数，启动过程各种信息喷涌而出。本想自己给他加上的，后来想想也就作罢了，没所谓的事情。</p>
<p>倒是字体的问题纠结了我一些时间，最后我还是从 AUR 上安装了文泉驿微米黑，然后手动把所有字体调为微米黑，现在显示效果相当赞。最后就是 Firefox 的插件问题了。因为插件我也列了张单子（这次可是准备充分嗯！），然后一个一个装上，最后用 Xmarks 同步一下书签，现在 Firefox 和我换系统之前几乎是一模一样了~当然，效率比原来那个提高了不少~</p>
<p>不得不说的是，Arch Linux 初装后的效率确实是没得说的快，比 Ubuntu 快多了。不过不知道是不是因为默认安装的东西少，还是希望这种效率能够不断保持下去。现在用 Arch，估计在以后的很长一段时间里不会再换了，也不会再重装了，Arch 你要给我好好表现~</p>
<p>最后上一张图把，超赞 <a href="http://www.bisigi-project.org/?lang=en">Bisigi</a> 的新主题 <a href="http://www.bisigi-project.org/?p=411&#038;lang=en">AirLines</a>：<br />
<a href="http://blog.upsuper.org/wp-content/uploads/2010/02/Screenshot.png"><img src="http://blog.upsuper.org/wp-content/uploads/2010/02/Screenshot-300x187.png" alt="" title="Screenshot" width="300" height="187" class="alignnone size-medium wp-image-1065" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/turn-to-arch-linux/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>一中2009音乐征集系统 推荐平台</title>
		<link>http://blog.upsuper.org/2009-recommend-platform-of-music-recruiter-for-fuzhou-no1-middle-school/</link>
		<comments>http://blog.upsuper.org/2009-recommend-platform-of-music-recruiter-for-fuzhou-no1-middle-school/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 06:47:19 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[学校]]></category>
		<category><![CDATA[福州一中]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=877</guid>
		<description><![CDATA[经过约两周的努力编写和调试，终于在昨天晚上完成了。因为做这个网站的缘故，再次新学习了大量东西，比如 jQuery，以及 Linux 下 Photoshop 的替代品 GIMP 等。同时也权当是一次练手，毕竟很久没写这种东西了。不过这次又一次与 IE 的 bug 及非标准化进行了顽强的斗争……
我要记录下在这个过程中遇到的种种问题和解决方法，以后再遇到就有地方查了~

客户端部分
很早就听说了 jQuery，上次看完 wp-codebox 的代码才顿觉 jQuery 的强大，因此这次选择了这个。经过短暂的学习就基本了解了，还是比较简单的。此外，jQuery 的插件库相当强大，里面找到了所有我需要的东西，包括上传文件的插件和播放器的插件等。
编写客户端代码最艰苦的部分就是配色和设计界面，以及在各个浏览器中调试。关于兼容性的问题放在后面说，前面先写点关于 JavaScript 代码的事。
第一个比较有趣的问题是关于浮点数保留精度的问题。虽然保留精度大是件好事，可是 JavaScript 没有如 C 中的 printf 那么方便的东西（不过网上似乎也有类似实现，不过 JavaScript 实现这个东西……还是算了吧……）。而一下把很长很长的浮点数显示在用户面前，也绝对不是件好事。经过搜寻，最后使用下面代码实现：

1
2
3
4
5
6
Number.prototype.fix = function &#40;num&#41; &#123;
  with &#40;Math&#41; return round&#40;this.valueOf&#40;&#41; * pow&#40;10, num&#41;&#41; / pow&#40;10, num&#41;;
&#125;;
String.prototype.fix = function &#40;num&#41; &#123;
  return parseFloat&#40;this&#41;.fix&#40;num&#41;;
&#125;;

第二个问题就是关于 MP3 播放器背景的问题。我用的这个播放器插件极具可定制性，背景色和前景色都能定制，不过要求都要使用十六进制的形式传入。为了更好的适应主题颜色，我就使用 jQuery 的 .css [...]]]></description>
			<content:encoded><![CDATA[<p>经过约两周的努力编写和调试，终于在昨天晚上完成了。因为做这个网站的缘故，再次新学习了大量东西，比如 jQuery，以及 Linux 下 Photoshop 的替代品 GIMP 等。同时也权当是一次练手，毕竟很久没写这种东西了。不过这次又一次与 IE 的 bug 及非标准化进行了顽强的斗争……</p>
<p>我要记录下在这个过程中遇到的种种问题和解决方法，以后再遇到就有地方查了~<br />
<span id="more-877"></span></p>
<h3>客户端部分</h3>
<p>很早就听说了 jQuery，<a href="http://blog.upsuper.org/modify-code-highlight-plugin/">上次看完 wp-codebox 的代码</a>才顿觉 jQuery 的强大，因此这次选择了这个。经过短暂的学习就基本了解了，还是比较简单的。此外，jQuery 的插件库相当强大，里面找到了所有我需要的东西，包括上传文件的插件和播放器的插件等。</p>
<p>编写客户端代码最艰苦的部分就是配色和设计界面，以及在各个浏览器中调试。关于兼容性的问题放在后面说，前面先写点关于 JavaScript 代码的事。</p>
<p>第一个比较有趣的问题是关于浮点数保留精度的问题。虽然保留精度大是件好事，可是 JavaScript 没有如 C 中的 printf 那么方便的东西（不过网上似乎也有类似实现，不过 JavaScript 实现这个东西……还是算了吧……）。而一下把很长很长的浮点数显示在用户面前，也绝对不是件好事。经过搜寻，最后使用下面代码实现：</p>

<div class="wp_codebox"><table><tr id="p8775"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p877code5"><pre class="javascript" style="font-family:monospace;">Number.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">fix</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">with</span> <span style="color: #009900;">&#40;</span>Math<span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> round<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">valueOf</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> pow<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> num<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> pow<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">fix</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> parseFloat<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fix</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>第二个问题就是关于 MP3 播放器背景的问题。我用的这个播放器插件极具可定制性，背景色和前景色都能定制，不过要求都要使用十六进制的形式传入。为了更好的适应主题颜色，我就使用 jQuery 的 .css 方法在脚本中现场获取当前在 CSS 中定义的前景色和背景色。结果发现，其在 Firefox 内返回的是类似 rgb(0, 0, 0) 这样的颜色表大形式。据说在 Firefox 中永远放回这种形式，而 IE 中则总是返回你实际设置时使用的格式。针对这个问题，我写了下面代码来解决（毋庸置疑，这又是抄的）：</p>

<div class="wp_codebox"><table><tr id="p8776"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code" id="p877code6"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> hex <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'00'</span><span style="color: #339933;">;</span>
  n <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> isNaN<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'00'</span><span style="color: #339933;">;</span>
  n <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> n <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">255</span><span style="color: #009900;">&#41;</span> n <span style="color: #339933;">=</span> <span style="color: #CC0000;">255</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'0123456789abcdef'</span>.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">-</span> n <span style="color: #339933;">%</span> <span style="color: #CC0000;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
         <span style="color: #3366CC;">'0123456789abcdef'</span>.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">%</span> <span style="color: #CC0000;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> color2hex <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">search</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/rgb/i</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    color <span style="color: #339933;">=</span> color.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> color.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> hex<span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> hex<span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> hex<span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'#'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    color <span style="color: #339933;">=</span> color.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">length</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
             color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
             color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> color<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>另外就是，为了防止大家大量重复提交同样音乐，这次加入了搜索功能，而且在提交一个音乐的时候就会自动进行搜索，并提示用户检查是否已有相同曲目被提交。至于搜索的实现，采用的是客户端搜索，算法上采用了非常著名而简单的 LCS (Longest common subsequence, 最长公共子序列) 这一 oier 的居家旅行杀人放火必备算法。事实证明，这一算法其实是很有效的~</p>

<div class="wp_codebox"><table><tr id="p8777"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p877code7"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> lcs<span style="color: #009900;">&#40;</span>str1<span style="color: #339933;">,</span> str2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> str1 <span style="color: #339933;">||</span> <span style="color: #339933;">!</span> str2<span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> arr <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span> j<span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> str1.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> str2.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>j<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> Math.<span style="color: #660066;">max</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">?</span> arr<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> j <span style="color: #339933;">?</span> arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>str1.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> str2.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>j<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> Math.<span style="color: #660066;">max</span><span style="color: #009900;">&#40;</span>arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> i <span style="color: #339933;">&amp;&amp;</span> j <span style="color: #339933;">?</span> arr<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">return</span> arr<span style="color: #009900;">&#91;</span>str1.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>str2.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>搜索算法：</p>

<div class="wp_codebox"><table><tr id="p8778"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code" id="p877code8"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> search<span style="color: #009900;">&#40;</span>type<span style="color: #339933;">,</span> text<span style="color: #339933;">,</span> callback<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  text <span style="color: #339933;">=</span> text.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s+/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> threshold <span style="color: #339933;">=</span> text.<span style="color: #660066;">length</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.25</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  getList<span style="color: #009900;">&#40;</span>type<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> value <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">typeof</span> value <span style="color: #339933;">==</span> <span style="color: #3366CC;">'number'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      callback<span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #003366; font-weight: bold;">var</span> itemtext<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> i<span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> value.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">item</span> <span style="color: #339933;">=</span> value<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      itemtext <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">source</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">title</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s+/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">len</span> <span style="color: #339933;">=</span> itemtext.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">lcs</span> <span style="color: #339933;">=</span> lcs<span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> itemtext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">lcs</span> <span style="color: #339933;">&gt;</span> threshold<span style="color: #009900;">&#41;</span> result.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    result.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>item1<span style="color: #339933;">,</span> item2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">lcs</span> <span style="color: #339933;">&gt;</span> item2.<span style="color: #660066;">lcs</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">lcs</span> <span style="color: #339933;">&lt;</span> item2.<span style="color: #660066;">lcs</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">len</span> <span style="color: #339933;">&lt;</span> item2.<span style="color: #660066;">len</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">len</span> <span style="color: #339933;">&gt;</span> item2.<span style="color: #660066;">len</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    callback<span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>还有一个是关于换肤的。<a href="http://blog.upsuper.org/replace-css-based-on-jquery/">上一次有一篇文章</a>测试过了基于更换 link 标签 href 属性换肤的可行性分析，这次就应用于了这个平台上。但在测试中发现 IE 并不像想像的那么完美。事实上，IE 在这个的测试过程中是非常废品的，几乎相当于不能换。经过多次实验，发现原因出在——IE6 在页面加载完毕后永远不会显示其还没有下载的样式信息。也就是说，更改 href 后，虽然 IE6 将原来的样式表无效化了，但此时发现新的样式表不在其缓存中，便拒绝启用新的样式表。但奇怪的是，IE6 这个时候事实上会连接服务器下载新的样式，因此在下一次访问的时候上次点过的皮肤就可以用了。这说明，我们只要要求 IE 预装载以后可能用到的东西就可以了。因此我就在页面底部加入了一个隐藏的 iframe 用于下载样式表和需要的图片。</p>
<p>除此之外，就是一些关于样式的新发现。我第一次知道当一个元素的 position 属性设置为 relative 的时候，对这个对象本身没有影响，但却使得其使用 position 属性的子元素的位移变由相对页面的位移变为相对该元素的位移。这的上传进度条的实现方法便是应用这一机制。</p>
<p>说到上传进度条，不得不说 Uploadify 这一插件真的很强大……我将其默认的上传进度和管理通过对各个必要函数绑定返回 false 来屏蔽掉了。</p>
<p>最后是关于 jQuery 优化的问题。虽然 jQuery 的官方测试表明，jQuery 的效率非常惊人，但优化下总归是有好处的。参考的资料见下面了，说说我大体做了哪些优化吧。一是缓存 jQuery 对象，防止重复调用选择器带来的性能损失。第二个是为选择器加上上下文限制，第三个是将部分效果移至 $(window).load 里。</p>
<p>在客户端的脚本部分的最最后，小小的埋怨一下 JavaScript 这个语言……我觉得实在是没有 Python 优美啊！什么时候 Python 能成为通用的客户端脚本啊，那个时候用 Python 就可以通吃服务器端和客户端了……</p>
<p>说完了脚本，来说说这次的界面。这次界面个人还是很满意的。在界面设计中，我自认为值得一提的是那个圆角，为什么呢？因为我以前一直以为 GIMP 不能画圆角。这次去网上找了才知道，GIMP 远比我想象的强大的多！猜猜圆角是怎么画出来的？是通过高斯模糊+调整色阶。具体的实现方法放在下面参考资料里面了，这里就不详述了。但我真的觉得很强大，虽然 GIMP 和 Photoshop 等商业软件还有差距，不过对于我来说，看来足够了。</p>
<p>最后再提下这次发现的不同浏览器的兼容性问题：</p>
<dl>
<dt>对于不显示的 Flash，IE 无法与其交互</dt>
<dt>对于曾经被隐藏但再次出现的 Flash，IE6 无法与其交互</dt>
<dd>解决方案：完全销毁原有 Flash 对象并重建</dd>
<dt>IE 中隐藏的 Flash MP3 播放器可以发出声音，但 Firefox 不行</dt>
<dd>解决方案：统一的办法就是直接销毁播放器，而非单单让其隐藏</dd>
<dt>IE 的 JavaScript 解析器不支持用 [index] 的方式索引字符</dt>
<dd>解决方案：使用原有标准的 .charAt(index) 方式索引</dd>
<dt>在 IE6 中，显示时尚未下载完成的 CSS 元素永远不会显示（如背景图片）</dt>
<dd>解决方案：在页面中加入一个隐藏的 iframe 用于预加载</dd>
<dt>IE6 中的双倍外边距 bug</dt>
<dd>解决方案：给相应对象加上 display:inline; 属性，或通过 hack 专门调低在 IE6 下的外边距</dd>
<dt>IE6 对于 display 的 inline-block 属性支持不完善</dt>
<dd>解决方案：给相应对象加上 zoom:1; 属性</dd>
<dt>IE6 不支持半透明的 png 图片</dt>
<dd>解决方案：采用 IE 专有的过滤器 filter:progid:DXImageTransform.Microsoft.AlphaImageLoader 可以完美解决</dd>
</dl>
<p>IE 的兼容性烦死人啊……看看我的 ie6-fix.css 和 ie7-fix.css 就知道了……</p>
<h4>使用部件</h4>
<ul>
<li><a href="http://jquery.com/">jQuery: The Write Less, Do More, JavaScript Library</a></li>
<li><a href="http://www.uploadify.com/">Uploadify &#8211; jQuery File Upload Plugin Script</a></li>
<li><a href="http://code.google.com/p/swfobject/">SWFObject</a></li>
<li><a href="http://www.sean-o.com/jquery/jmp3/">jMP3: Sean O&#8217;s JavaScript MP3 Player / jQuery plugin</a></li>
<li><a href="http://code.google.com/p/jquery-json/">JSON plugin for jQuery</a></li>
</ul>
<h4>参考资料</h4>
<ul>
<li><a href="http://www.k99k.com/jQuery_getting_started.html">jQuery中文入门教程</a></li>
<li><a href="http://topic.csdn.net/t/20031109/21/2443654.html">如何格式化浮点数计算结果 JavaScript &#8211; CSDN社区</a></li>
<li><a href="http://plugins.jquery.com/files/jquery.sifr.js_1.txt">jQuery.sifrSettings</a></li>
<li><a href="http://www.rainbk.net/post/199.html">jQuery性能优化指南 (全部) &#8211; 烟雨博客</a></li>
<li><a href="http://blog.chinaunix.net/u1/55011/showart.php?id=468782">1.3 圆整圆角 &#8211; The Gimp &#8211; 思魂轩</a></li>
<li><a href="http://www.uploadify.com/forum/viewtopic.php?f=7&#038;t=1878">Uploadify &bull; View topic &#8211; Uploadify doesnt fire uploadifyUpload/uploadifyClearQueue</a></li>
<li><a href="http://feiyu.asgard.cn/article_157.html">IE6下margin双倍问题 &#8211; 绯雨的天空</a></li>
<li><a href="http://www.howtocreate.co.uk/alpha.html">Making Internet Explorer use PNG Alpha transparency</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/2009-recommend-platform-of-music-recruiter-for-fuzhou-no1-middle-school/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>关于 PHP 常数的定义和范围</title>
		<link>http://blog.upsuper.org/about-php-constants-definition-and-scope/</link>
		<comments>http://blog.upsuper.org/about-php-constants-definition-and-scope/#comments</comments>
		<pubDate>Sun, 17 May 2009 04:03:12 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[探究学习]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=760</guid>
		<description><![CDATA[PHP 的常数还是很有趣的。作为一个脚本语言，常数在 PHP 中成为了一种十分灵活的东西。没有细究 PHP 的文档，自己做了个实验来看看 PHP 到底时怎么处理常数的。实验代码如下：

1
2
3
4
5
6
7
8
function a&#40;$t&#41; &#123;
  define&#40;'T', $t&#41;;
  echo T;
&#125;
&#160;
a&#40;'a'&#41;;
echo T;
a&#40;'b'&#41;;

结果发现，输出的三个字符都是 a，而且没有报错。这说明，无论常数在哪里声明，都是全局有效的，而且定义后不可再被更改了（废话……不然还叫常数）。从定义发生的时机看，确实是第一次调用函数 a() 的时候被定义的，而后再次调用函数 a() 时没有被修改也没有报错。还真是有趣的说~

话说今天发现 PHP 的 link 函数的文档中写着“5.3.0  	 This function is now available on Windows platforms.”！十分好奇，Windows 下也有文件硬链接？载来 PHP 5.3.0 RC2（又一惊，5.3.0 已经到 RC2 了！）的代码，细细观赏一番，发现在 ext/standard 下有一个文件叫 link_win32.c，打开看到如下代码：

1
2
3
4
5
6
7
8
9
10
11
12
13
14
PHP_FUNCTION&#40;link&#41;
&#123;
/* ... 此处省略数行 ... */
#ifndef ZTS
	ret = CreateHardLinkA&#40;topath, frompath, NULL&#41;;
#else [...]]]></description>
			<content:encoded><![CDATA[<p>PHP 的常数还是很有趣的。作为一个脚本语言，常数在 PHP 中成为了一种十分灵活的东西。没有细究 PHP 的文档，自己做了个实验来看看 PHP 到底时怎么处理常数的。实验代码如下：</p>

<div class="wp_codebox"><table><tr id="p76011"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p760code11"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> a<span style="color: #009900;">&#40;</span><span style="color: #000088;">$t</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'T'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$t</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> T<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
a<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> T<span style="color: #339933;">;</span>
a<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'b'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>结果发现，输出的三个字符都是 a，而且没有报错。这说明，无论常数在哪里声明，都是全局有效的，而且定义后不可再被更改了（废话……不然还叫常数）。从定义发生的时机看，确实是第一次调用函数 a() 的时候被定义的，而后再次调用函数 a() 时没有被修改也没有报错。还真是有趣的说~<br />
<span id="more-760"></span><br />
话说今天发现 PHP 的 link 函数的文档中写着“5.3.0  	 This function is now available on Windows platforms.”！十分好奇，Windows 下也有文件硬链接？载来 PHP 5.3.0 RC2（又一惊，5.3.0 已经到 RC2 了！）的代码，细细观赏一番，发现在 ext/standard 下有一个文件叫 link_win32.c，打开看到如下代码：</p>

<div class="wp_codebox"><table><tr id="p76012"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p760code12"><pre class="c" style="font-family:monospace;">PHP_FUNCTION<span style="color: #009900;">&#40;</span>link<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #808080; font-style: italic;">/* ... 此处省略数行 ... */</span>
<span style="color: #339933;">#ifndef ZTS</span>
	ret <span style="color: #339933;">=</span> CreateHardLinkA<span style="color: #009900;">&#40;</span>topath<span style="color: #339933;">,</span> frompath<span style="color: #339933;">,</span> NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#else </span>
	ret <span style="color: #339933;">=</span> CreateHardLinkA<span style="color: #009900;">&#40;</span>dest_p<span style="color: #339933;">,</span> source_p<span style="color: #339933;">,</span> NULL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #339933;">#endif	</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>ret <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		php_error_docref<span style="color: #009900;">&#40;</span>NULL TSRMLS_CC<span style="color: #339933;">,</span> E_WARNING<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> strerror<span style="color: #009900;">&#40;</span>errno<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		RETURN_FALSE<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	RETURN_TRUE<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>CreateHardLinkA 难道是一个 API 函数？再一查，发现 MSDN 上有文档：<a href="http://msdn.microsoft.com/en-us/library/aa363860(VS.85).aspx">CreateHardLink Function (Windows)</a>，上面还写着“Establishes a hard link between an existing file and a new file. This function is only supported on the NTFS file system, and only for files, not directories.”，只有 NTFS 才能用。看来只好认为是学 Linux 的了……竟然支持，真是不可思议，不过 Windows 为什么默认却没有办法在 GUI 中使用这个功能呢？</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/about-php-constants-definition-and-scope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>我的 lab1（二）——编译安装 PHP 5.3</title>
		<link>http://blog.upsuper.org/my-lab1-b-compile-and-install-php-53/</link>
		<comments>http://blog.upsuper.org/my-lab1-b-compile-and-install-php-53/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 07:14:12 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[探究学习]]></category>
		<category><![CDATA[JeOS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=657</guid>
		<description><![CDATA[昨天把 JeOS 给弄好了，今天就开始弄 PHP 5.3 了……

把刚刚下好的 php-5.3.0beta1.tar.bz2 上传到 lab1 里面，准备解压。发现 JeOS 里面没有 bzip2……又 apt 了个……
用 tar jxvf php-5.3.0beta1.tar.bz2 解压了文件，进入文件夹，开始 configure。
刚刚 configure 没一会儿，提示找不到 C 编译器。冷了，连 gcc 什么的都没装。又 apt 了个 gcc 和 g++。再 configure，提示没找到 libxml2。apt 了 libxml2，还是找不到，去网上一查，发现还要 libxml2-dev，又 apt 了下来。
最后终于 configure 过了，开始 make。提示没有 make。其实这早在我的意料之中……apt 了 make 和 automake，开始 make，make 完提示说别忘了 make test，我就 make test……等他 test 完告诉我提交报告，那就提交报告吧……麻烦……提交完我就开始 sudo [...]]]></description>
			<content:encoded><![CDATA[<p>昨天把 JeOS 给弄好了，今天就开始弄 PHP 5.3 了……<br />
<span id="more-657"></span><br />
把刚刚下好的 php-5.3.0beta1.tar.bz2 上传到 lab1 里面，准备解压。发现 JeOS 里面没有 bzip2……又 apt 了个……</p>
<p>用 tar jxvf php-5.3.0beta1.tar.bz2 解压了文件，进入文件夹，开始 configure。</p>
<p>刚刚 configure 没一会儿，提示找不到 C 编译器。冷了，连 gcc 什么的都没装。又 apt 了个 gcc 和 g++。再 configure，提示没找到 libxml2。apt 了 libxml2，还是找不到，<a href="http://blog.sina.com.cn/s/blog_54ee3de50100btjv.html" target="_blank">去网上一查</a>，发现还要 libxml2-dev，又 apt 了下来。</p>
<p>最后终于 configure 过了，开始 make。提示没有 make。其实这早在我的意料之中……apt 了 make 和 automake，开始 make，make 完提示说别忘了 make test，我就 make test……等他 test 完告诉我提交报告，那就提交报告吧……麻烦……提交完我就开始 sudo make install。安装完，试一下 cli 的 php，可以使用了。很兴奋的回到外面在浏览器输入 phpinfo 的页面，结果提示下载……</p>
<p>失败了……在网上又一整查找，看到一篇<a href="http://blog.sina.com.cn/s/blog_54ee3de50100btjv.html" target="_blank"> Ubuntu 下编译安装 5.2.8 的</a>，里面的编译参数看不懂 _-b 所以我就一个都没敢加……不过我觉得实在费解，为什么要编译安装 5.2.8 呢……5.2.8 似乎没什么新特性，而且 Ubuntu 自带的 PHP 5.2.6 是加了 Suhosin Patch 的，安全！最后找到 PHP 的<a href="http://cn2.php.net/manual/en/install.unix.apache2.php" target="_blank">官方文档</a>才明白，那个 &#8211;with-apxs2 是表示 Apache2 的……</p>
<p>用 find |grep &#8216;apxs&#8217; 发现我饿 apxs2 在 /usr/bin/apxs2，就又重新开始 configure 了。这次 configure 倒也顺利（因为改装的都装好了），本想也顺便 &#8211;with-mysql 个，结果发现 mysql 没装……而且装了还是不过，就干脆不要了。</p>
<p>configure 完成后，照例是 make、make test、sudo make install。这或许就像 Windows 里的下一步一样。不过在 Ubuntu 的 apt 下，连这个都省了，我也被惯懒了……</p>
<p>sudo make install 果然出错了，提示 httpd.conf 至少应该有一个 LoadModule。想起上面那篇编译 5.2.8 的里面也写了这些东西，遍在 httpd.conf 里面加入了</p>

<div class="wp_codebox"><table><tr id="p65714"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p657code14"><pre class="apache" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;"># Dummy LoadModule directive to aid module installations</span>
<span style="color: #adadad; font-style: italic;"># LoadModule dummy_module /usr/lib/apache2/modules/mod_dummy.so</span></pre></td></tr></table></div>

<p>竟然真的过了 _-b 电脑还真好骗……</p>
<p><img src="http://blog.upsuper.org/wp-content/uploads/2009/01/phpinfo_1233299380831-300x293.png" alt="phpinfo_1233299380831" title="phpinfo_1233299380831" width="300" height="293" class="alignright size-medium wp-image-658" />安装完成后，再次重启 apache2，打开浏览器，查看 phpinfo。终于出来了，我的 PHP 5.3！</p>
<p>真是辛苦……本来以为用了这么久 Ubuntu 对 Linux 还算有点了解了，经过这么一折腾，发现自己原来连门都还没入……</p>
<p>好吧，PHP 5.3 的测试就再说吧……今天就这样了……</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/my-lab1-b-compile-and-install-php-53/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ujudger-base 0.1 Released</title>
		<link>http://blog.upsuper.org/ujudger-base-0-1-released/</link>
		<comments>http://blog.upsuper.org/ujudger-base-0-1-released/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 14:45:21 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[C/C++/C#]]></category>
		<category><![CDATA[GPL]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[ujudger]]></category>
		<category><![CDATA[源代码]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=122</guid>
		<description><![CDATA[经过我许多的资料查找和编写，终于完成了ujudger-base的第一个版本！
ujudger 是我准备编写的基于 Linux 的测评程序，采用 GPL 协议。由于一直以来找不到 Linux 下的测评程序，因此准备自己写一个。ujudger 的 u 既是取我网名的第一个字母，也是 ubuntu 的第一个字母，表示这个程序应该会在 ubuntu 下完成编写。而 ujudger-base 是 ujudger 的基础程序，表现 ujudger 的测评核心，即耗时和内存耗用的取得。使用 time 命令和系统监视器监视器的资料对比一下，ujudger-base 获得的信息还是比较体现程序的真实情况的。

ujudger-base 并不复杂，不过也不简单（自少我这么觉得）。在编写的过程中，开始不知道 Linux 下的进程控制，后来知道了 fork() 函数。开始觉得很奇怪，后来也就慢慢明白了。不就是返回两次么，有什么了不起的~然后就是exec族的函数，成功了就不返回了_-b
然后就是等待的办法。网上有些人是直接用 wait4 快速返回来等待，但我觉得这样很影响速度，因此采用了 usleep 等待 100ms（有没有一点像 Cena 的方法？）。
同时，我还查找了有关程序运行数据读取的相关问题，最后采用的是读取 /proc/&#60;pid&#62;/stat 文件的方法。具体采用的一些技术层的资料我准备明天发一篇来讲。
除此之外就是几乎第一次大规模的采用 C++ 的推荐风格编写程序（以前写OI的程序，为了效率不得不放弃许多 C++ 优美的特性），因此有写丑的地方也请多多指教。
里面的注释很多了，由于我的英语水平有限（My English is limited!），如果注释有什么语法错误，也请多多指教！
点击这里下载源代码：ujudger-base-0.1.cpp (3.6 KB)
]]></description>
			<content:encoded><![CDATA[<p>经过我许多的资料查找和编写，终于完成了ujudger-base的第一个版本！</p>
<p>ujudger 是我准备编写的基于 Linux 的测评程序，采用 GPL 协议。由于一直以来找不到 Linux 下的测评程序，因此准备自己写一个。ujudger 的 u 既是取我网名的第一个字母，也是 ubuntu 的第一个字母，表示这个程序应该会在 ubuntu 下完成编写。而 ujudger-base 是 ujudger 的基础程序，表现 ujudger 的测评核心，即耗时和内存耗用的取得。使用 time 命令和系统监视器监视器的资料对比一下，ujudger-base 获得的信息还是比较体现程序的真实情况的。<br />
<span id="more-122"></span><br />
ujudger-base 并不复杂，不过也不简单（自少我这么觉得）。在编写的过程中，开始不知道 Linux 下的进程控制，后来知道了 fork() 函数。开始觉得很奇怪，后来也就慢慢明白了。不就是返回两次么，有什么了不起的~然后就是exec族的函数，成功了就不返回了_-b</p>
<p>然后就是等待的办法。网上有些人是直接用 wait4 快速返回来等待，但我觉得这样很影响速度，因此采用了 usleep 等待 100ms（有没有一点像 Cena 的方法？）。</p>
<p>同时，我还查找了有关程序运行数据读取的相关问题，最后采用的是读取 /proc/&lt;pid&gt;/stat 文件的方法。具体采用的一些技术层的资料我准备明天发一篇来讲。</p>
<p>除此之外就是几乎第一次大规模的采用 C++ 的推荐风格编写程序（以前写OI的程序，为了效率不得不放弃许多 C++ 优美的特性），因此有写丑的地方也请多多指教。</p>
<p>里面的注释很多了，由于我的英语水平有限（My English is limited!），如果注释有什么语法错误，也请多多指教！</p>
<p>点击这里下载源代码：<a href="http://ujudger.upsuper.org/src/ujudger-base-0.1.cpp">ujudger-base-0.1.cpp</a> (3.6 KB)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/ujudger-base-0-1-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>我的newwap</title>
		<link>http://blog.upsuper.org/my-newwap/</link>
		<comments>http://blog.upsuper.org/my-newwap/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 06:06:36 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[Discuz!]]></category>
		<category><![CDATA[WAP]]></category>
		<category><![CDATA[学校]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=77</guid>
		<description><![CDATA[学校的论坛一直以来人气都比不过贴吧，我个人分析原因有一定来自手机访问的方便性。说实话，DZ论坛原来那个WAP版我也觉得做的不怎么样，于是我就自己写！
已经写了一个有一点点功能的版本http://www.fzyz.cn/forum/newwap，但因为写得太乱了，于是重新大改，构成了这个正在做的版本http://www.fzyz.cn/forum/w。
DZ果然是一个逊霸，完全没有为后面开发做考虑…… Doggy 说WP在这点做的很好，不过我没写过WP的插件，不做评论。
]]></description>
			<content:encoded><![CDATA[<p>学校的论坛一直以来人气都比不过贴吧，我个人分析原因有一定来自手机访问的方便性。说实话，DZ论坛原来那个WAP版我也觉得做的不怎么样，于是我就自己写！</p>
<p>已经写了一个有一点点功能的版本<a href="http://www.fzyz.cn/forum/newwap">http://www.fzyz.cn/forum/newwap</a>，但因为写得太乱了，于是重新大改，构成了这个正在做的版本<a href="http://www.fzyz.cn/forum/w">http://www.fzyz.cn/forum/w</a>。</p>
<p>DZ果然是一个逊霸，完全没有为后面开发做考虑…… Doggy 说WP在这点做的很好，不过我没写过WP的插件，不做评论。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/my-newwap/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>2008 Upsuper生日邀请赛</title>
		<link>http://blog.upsuper.org/2008-upsuper-birthday-invitational/</link>
		<comments>http://blog.upsuper.org/2008-upsuper-birthday-invitational/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 13:51:12 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[NOIP]]></category>
		<category><![CDATA[生日]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=40</guid>
		<description><![CDATA[今年的生日举办的邀请赛各信息在这里归统一下。
题目：20080209.pdf (344.99KB)
解题报告： 20080209_solution.pdf (278.79KB)
测试数据：20080209_data.rar (357.12KB)
推荐时长：3 小时
题目难度：NOIP 级
]]></description>
			<content:encoded><![CDATA[<p>今年的生日举办的邀请赛各信息在这里归统一下。</p>
<p>题目：<a href="http://down.upsuper.org/20080209.pdf ">20080209.pdf</a> (344.99KB)</p>
<p>解题报告： <a href="http://down.upsuper.org/20080209_solution.pdf ">20080209_solution.pdf</a> (278.79KB)</p>
<p>测试数据：<a href="http://down.upsuper.org/20080209_data.rar">20080209_data.rar</a> (357.12KB)</p>
<p>推荐时长：3 小时</p>
<p>题目难度：NOIP 级</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/2008-upsuper-birthday-invitational/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>我们的Online Judge</title>
		<link>http://blog.upsuper.org/our-online-judge/</link>
		<comments>http://blog.upsuper.org/our-online-judge/#comments</comments>
		<pubDate>Sat, 13 Oct 2007 11:33:28 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[C/C++/C#]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Online Judge]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=27</guid>
		<description><![CDATA[和 MRain 开始编写我们信息组内部用的Online Judge。
这个Online Judge我准备做成类似Cena的网页版，准备使用PHP+MySQL+Apache+Windows2K3作为运行环境，AJAX做界面，C++程序做后台测评程序。采取类似USACO的提交立即测评，在线等待结果的测评方式。
现在我正在撰写文档，估计正式编写工作从下一周开始。
]]></description>
			<content:encoded><![CDATA[<p>和 MRain 开始编写我们信息组内部用的Online Judge。</p>
<p>这个Online Judge我准备做成类似Cena的网页版，准备使用PHP+MySQL+Apache+Windows2K3作为运行环境，AJAX做界面，C++程序做后台测评程序。采取类似USACO的提交立即测评，在线等待结果的测评方式。</p>
<p>现在我正在撰写文档，估计正式编写工作从下一周开始。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/our-online-judge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
