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

<channel>
	<title>云和云</title>
	<atom:link href="http://www.yunheyun.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.yunheyun.com</link>
	<description>Cloud~</description>
	<lastBuildDate>Wed, 30 Jun 2010 14:12:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>2010-06-30 雨人</title>
		<link>http://www.yunheyun.com/?p=248</link>
		<comments>http://www.yunheyun.com/?p=248#comments</comments>
		<pubDate>Wed, 30 Jun 2010 14:12:55 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[歌曲]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=248</guid>
		<description><![CDATA[全世界的颜色，全留在你那里

]]></description>
			<content:encoded><![CDATA[<p>全世界的颜色，全留在你那里<br />
<embed src="http://www.xiami.com/widget/0_375964/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=248</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>2010-03-21 here is a heart</title>
		<link>http://www.yunheyun.com/?p=244</link>
		<comments>http://www.yunheyun.com/?p=244#comments</comments>
		<pubDate>Sun, 21 Mar 2010 04:34:46 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[歌曲]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=244</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><embed src="http://www.xiami.com/widget/529242_3651717/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=244</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>豆瓣API之旅(2)</title>
		<link>http://www.yunheyun.com/?p=233</link>
		<comments>http://www.yunheyun.com/?p=233#comments</comments>
		<pubDate>Sun, 24 Jan 2010 09:44:12 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[豆瓣API之旅]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[douban]]></category>
		<category><![CDATA[豆瓣]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=233</guid>
		<description><![CDATA[查看上个版本我们会发现很多问题，比如：top3影片id是给定了的；第三部电影的导演名字居然叫2009-12-11……主演总是只有一个……
目标：展示豆瓣上热门的影片、音乐、书籍。比如给出影片的片名、图片、导演、主演、简介等。
本次目标：
1.给定3个影片id，正确的显示影片片名、图片、导演、主演、简介。
2.开发一个豆瓣API类库，编写QDoubanMovie类（对应一部电影）
这个豆瓣API库命名为qdbapi，使用google code托管这个项目
项目主页
关于google code的使用方法可以参考这里
本次版本效果
]]></description>
			<content:encoded><![CDATA[<p>查看<a href="http://yunheyun.com/db/20100119.php">上个版本</a>我们会发现很多问题，比如：top3影片id是给定了的；第三部电影的导演名字居然叫2009-12-11……主演总是只有一个……</p>
<p>目标：展示豆瓣上热门的影片、音乐、书籍。比如给出影片的片名、图片、导演、主演、简介等。</p>
<p>本次目标：<br />
1.给定3个影片id，正确的显示影片片名、图片、导演、主演、简介。<br />
2.开发一个豆瓣API类库，编写QDoubanMovie类（对应一部电影）</p>
<p>这个豆瓣API库命名为qdbapi，使用google code托管这个项目</p>
<p><a href="http://code.google.com/p/qdbapi/">项目主页</a></p>
<p>关于google code的使用方法可以<a href="http://xiejiangbo.javaeye.com/blog/501211">参考这里</a></p>
<p><a href="/db/20100124.php">本次版本效果</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=233</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>2010-01-22 make you own kind of music</title>
		<link>http://www.yunheyun.com/?p=230</link>
		<comments>http://www.yunheyun.com/?p=230#comments</comments>
		<pubDate>Fri, 22 Jan 2010 12:43:21 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[歌曲]]></category>
		<category><![CDATA[lost]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=230</guid>
		<description><![CDATA[lost里的一首插曲

]]></description>
			<content:encoded><![CDATA[<p>lost里的一首插曲<br />
<embed src="http://www.xiami.com/widget/529242_1167510/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=230</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>doubanclaim15cf0d92eb17f18d</title>
		<link>http://www.yunheyun.com/?p=226</link>
		<comments>http://www.yunheyun.com/?p=226#comments</comments>
		<pubDate>Wed, 20 Jan 2010 04:34:56 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=226</guid>
		<description><![CDATA[doubanclaim15cf0d92eb17f18d
]]></description>
			<content:encoded><![CDATA[<p>doubanclaim15cf0d92eb17f18d</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=226</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>豆瓣API之旅（1）</title>
		<link>http://www.yunheyun.com/?p=208</link>
		<comments>http://www.yunheyun.com/?p=208#comments</comments>
		<pubDate>Tue, 19 Jan 2010 14:10:15 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[豆瓣API之旅]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[豆瓣]]></category>
		<category><![CDATA[淘宝]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=208</guid>
		<description><![CDATA[这段时间闲来无事，于是想通过做点小东西自学一下php，mysql啥的。
最早关注的是淘宝API，现在先做一点豆瓣API来玩玩。
目标：展示豆瓣上热门的影片、音乐、书籍。比如给出影片的片名、图片、导演、主演、简介等。
本次目标：给定3个影片id，显示影片片名、图片、导演、主演、简介。
本次版本效果
本次用到的API

文件：
1）util.php 这是我从淘宝的phpdemo中提出来的一个文件，用来把json decode出来的对象转成数组
2)20100119.php 用户访问文件
3)JSON.php 一个json的php库，在这里你可以获得它的文件包
代码：
util.php 部分

1
2
3
4
5
6
7
8
9
10
11
function get_object_vars_final&#40;$obj&#41;&#123;
	if&#40;is_object&#40;$obj&#41;&#41;&#123;
		$obj=get_object_vars&#40;$obj&#41;;
	&#125;
	if&#40;is_array&#40;$obj&#41;&#41;&#123;
		foreach &#40;$obj as $key=&#62;$value&#41;&#123;
			$obj&#91;$key&#93;=get_object_vars_final&#40;$value&#41;;
		&#125;
	&#125;
	return $obj;
&#125;

20100119.php

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
&#60;?php
require_once 'JSON.php';
require_once 'util.php';
&#160;
&#160;
&#160;
$json = new Services_JSON&#40;&#41;;
$movieUrl = 'http://api.douban.com/movie/subject/';
$requestEnd = '?alt=json';
&#160;
$popularMovie = array&#40;'1652587', '3077791', '1892531'&#41;;
?&#62;
&#60;table border=&#34;1&#34; width=&#34;100%&#34;&#62;
	&#60;tr&#62;
		&#60;td align=&#34;center&#34;&#62;
			片名
		&#60;/td&#62;
		&#60;td align=&#34;center&#34;&#62;
			图片
		&#60;/td&#62;
		&#60;td align=&#34;center&#34;&#62;
			导演
		&#60;/td&#62;
		&#60;td align=&#34;center&#34;&#62;
			主演
		&#60;/td&#62;
		&#60;td align=&#34;center&#34;&#62;
			简介
		&#60;/td&#62;
	&#60;/tr&#62;
	&#60;?php
	foreach &#40;$popularMovie as $movie&#41; &#123;
		$contents = file_get_contents&#40;$movieUrl.$movie.$requestEnd&#41;;
		$value = $json-&#62;decode&#40;$contents&#41;;
		$contents = get_object_vars_final&#40;$value&#41;;
	?&#62;
	&#60;tr&#62;
		&#60;td align=&#34;center&#34;&#62;
			&#60;a href=&#60;?php echo $contents&#91;'link'&#93;&#91;1&#93;&#91;'@href'&#93;?&#62;&#62;&#60;?php echo $contents&#91;'title'&#93;&#91;'$t'&#93;;?&#62;&#60;/a&#62;
		&#60;/td&#62;
		&#60;td align=&#34;center&#34;&#62;
			&#60;img src=&#60;?php echo $contents&#91;'link'&#93;&#91;2&#93;&#91;'@href'&#93;?&#62; alt=&#34;pic from douban&#34;&#62;
		&#60;/td&#62;
		&#60;td align=&#34;center&#34;&#62;
			&#60;?php [...]]]></description>
			<content:encoded><![CDATA[<p>这段时间闲来无事，于是想通过做点小东西自学一下php，mysql啥的。</p>
<p>最早关注的是<a href="http://open.taobao.com/">淘宝API</a>，现在先做一点<a href="http://www.douban.com/service/apidoc/">豆瓣API</a>来玩玩。</p>
<p>目标：展示豆瓣上热门的影片、音乐、书籍。比如给出影片的片名、图片、导演、主演、简介等。</p>
<p>本次目标：给定3个影片id，显示影片片名、图片、导演、主演、简介。</p>
<p><a href="http://yunheyun.com/db/20100119.php">本次版本效果</a><br />
<a href="http://www.douban.com/service/apidoc/reference/subject#获取电影信息">本次用到的API</a><br />
<span id="more-208"></span><br />
文件：</p>
<p>1）util.php 这是我从淘宝的phpdemo中提出来的一个文件，用来把json decode出来的对象转成数组</p>
<p>2)20100119.php 用户访问文件</p>
<p>3)JSON.php 一个json的php库，在<a href="http://pear.php.net/pepr/pepr-proposal-show.php?id=198">这里</a>你可以获得它的文件包</p>
<p>代码：<br />
util.php 部分</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> get_object_vars_final<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$obj</span><span style="color: #339933;">=</span><span style="color: #990000;">get_object_vars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$obj</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>get_object_vars_final<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</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: #b1b100;">return</span> <span style="color: #000088;">$obj</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>20100119.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'JSON.php'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'util.php'</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #000088;">$json</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Services_JSON<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$movieUrl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://api.douban.com/movie/subject/'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$requestEnd</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'?alt=json'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$popularMovie</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'1652587'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'3077791'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1892531'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;table border=&quot;1&quot; width=&quot;100%&quot;&gt;
	&lt;tr&gt;
		&lt;td align=&quot;center&quot;&gt;
			片名
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			图片
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			导演
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			主演
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			简介
		&lt;/td&gt;
	&lt;/tr&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$popularMovie</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$movie</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$movieUrl</span><span style="color: #339933;">.</span><span style="color: #000088;">$movie</span><span style="color: #339933;">.</span><span style="color: #000088;">$requestEnd</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$json</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contents</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> get_object_vars_final<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;tr&gt;
		&lt;td align=&quot;center&quot;&gt;
			&lt;a href=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$contents</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'link'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'@href'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$contents</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'$t'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			&lt;img src=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$contents</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'link'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'@href'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span> alt=&quot;pic from douban&quot;&gt;
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$contents</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'author'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'$t'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$contents</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db:attribute'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'$t'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/td&gt;
		&lt;td align=&quot;center&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$contents</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'summary'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'$t'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/td&gt;
	&lt;/tr&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>
&lt;/table&gt;</pre></td></tr></table></div>

<p><a href="http://cid-d0d594c40f45dca5.skydrive.live.com/self.aspx/.Public/20100109.zip">代码下载</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=208</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[面对面]志愿者卢安克(2009.12.27)</title>
		<link>http://www.yunheyun.com/?p=204</link>
		<comments>http://www.yunheyun.com/?p=204#comments</comments>
		<pubDate>Fri, 01 Jan 2010 14:39:12 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[分享]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=204</guid>
		<description><![CDATA[什么是自由

]]></description>
			<content:encoded><![CDATA[<p>什么是自由<br />
<object width="420" height="363"><param name="movie" value="http://www.tudou.com/v/GQYNRULuD4s"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="opaque"></param><embed src="http://www.tudou.com/v/GQYNRULuD4s" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" width="420" height="363"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=204</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>2009-12-18 sing a song</title>
		<link>http://www.yunheyun.com/?p=201</link>
		<comments>http://www.yunheyun.com/?p=201#comments</comments>
		<pubDate>Mon, 28 Dec 2009 14:21:06 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[歌曲]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=201</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><embed src="http://www.xiami.com/widget/529242_1769244647/singlePlayer.swf" type="application/x-shockwave-flash" width="257" height="33" wmode="transparent"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=201</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>求N!的二进制表示中最低位1的位置</title>
		<link>http://www.yunheyun.com/?p=195</link>
		<comments>http://www.yunheyun.com/?p=195#comments</comments>
		<pubDate>Mon, 21 Dec 2009 14:44:17 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[代码]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=195</guid>
		<description><![CDATA[编程之美是这样讲的

1
2
3
4
5
6
7
8
9
10
int lowestOne&#40;int N&#41;
&#123;
    int Ret = 0;
    while&#40;N&#41;
   &#123;
        N &#62;&#62;= 1;
        Ret += N;
    &#125;
    return Ret;
&#125;

我的想法比较简单，利用位左移作，比如1010，左移3次就变成0了，所以要求的最低位1的位置 = 4 &#8211; 3
代码如下

1
2
3
4
5
6
7
8
9
10
11
12
13
#include &#60;stdio.h&#62;
#define INT_LENGTH (32)
int main&#40;void&#41;&#123;
	unsigned int [...]]]></description>
			<content:encoded><![CDATA[<p>编程之美是<a href="http://www.kuqin.com/algorithm/20080505/7874.html">这样讲的</a></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> lowestOne<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> N<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #993333;">int</span> Ret <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>N<span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
        N <span style="color: #339933;">&gt;&gt;=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
        Ret <span style="color: #339933;">+=</span> N<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> Ret<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>我的想法比较简单，利用位左移作，比如1010，左移3次就变成0了，所以要求的最低位1的位置 = 4 &#8211; 3<br />
代码如下</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#define INT_LENGTH (32)</span>
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #993333;">void</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">unsigned</span> <span style="color: #993333;">int</span> n<span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> count <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
	scanf<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%u&quot;</span><span style="color: #339933;">,</span> n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		n <span style="color: #339933;">&lt;&lt;=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
		count<span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;last 1 position = %d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> INT_LENGTH <span style="color: #339933;">-</span> count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=195</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>小红伞 升级代理</title>
		<link>http://www.yunheyun.com/?p=187</link>
		<comments>http://www.yunheyun.com/?p=187#comments</comments>
		<pubDate>Sun, 01 Nov 2009 11:34:30 +0000</pubDate>
		<dc:creator>yunheyun</dc:creator>
				<category><![CDATA[杀毒软件]]></category>
		<category><![CDATA[小红伞]]></category>

		<guid isPermaLink="false">http://www.yunheyun.com/?p=187</guid>
		<description><![CDATA[地址：upd.avira.net.cn
端口：808
代理设置方法参看这里：http://www.yunheyun.com/?p=142
注意：现在很多地区不用代理已可更新
]]></description>
			<content:encoded><![CDATA[<p>地址：upd.avira.net.cn<br />
端口：808<br />
代理设置方法参看这里：<a href="http://www.yunheyun.com/?p=142">http://www.yunheyun.com/?p=142</a><br />
注意：现在很多地区不用代理已可更新</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yunheyun.com/?feed=rss2&amp;p=187</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
