<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;D04NSH44fCp7ImA9WhRQEEo.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919</id><updated>2011-12-05T11:06:39.034+02:00</updated><category term="linux" /><category term="gfw" /><category term="tcp" /><category term="maemo" /><category term="qtwrt" /><category term="qml" /><category term="n900" /><category term="iphone" /><category term="webkit" /><category term="nokia" /><category term="javascript" /><category term="日人民报" /><category term="诺基亚" /><category term="security" /><category term="debian" /><category term="ssl" /><category term="skype" /><category term="qt" /><category term="ubuntu" /><category term="obs" /><category term="wpa" /><category term="rpm" /><category term="google" /><category term="chrome" /><title>Xizhi's Blog</title><subtitle type="html">Keep logging what I am interested in</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://xizhizhu.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Steven</name><uri>http://www.blogger.com/profile/00048765923674138164</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>33</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/heBM" /><feedburner:info uri="blogspot/hebm" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;D0MBRHY4eSp7ImA9WhZVFUw.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-5580778421495671275</id><published>2011-05-27T19:57:00.000+03:00</published><updated>2011-05-27T19:57:35.831+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-27T19:57:35.831+03:00</app:edited><title>Moving to new site: http://xzis.me/</title><content type="html">Now I got my new site up and working: &lt;a href="http://xzis.me/"&gt;http://xzis.me/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Hope the domain is easy to remember ;)&lt;br /&gt;
Meaning &lt;b&gt;X&lt;/b&gt;izhi &lt;b&gt;Z&lt;/b&gt;hu &lt;b&gt;IS ME&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-5580778421495671275?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kdPOq78T1DXw73aD4-K30I9JOvg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kdPOq78T1DXw73aD4-K30I9JOvg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/kdPOq78T1DXw73aD4-K30I9JOvg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kdPOq78T1DXw73aD4-K30I9JOvg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/iAT67kRJG8Y" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/5580778421495671275/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2011/05/moving-to-new-site-httpxzisme.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5580778421495671275?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5580778421495671275?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/iAT67kRJG8Y/moving-to-new-site-httpxzisme.html" title="Moving to new site: http://xzis.me/" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2011/05/moving-to-new-site-httpxzisme.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMMRHw7eip7ImA9WhZWGEQ.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-8021456142183035777</id><published>2011-05-20T15:27:00.001+03:00</published><updated>2011-05-20T15:28:05.202+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-20T15:28:05.202+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>根据国际法 PK 不要拿法律当挡箭牌</title><content type="html">这个是163上的一个&lt;a href="http://tech.163.com/11/0519/18/74EIHUHL000915BF.html"&gt;新闻&lt;/a&gt;。当姜瑜被问及百度公司和中国政府因为网络消息屏蔽被纽约居民起诉时，义正词严的表示：中国政府鼓励和支持互联网发展，依法保障中国公民言论自由。中国政府依法管理互联网符合国际通行做法，属于主权行为，根据国际法，外国法院没有管辖权。&lt;br /&gt;
&lt;br /&gt;
哦，这个时候提及国际法了啊！难道你老人家忘记前不久的至理名言了吗？“&lt;a href="http://opinion.news.chengdu.cn/content/2011-03/04/content_654807.htm?node=389"&gt;不要拿法律当挡箭牌&lt;/a&gt;”啊！&lt;br /&gt;
&lt;br /&gt;
看完内容就得看&lt;a href="http://comment.tech.163.com/tech_bbs/74EIHUHL000915BF.html"&gt;评论&lt;/a&gt;嘛！到目前为止，有850人参与，跟贴218条，却仅仅显示了四条回复。这个嘛，这个，这个，这个......&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-gXjXpsYenvc/TdZbqZeNwwI/AAAAAAAADnE/mrzRHjC5lVs/s1600/1.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="291" width="320" src="http://3.bp.blogspot.com/-gXjXpsYenvc/TdZbqZeNwwI/AAAAAAAADnE/mrzRHjC5lVs/s320/1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-8021456142183035777?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/j-8hNed3m_4XM9LZ9bqnhbykPYU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j-8hNed3m_4XM9LZ9bqnhbykPYU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/j-8hNed3m_4XM9LZ9bqnhbykPYU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j-8hNed3m_4XM9LZ9bqnhbykPYU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/pFC7agMEFoE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/8021456142183035777/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2011/05/blog-post.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/8021456142183035777?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/8021456142183035777?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/pFC7agMEFoE/blog-post.html" title="根据国际法 PK 不要拿法律当挡箭牌" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-gXjXpsYenvc/TdZbqZeNwwI/AAAAAAAADnE/mrzRHjC5lVs/s72-c/1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2011/05/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEMQH8-fCp7ImA9WhZXEEw.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-4290246670371260076</id><published>2011-04-28T20:44:00.000+03:00</published><updated>2011-04-28T20:44:41.154+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-28T20:44:41.154+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rpm" /><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="debian" /><category scheme="http://www.blogger.com/atom/ns#" term="obs" /><title>Create Debian and RPM packages using OBS</title><content type="html">Have you ever tried to create both Debian and RPM packages using &lt;a href="https://build.opensuse.org/"&gt;OBS&lt;/a&gt;? Well, a little bit different from the package generation locally, but not that much ;)&lt;br /&gt;
&lt;br /&gt;
Before continuing, you should prepare yourself with basic &lt;a href="http://www.debian.org/doc/maint-guide/index.en.html"&gt;Debian&lt;/a&gt; and &lt;a href="http://en.opensuse.org/openSUSE:Packaging_guidelines"&gt;RPM&lt;/a&gt; packaging knowledge.&lt;br /&gt;
&lt;br /&gt;
First, make a tar-ball for your source code, without any packaging information inside. Name it &lt;i&gt;obs-sample.tar.gz&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
Then for &lt;b&gt;Debian packaging&lt;/b&gt;, you need the following files.&lt;br /&gt;
obs-sample_1.0.dsc: indicating you want to create a Debian package; the &lt;i&gt;Files&lt;/i&gt; section is not needed, but the &lt;i&gt;Build-Depends&lt;/i&gt; section is necessary.&lt;br /&gt;
debian.rules: the &lt;i&gt;rules&lt;/i&gt; file for Debianization.&lt;br /&gt;
debian.control: the &lt;i&gt;control&lt;/i&gt; file for Debianization.&lt;br /&gt;
debian.tar.gz: all the other files inside the &lt;i&gt;debian&lt;/i&gt; folder.&lt;br /&gt;
&lt;br /&gt;
For &lt;b&gt;RPM packaging&lt;/b&gt;, you only need the .spec file as expected.&lt;br /&gt;
&lt;br /&gt;
Finally, here goes &lt;a href="https://build.opensuse.org/package/show?package=sample&amp;project=home%3Axizzhu"&gt;the simple sample&lt;/a&gt; I created. Happy hacking!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-4290246670371260076?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/K3ppXzKSZDo0dKSSYXx1WjxV01c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K3ppXzKSZDo0dKSSYXx1WjxV01c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/K3ppXzKSZDo0dKSSYXx1WjxV01c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K3ppXzKSZDo0dKSSYXx1WjxV01c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/v3Xab5iURC4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/4290246670371260076/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2011/04/create-debian-and-rpm-packages-using.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4290246670371260076?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4290246670371260076?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/v3Xab5iURC4/create-debian-and-rpm-packages-using.html" title="Create Debian and RPM packages using OBS" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2011/04/create-debian-and-rpm-packages-using.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEMSXgzcSp7ImA9WhZTF08.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-5652187455698320766</id><published>2011-03-21T18:45:00.001+02:00</published><updated>2011-03-21T18:58:08.689+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-21T18:58:08.689+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>利比亚的故事</title><content type="html">联合国安理会在3月17日通过&lt;a href="http://www.un.org/chinese/aboutun/prinorgs/sc/sres/2011/s1973.htm"&gt;1973号决议&lt;/a&gt;，对利比亚实施禁飞，并授权采取一切必要措施保护平民和平民居住区免受武装袭击的威胁。&lt;br /&gt;
&lt;br /&gt;
3月18日，利比亚外长穆萨·库萨&lt;a href="http://www.bjd.com.cn/10yw/201103/t20110319_666737.html"&gt;宣布&lt;/a&gt;，利比亚接受联合国安理会有关在利比亚设立禁飞区的决议，立即停火并停止所有军事行动。&lt;br /&gt;
&lt;br /&gt;
3月19日，利比亚政府军&lt;a href="http://news.qq.com/a/20110319/000902.htm"&gt;进攻&lt;/a&gt;反对派大本营班加西，卡扎菲则&lt;a href="http://news.163.com/11/0320/02/6VIBS74J00014AED.html"&gt;表示&lt;/a&gt;联合国安理会的决议无效（&lt;span class="Apple-style-span" style="color: red;"&gt;这条新闻在国内媒体的报道几乎都是一笔带过，很少提及&lt;/span&gt;）。随后，国际社会&lt;a href="http://bundpic.news365.com.cn/yw/201103/t20110320_2988087.htm"&gt;开始&lt;/a&gt;了对利比亚的军事干预。&lt;br /&gt;
&lt;br /&gt;
此后，卡扎菲&lt;a href="http://news.163.com/11/0321/03/6VKVFB8O00014AED.html"&gt;表示&lt;/a&gt;将打开军火库以武装所有民众，打一场持久战。&lt;br /&gt;
&lt;br /&gt;
3月20日，利比亚武装部队发言人法格希&lt;a href="http://news.163.com/11/0321/04/6VL4Q15H00014JB5.html"&gt;宣布&lt;/a&gt;，利比亚政府军于当地时间20日晚9时起执行全面停火，并停止在利比亚境内的一切军事行动。&lt;br /&gt;
&lt;br /&gt;
不放回顾一下早些时候卡扎菲的伟大讲话......&lt;br /&gt;
2月24日，卡扎菲在电视讲话中&lt;a href="http://news.ifeng.com/world/special/zhongdongbianju/content-2/detail_2011_02/24/4843356_0.shtml"&gt;表示&lt;/a&gt;基地组织是现在利比亚危机的幕后策划者。&lt;br /&gt;
&lt;br /&gt;
3月8日，卡扎菲&lt;a href="http://news.21cn.com/world/guojisaomiao/2011/03/11/8166397.shtml"&gt;表示&lt;/a&gt;如果西方设立“禁飞区”逼得太紧，他将与基地组织联手。&lt;br /&gt;
&lt;br /&gt;
末了再来对比一下这几条被&lt;span class="Apple-style-span" style="color: red;"&gt;国内媒体一笔带过或是干脆不报&lt;/span&gt;的新闻......&lt;br /&gt;
2月22日，卡扎菲援引六四事件为自己&lt;a href="http://www.bbc.co.uk/zhongwen/simp/world/2011/02/110222_brief_gaddafi_tiananmen.shtml"&gt;辩护&lt;/a&gt;，电视讲话中说，北京的学生在天安门抗议了好几天，中国领导人然后派坦克进入，把学生摧毁、铲除。&lt;br /&gt;
&lt;br /&gt;
2月23日，利比亚飞行员不愿屠杀平民，拒绝执行&lt;a href="http://www.worldjournal.com/view/full_news/11547632/article-%E6%A0%BC%E9%81%94%E8%B2%BB%E6%88%B0%E6%A9%9F%E8%BD%9F%E7%BE%A4%E7%9C%BE-%E6%BD%98%E5%9F%BA%E6%96%87%E9%9C%87%E6%80%92?instance=hota"&gt;卡扎菲轰炸班加西的命令&lt;/a&gt;而&lt;a href="http://article.yeeyan.org/view/192520/175271"&gt;弃机跳伞&lt;/a&gt;。&lt;br /&gt;
&lt;br /&gt;
3月21日，英国空军因在攻击区域发现有平民存在而&lt;a href="http://news.sina.com.cn/w/2011-03-21/151622153857.shtml"&gt;放弃&lt;/a&gt;了攻击任务。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-5652187455698320766?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3xLRWKhenFyeSSdU7Z9DZVrwI9g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3xLRWKhenFyeSSdU7Z9DZVrwI9g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3xLRWKhenFyeSSdU7Z9DZVrwI9g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3xLRWKhenFyeSSdU7Z9DZVrwI9g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/EQvAwMpnrzs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/5652187455698320766/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2011/03/blog-post.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5652187455698320766?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5652187455698320766?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/EQvAwMpnrzs/blog-post.html" title="利比亚的故事" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2011/03/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8BQXo_cCp7ImA9Wx9WE0s.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-3605062630006246911</id><published>2011-01-18T17:00:00.000+02:00</published><updated>2011-01-18T17:00:50.448+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-18T17:00:50.448+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>收费公路养活了多少人？</title><content type="html">&lt;a href="http://news.qq.com/zt2011/368w/"&gt;368万天价过路费的事&lt;/a&gt;我就不多说了，大家心里都明白。和谐，要和谐啊，莫非要像突尼斯人民一样&lt;a href="http://news.sina.com.cn/o/2011-01-18/141921834039.shtml"&gt;让总统飞&lt;/a&gt;不成？当然了，和谐是和谐，自家的糊涂账是得更忽悠一些的，所以交通运输部副部长翁孟勇就出来&lt;a href="http://news.163.com/11/0118/12/6QM94BBT00014AEE.html"&gt;澄清&lt;/a&gt;了嘛：&lt;br /&gt;
&lt;blockquote&gt;我们已经在17个省全部取消了政府还贷的二级公路收费站点，撤销站点&lt;b&gt;1723个&lt;/b&gt;，总里程&lt;b&gt;9万公里&lt;/b&gt;，这其中解决了&lt;b&gt;40万人&lt;/b&gt;过去收费和征稽人员的分流安置工作&lt;/blockquote&gt;算一算，光是这么些个二级公路，每个收费站养活了&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;232&lt;/b&gt;&lt;/span&gt;个人，每公里更是养活了&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;4.4&lt;/span&gt;&lt;/b&gt;个人，厉害啊！&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-3605062630006246911?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Lvwc84IVusgwCBeBTZ8H1cmpYEc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Lvwc84IVusgwCBeBTZ8H1cmpYEc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Lvwc84IVusgwCBeBTZ8H1cmpYEc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Lvwc84IVusgwCBeBTZ8H1cmpYEc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/QgHMcVltHB8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/3605062630006246911/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2011/01/blog-post.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/3605062630006246911?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/3605062630006246911?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/QgHMcVltHB8/blog-post.html" title="收费公路养活了多少人？" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2011/01/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMEQX4zeyp7ImA9Wx9RE04.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-6746354276529969310</id><published>2010-12-11T12:57:00.004+02:00</published><updated>2010-12-14T14:40:00.083+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-14T14:40:00.083+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>我最崇拜的人姓刘</title><content type="html">所有内容摘自互联网，感谢各位网友的原创！持续更新中;)&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，他获得过国际大奖，他的所作所为激发了国人的斗志，虽然有一段时间他从我们眼前消失了，但是我相信他的精神永存。他的名字叫刘翔。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，他领导过学生闹学运，出过书，得过外国的奖，后来被冤枉做了很多年牢。但我相信，这些都是历史给他的考验，因为他说过，好在历史是人民写的。他的名字是刘少奇。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘。他是个博士，他出过书、当过被告。得过西方很多国家的大奖，以及香港台湾等境外组织颁发的奖。他是很多中国人的偶像，他是中国人的自豪和骄傲。他叫刘德华！&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，ta面对暴力无所畏惧，坚定信仰自己的理念。尽管ta早早地被强权迫害，但ta的名字直到今天仍在流传。ta是刘胡兰。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，出过书，获得过国际大奖，用多年的拼搏和追求向世界展示国人的无悔青春，虽然有一段时间住过牢，但是我相信特不会为此而向命运屈服。特的名字是刘晓庆。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，他获得了世界性的奖项，因为他的推手技惊全球以至于不得不说：我没有敌人。有时候面对记者会结结巴巴，他一度消失在人们的视野。整个世界都经常默念他的名字：国家的未来栋梁！他的名字叫刘国梁。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，他十几年如一日，忍辱负重，勤奋耕耘，从一个东北土鳖成长为亿万人瞩目的理性楷模。他致力于一个理想化的行动，让自己备受磨难，但人们心里为他树起了一座丰碑，他的名字叫刘老根儿。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人他姓刘，他一生传奇，80年代就名扬国际，热衷挑战强拳，获得过无数国际大奖。他的一生没有敌人。他就是拳王刘易斯。&lt;br /&gt;
&lt;br /&gt;
我崇拜的人姓刘，从80年代开始就写出了一系列传世佳作，在一代又一代爱好自由的人手中传颂。尽管关于他的作品有一些争议，但好无偏见的说他的文字影响和改变了很多推友。他就是刘欣慈。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，他获得过很多境外组织的奖杯，他的作品流行海内外，他忠厚的面貌总是让人感到亲切，他也很关心缅甸昂山阿姨的情况，他的名字叫刘青云。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，他以人性化的实践，经历和见证了封建小农经济下个人良心的最大发挥。他清白而廉洁，但却历经诬陷，一个好人被钉在耻辱里，体现了专制政权的强横与无耻。然而，他被人传颂为良知的化身和尊严的维护者。他的名字叫刘文彩。&lt;br /&gt;
&lt;br /&gt;
我不崇拜的人姓刘，他某年因为因为被央视现场报道使用幕后黑手欺骗全国人民而一举闻名。他荣获过那个领域的国际大奖，他的成就可以说在中国没有敌人。网上关于他的争议一直很多，不过丝毫不影响他的影响力。他就魔术师刘谦。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，ta是一个东北人，ta于1989年春夏之交正式登上历史舞台，ta在世界上拥有极高的声望，ta就是我国著名游泳运动员刘子歌。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，他为了反抗强权暴政忍辱负重，尽管他有很多先天缺陷，但是仍然不能阻止他成为时代的领袖，他的名字刘邦。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，虽然我没有见过他，但他一直为大家的幸福生活在默默的努力。现在越来越多的人知道他喜欢他的作品，甚至还有人盗版他的东西冒充来卖，这是一件好事，他叫刘一手。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，Ta和Ta的同志们为了自由和人权与专制进行了不懈的斗争，Ta用自身惨痛的牺牲证明了专制的残暴，人们铭记着Ta的事迹，专制却从学校课本里把Ta的名字拿走，Ta的名字叫刘和珍。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，每当我觉得社会太黑暗、生活得太辛苦要放弃时，脑海中出现ta的身影又让我重燃斗志。ta是刘亦菲。&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘。念过大学，刚正不阿，曾被当权者剥夺工作，中年后又被关入监狱。每个中国人都应该记住他的名字。他叫刘墉！&lt;br /&gt;
&lt;br /&gt;
我最崇拜的人姓刘，ta很早就被黑恶势力打压，登上封面，影响很坏，因此消失了很长时间，但是最近ta又出来了，还获得了很多奖项，跟影帝结合了，ta叫刘嘉玲。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-6746354276529969310?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Y8bWpqRt9uWQgRCgAeSFZJeGrto/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y8bWpqRt9uWQgRCgAeSFZJeGrto/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Y8bWpqRt9uWQgRCgAeSFZJeGrto/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y8bWpqRt9uWQgRCgAeSFZJeGrto/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/yn1BXXus3hs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/6746354276529969310/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/12/blog-post.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/6746354276529969310?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/6746354276529969310?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/yn1BXXus3hs/blog-post.html" title="我最崇拜的人姓刘" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/12/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4ASHY4fCp7ImA9Wx9SF0w.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-1736826348128104037</id><published>2010-12-07T11:25:00.000+02:00</published><updated>2010-12-07T11:25:49.834+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-07T11:25:49.834+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="qt" /><title>The Beauty of Qt 3: Implicit Sharing</title><content type="html">To maximize resource usage and minimize copying, Qt uses &lt;a href="http://doc.qt.nokia.com/implicit-sharing.html"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;implicit data sharing&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/a&gt; in many classes, so that the data is copied &lt;b&gt;only when&lt;/b&gt; a function writes to it. This trick is also referred to as &lt;a href="http://en.wikipedia.org/wiki/Flyweight_pattern"&gt;flyweight pattern&lt;/a&gt; sometimes.&lt;br /&gt;
&lt;br /&gt;
Now let's take &lt;i&gt;QByteArray&lt;/i&gt; as an example to see &lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;b&gt;how it's implemented&lt;/b&gt;&lt;/span&gt;. It uses a private struct of &lt;i&gt;Data&lt;/i&gt; to track the shared data:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;struct Data {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;QBasicAtomicInt ref; // reference count, the operation on it is atomic&lt;br /&gt;
&amp;nbsp;&amp;nbsp;int alloc; // allocated space for the data&lt;br /&gt;
&amp;nbsp;&amp;nbsp;int size; // actual size of the data, not counting the ending '\0' added by QByteArray&lt;br /&gt;
&amp;nbsp;&amp;nbsp;char *data; // point to the data&lt;br /&gt;
&amp;nbsp;&amp;nbsp;char array[1]; // where the data is stored, and the data always end with '\0'&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Here, we use both the pointer of &lt;i&gt;data&lt;/i&gt; and &lt;i&gt;array&lt;/i&gt; just because the data might actually be stored in another object. When an object is copied, e.g. through the assignment operator, it only copies the pointer to the shared data:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;QByteArray &amp;amp;QByteArray::operator=(const QByteArray &amp;amp; other)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// increase the reference count of the shared data it's supposed to be used&lt;br /&gt;
&amp;nbsp;&amp;nbsp;other.d-&amp;gt;ref.ref();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// decrease the reference count of the share data currently used, and free it if no one else is using&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (!d-&amp;gt;ref.deref())&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qFree(d);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// point to the shared data&lt;br /&gt;
&amp;nbsp;&amp;nbsp;d = other.d;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;return *this;&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
On the other hand, if it's to be changed by e.g. the &lt;i&gt;resize()&lt;/i&gt; function, it copies the data if any other object also shares it:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;void QByteArray::resize(int size)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (size &amp;lt;= 0) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// if the target is no bigger than 0, points to an empty data block&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Data *x = &amp;amp;shared_empty;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x-&amp;gt;ref.ref();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (!d-&amp;gt;ref.deref())&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qFree(d);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d = x;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;} else if (d == &amp;amp;shared_null) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// if currently a null array, just create a new data block&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Data *x = static_cast&amp;lt;data *&amp;gt;(qMalloc(sizeof(Data)+size));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Q_CHECK_PTR(x);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x-&amp;gt;ref = 1;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x-&amp;gt;alloc = x-&amp;gt;size = size;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x-&amp;gt;data = x-&amp;gt;array;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x-&amp;gt;array[size] = '\0';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(void) d-&amp;gt;ref.deref();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d = x;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;} else {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// if any other object uses this data block, or the current memory is too small or too big&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// reallocate space, and copy the data for it&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// note that this operation might consume some time if the data is huge&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (d-&amp;gt;ref != 1 || size &amp;gt; d-&amp;gt;alloc || (size &amp;lt; d-&amp;gt;size &amp;amp;&amp;amp; size &amp;lt; d-&amp;gt;alloc &amp;gt;&amp;gt; 1))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;realloc(qAllocMore(size, sizeof(Data)));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (d-&amp;gt;alloc &amp;gt;= size) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d-&amp;gt;size = size;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (d-&amp;gt;data == d-&amp;gt;array) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d-&amp;gt;array[size] = '\0';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
With this in mind, let's see how to use &lt;i&gt;QSharedData&lt;/i&gt; and &lt;i&gt;QSharedDataPointer&lt;/i&gt; to &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;implement our own&lt;/span&gt;&lt;/b&gt; implicit shared data objects.&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;// first implement your data object inheriting from QSharedData, which provides the reference count&lt;br /&gt;
class SharedData: public QSharedData&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;SharedData()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;: QSharedData()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, var(0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;SharedData(const SharedData &amp;other)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;: QSharedData(other)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;, var(other.var)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;int var;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// then the data owner&lt;br /&gt;
class DataOwner&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;DataOwner()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;: d(new SharedData)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;DataOwner(int var)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;: d(new SharedData)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// for write access, the -&amp;gt; operator will automatically copy the shared data if needed&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;d-&amp;gt;var = var;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// this template class hides all the details for implicit sharing&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// therefore, no need to provide copy constructor or assignment operator&lt;br /&gt;
&amp;nbsp;&amp;nbsp;QSharedDataPointer&amp;lt;SharedData&amp;gt; d;&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Quite simple, right ;) Then just proceed to implement explicit shared data objects using &lt;i&gt;QExplicitlySharedDataPointer&lt;/i&gt; yourself.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-1736826348128104037?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/peafdDmyVYiyCFdJPewSV1EcQWA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/peafdDmyVYiyCFdJPewSV1EcQWA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/peafdDmyVYiyCFdJPewSV1EcQWA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/peafdDmyVYiyCFdJPewSV1EcQWA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/hSQwpw6PvrQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/1736826348128104037/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/12/beauty-of-qt-3-implicit-sharing.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/1736826348128104037?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/1736826348128104037?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/hSQwpw6PvrQ/beauty-of-qt-3-implicit-sharing.html" title="The Beauty of Qt 3: Implicit Sharing" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/12/beauty-of-qt-3-implicit-sharing.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQBRnk7cCp7ImA9Wx9SEkU.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-4459948189466394895</id><published>2010-12-01T13:56:00.001+02:00</published><updated>2010-12-02T12:55:57.708+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-02T12:55:57.708+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="qt" /><title>The Beauty of Qt 2: Meta Object</title><content type="html">Besides the &lt;a href="http://xizhizhu.blogspot.com/2010/11/beauty-of-qt-1-d-pointer-private.html"&gt;D-pointers&lt;/a&gt;, another interesting thing in Qt is the &lt;i&gt;&lt;b&gt;Q_OBJECT&lt;/b&gt;&lt;/i&gt; macro. It provides the access to meta objects, which enables you to enjoy more features of a &lt;i&gt;QObject&lt;/i&gt;, e.g. signals and slots. The &lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;meta object&lt;/span&gt;&lt;/b&gt;&lt;/span&gt; provides information about class name, properties and methods of a QObject, which is also known as &lt;a href="http://en.wikipedia.org/wiki/Reflection_(computer_science)"&gt;reflection&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Using &lt;i&gt;QMetaObject&lt;/i&gt;, you can print the information of the class name, etc.:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;QObject obj;&lt;br /&gt;
const QMetaObject *metaObj = obj.metaObject();&lt;br /&gt;
qDebug() &amp;lt;&amp;lt; "class name: " &amp;lt;&amp;lt; metaObj-&amp;gt;className();&lt;br /&gt;
qDebug() &amp;lt;&amp;lt; "class info count: " &amp;lt;&amp;lt; metaObj-&amp;gt;classInfoCount();&lt;br /&gt;
qDebug() &amp;lt;&amp;lt; "methods: ";&lt;br /&gt;
// starting from QMetaObject::methodOffset() so it won't display the methods inherited&lt;br /&gt;
for (int i = metaObj-&amp;gt;methodOffset(); i &amp;lt; metaObj-&amp;gt;methodCount(); ++i)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;qDebug() &amp;lt;&amp;lt; metaObj-&amp;gt;method(i).methodType() &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; metaObj-&amp;gt;method(i).signature();&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
As none of these information is supported in pure C++, Qt uses the &lt;a href="http://doc.trolltech.com/moc.html"&gt;Meta Object Compiler&lt;/a&gt; (moc) to do all the tricks. It reads each header file, and generates a C++ source file (moc_*.cpp) containing the code for meta-object, if it finds a &lt;i&gt;Q_OBJECT&lt;/i&gt; macro used in any class declaration. With the code generation approach, Qt not only gains the &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;flexibility&lt;/span&gt;&lt;/b&gt; as in e.g. Java, but also keeps the &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;performance and scalability&lt;/span&gt;&lt;/b&gt; as in C++.&lt;br /&gt;
&lt;br /&gt;
Suppose we have the following simple class:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;class MyObject : public QObject&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;explicit MyObject(QObject *parent = 0);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void myFunc();&lt;br /&gt;
&lt;br /&gt;
public slots:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void mySlot(int myParam);&lt;br /&gt;
&lt;br /&gt;
signals:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void mySignal(int myParam);&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
The following code / information will be generated by moc, and can be retrieved through pointers defined in the anonymous struct of &lt;i&gt;QMetaObject::d&lt;/i&gt;:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;// pointed by QMetaObject::d.data, the beginning stored "as" a QMetaObjectPrivate struct&lt;br /&gt;
static const uint qt_meta_data_MyObject[] = {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;5,       // revision, the internals have been changed several times&lt;br /&gt;
&amp;nbsp;&amp;nbsp;0,       // classname, offset of qt_meta_stringdata_MyObject&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// the following are defined as (number, index) pair&lt;br /&gt;
&amp;nbsp;&amp;nbsp;0,    0, // classinfo&lt;br /&gt;
&amp;nbsp;&amp;nbsp;2,   14, // we have two methods, starting at index 14 (i.e. the signal)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;0,    0, // properties&lt;br /&gt;
&amp;nbsp;&amp;nbsp;0,    0, // enums/sets&lt;br /&gt;
&amp;nbsp;&amp;nbsp;0,    0, // constructors&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;0,       // flags&lt;br /&gt;
&amp;nbsp;&amp;nbsp;1,       // signal counts&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// for signals slots, and properties, the signatures and parameters are offset of qt_meta_stringdata_MyObject&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// signals: signature, parameters, type, tag, flags&lt;br /&gt;
&amp;nbsp;&amp;nbsp;18,   10,    9,    9, 0x05,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// slots: signature, parameters, type, tag, flags&lt;br /&gt;
&amp;nbsp;&amp;nbsp;32,   10,    9,    9, 0x0a,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;0        // eod&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// pointed by QMetaObject::d.stringdata&lt;br /&gt;
static const char qt_meta_stringdata_MyObject[] = {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;"MyObject\0\0myParam\0mySignal(int)\0"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;"mySlot(int)\0"&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
The above information, as well as the information for its base class, is stored as the static meta object for this class:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;const QMetaObject MyObject::staticMetaObject = {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{ &amp;amp;QObject::staticMetaObject, // pointer to its base class, stored at QMetaObject::d.superdata&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qt_meta_stringdata_MyObject, qt_meta_data_MyObject, 0 }&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
In this way, if you want to do type cast for &lt;i&gt;QObject&lt;/i&gt;, instead of using the somewhat expensive operator of &lt;i&gt;dynamic_cast&lt;/i&gt;, we can use &lt;i&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;qobject_cast&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;. It exploits the benefits of the meta object system, thus avoiding the runtime type cast:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;template &amp;lt;class T&amp;gt; inline T qobject_cast(QObject *object)&lt;br /&gt;
{&lt;br /&gt;
#if !defined(QT_NO_QOBJECT_CHECK)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;reinterpret_cast&lt;t&gt;(0)-&amp;gt;qt_check_for_QOBJECT_macro(*reinterpret_cast&lt;t&gt;(object));&lt;br /&gt;
#endif&lt;br /&gt;
&amp;nbsp;&amp;nbsp;return static_cast&lt;t&gt;(reinterpret_cast&lt;t&gt;(0)-&amp;gt;staticMetaObject.cast(object));&lt;br /&gt;
}&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Here, the trick is that the &lt;i&gt;QMetaObject&lt;/i&gt; of the target type checks if the object inherits from it:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;const QObject *QMetaObject::cast(const QObject *obj) const&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (obj) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;const QMetaObject *m = obj-&amp;gt;metaObject();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;do {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (m == this)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return obj;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} while ((m = m-&amp;gt;d.superdata));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;return 0;&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Also, moc will generate some code for each &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;signal&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;. Whenever a signal is emitted, this function will be called internally:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;void MyObject::mySignal(int _t1)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void *_a[] = { 0, const_cast&amp;lt;void*&amp;gt;(reinterpret_cast&amp;lt;const void*&amp;gt;(&amp;amp;_t1)) };&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// it checks all the connected slots, and call each of them based on the connection type&lt;br /&gt;
&amp;nbsp;&amp;nbsp;QMetaObject::activate(this, &amp;amp;staticMetaObject, 0, _a);&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
In the end, the slots are invoked by the generated &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;qt_metacall&lt;/span&gt;&lt;/span&gt;&lt;/b&gt; function:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;int MyObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// if this function is called by the super class, just return&lt;br /&gt;
&amp;nbsp;&amp;nbsp;_id = QObject::qt_metacall(_c, _id, _a);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (_id &amp;lt; 0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return _id;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// call the function based on its ID&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (_c == QMetaObject::InvokeMetaMethod) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch (_id) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 0: mySignal((*reinterpret_cast&amp;lt; int(*)&amp;gt;(_a[1]))); break;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 1: mySlot((*reinterpret_cast&amp;lt; int(*)&amp;gt;(_a[1]))); break;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default: ;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// remove the IDs "consumed" by this class so that in its subclass the ID always starts with 0, and the return value of -1 means already consumed&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_id -= 2;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;return _id;&lt;br /&gt;
}&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-4459948189466394895?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mbRR9SIW2voTZhEtHkD5pzcOi_s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mbRR9SIW2voTZhEtHkD5pzcOi_s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/mbRR9SIW2voTZhEtHkD5pzcOi_s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mbRR9SIW2voTZhEtHkD5pzcOi_s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/itzzsOCsjjc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/4459948189466394895/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/12/beauty-of-qt-2-meta-object.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4459948189466394895?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4459948189466394895?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/itzzsOCsjjc/beauty-of-qt-2-meta-object.html" title="The Beauty of Qt 2: Meta Object" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/12/beauty-of-qt-2-meta-object.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcNQ3czeSp7ImA9Wx9TGU4.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-9087287032985460997</id><published>2010-11-28T10:31:00.000+02:00</published><updated>2010-11-28T10:31:32.981+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-28T10:31:32.981+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>渭南电视台台长街头被杀</title><content type="html">继山西一对住高档住宅区的警察夫妇&lt;a href="http://xizhizhu.blogspot.com/2010/11/blog-post_17.html"&gt;被杀&lt;/a&gt;之后，陕西又出了一起《&lt;a href="http://news.gd.sina.com.cn/news/2010/11/28/1056613.html"&gt;渭南电视台台长街头被杀&lt;/a&gt;》事件。&lt;br /&gt;
&lt;blockquote&gt;据渭南市120急救中心工作人员介绍，该中心接到指令后赶到现场，发现一中年男性趴卧在地上，受害者身下有大量血迹，&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;胸部中一刀致命&lt;/b&gt;&lt;/span&gt;，当时已无生命体征。受害者遗体旁停着一辆墨绿色&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;b&gt;丰田普拉多越野车&lt;/b&gt;&lt;/span&gt;，车门开着。&lt;br /&gt;
&lt;br /&gt;
遇害者是渭南市文化新闻出版与广播电视局副局长兼渭南电视台台长安荣。&lt;br /&gt;
&lt;br /&gt;
警方一人士透露，在凶案现场，民警发现受害者身上手机、财物均在，初步分析&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;b&gt;不可能是劫掠财物&lt;/b&gt;&lt;/span&gt;。&lt;/blockquote&gt;然后又在网上发现他的&lt;a href="http://roll.sohu.com/20101128/n300616682.shtml"&gt;简历&lt;/a&gt;：&lt;br /&gt;
&lt;blockquote&gt;安荣，&lt;b&gt;1962年出生&lt;/b&gt;，&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;研究生学历&lt;/b&gt;&lt;/span&gt;，中共党员，现任渭南市文广局副局长兼渭南电视台台长。&lt;b&gt;1979年至1981年&lt;/b&gt;在大荔县工作。&lt;b&gt;1985&lt;/b&gt;调任渭南市民政局科长，&lt;b&gt;1997年&lt;/b&gt;至今分别出任渭南市广电局纪检组长、副局长兼渭南电视台台长职务。&lt;/blockquote&gt;这哥们17岁开始工作，啥时候拿到的研究生文凭呢？不知道是和太子爷一样的学历，还是西太平洋大学的硕士呢？&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-9087287032985460997?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1LEtfoLwsnuy6bRf7k50fEGl4x4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1LEtfoLwsnuy6bRf7k50fEGl4x4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1LEtfoLwsnuy6bRf7k50fEGl4x4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1LEtfoLwsnuy6bRf7k50fEGl4x4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/spV0PZJdJQw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/9087287032985460997/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/11/blog-post_28.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/9087287032985460997?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/9087287032985460997?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/spV0PZJdJQw/blog-post_28.html" title="渭南电视台台长街头被杀" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/11/blog-post_28.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0ECRn04cSp7ImA9Wx9TF0w.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-2328752462306018613</id><published>2010-11-25T21:01:00.000+02:00</published><updated>2010-11-25T21:01:07.339+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-25T21:01:07.339+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="qt" /><title>The Beauty of Qt 1: D-Pointer / Private Implementation</title><content type="html">I believe many of you who just start reading the &lt;a href="http://qt.gitorious.org/"&gt;source code&lt;/a&gt; of Qt will have the question: why Qt uses those private classes? What's the benefit of such a design pattern? Well, the most significant reason is to &lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;keep the binary compatibility&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Then what is binary compatibility? The &lt;a href="http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B"&gt;article&lt;/a&gt; from KDE TechBase defines it like this:&lt;br /&gt;
&lt;blockquote&gt;A library is binary compatible, if a program linked dynamically to a former version of the library continues running with newer versions of the library without the need to recompile.&lt;/blockquote&gt;With this definition in mind, the &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;benefit&lt;/span&gt;&lt;/b&gt; is easy to see: without it, whenever a library is updated, all the applications rely on it &lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;should be recompiled&lt;/span&gt;&lt;/b&gt;&lt;/span&gt; to work. Definitely, it's totally unacceptable for any widely used libraries like Qt. More information on binary compatibility itself can be found on that article from KDE TechBase, and here I only want to share with you how it's used.&lt;br /&gt;
&lt;br /&gt;
Without the usage of D-pointers, we may have a class defined as below:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;class MyClass&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  MyClass();&lt;br /&gt;
  ~MyClass();&lt;br /&gt;
private:&lt;br /&gt;
  int myVar;&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Obviously, the private member of &lt;i&gt;myVar&lt;/i&gt; here is a big enemy of binary compatibility. There fore, we refactor the code into the following:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;class MyClassPrivate;&lt;br /&gt;
class MyClass&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  MyClass();&lt;br /&gt;
  ~MyClass();&lt;br /&gt;
private:&lt;br /&gt;
  MyClassPrivate * const d_ptr;&lt;br /&gt;
  Q_DECLARE_PRIVATE(MyClass);&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Here, we use a pointer &lt;i&gt;d_ptr&lt;/i&gt; to refer to the private implementation, and the macro of &lt;i&gt;Q_DECLARE_PRIVATE&lt;/i&gt; is employed to define some helper functions and friend class:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;#define Q_DECLARE_PRIVATE(Class) \&lt;br /&gt;
    inline Class##Private* d_func() { return reinterpret_cast&amp;lt;Class##Private *&amp;gt;(qGetPtrHelper(d_ptr)); } \&lt;br /&gt;
    inline const Class##Private* d_func() const { return reinterpret_cast&amp;lt;const Class##Private *&amp;gt;(qGetPtrHelper(d_ptr)); } \&lt;br /&gt;
    friend class Class##Private;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Then we define the private class as below:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;class MyClassPrivate&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  MyClassPrivate(MyClass *parent);&lt;br /&gt;
private:&lt;br /&gt;
  MyClass * const q_ptr;&lt;br /&gt;
  Q_DECLARE_PUBLIC(MyClass);&lt;br /&gt;
  int myVar;&lt;br /&gt;
};&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Here, the &lt;i&gt;q_ptr&lt;/i&gt; pointer points the public interface, and the &lt;i&gt;Q_DECLARE_PUBLIC&lt;/i&gt; macro is used to define some helper functions:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;#define Q_DECLARE_PUBLIC(Class) \&lt;br /&gt;
    inline Class* q_func() { return static_cast&amp;lt;Class *&amp;gt;(q_ptr); } \&lt;br /&gt;
    inline const Class* q_func() const { return static_cast&amp;lt;const Class *&amp;gt;(q_ptr); } \&lt;br /&gt;
    friend class Class;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
And we can further use the following two macros to ease the access:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;#define Q_D(Class) Class##Private * const d = d_func()&lt;br /&gt;
#define Q_Q(Class) Class * const q = q_func()&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
That's all about the usage of D-pointers and private implementations in Qt. Let me use a simple sample to end this post ;)&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;// myclass.h&lt;br /&gt;
#ifndef MYCLASS_H&lt;br /&gt;
#define MYCLASS_H&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;QtCore/QObject&amp;gt;&lt;br /&gt;
&lt;br /&gt;
class MyClassPrivate;&lt;br /&gt;
class MyClass: public QObject&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
  MyClass(QObject *parent = 0);&lt;br /&gt;
  virtual ~MyClass();&lt;br /&gt;
  void dummyFunc();&lt;br /&gt;
&lt;br /&gt;
signal:&lt;br /&gt;
  void dummySignal();&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  MyClassPrivate * const d_ptr;&lt;br /&gt;
  Q_DECLARE_PRIVATE(MyClass);&lt;br /&gt;
  Q_DISABLE_COPY(MyClass);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
#endif // MYCLASS_H&lt;br /&gt;
&lt;br /&gt;
// myclass.cpp&lt;br /&gt;
#include "myclass.h"&lt;br /&gt;
&lt;br /&gt;
class MyClassPrivate&lt;br /&gt;
{&lt;br /&gt;
public:&lt;br /&gt;
  MyClassPrivate(MyClass *parent)&lt;br /&gt;
    : q_ptr(parent)&lt;br /&gt;
  {&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  void foobar()&lt;br /&gt;
  {&lt;br /&gt;
    Q_Q(MyClass);&lt;br /&gt;
    emit q-&amp;gt;dummySignal();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  MyClass * const q_ptr;&lt;br /&gt;
  Q_DECLARE_PUBLIC(MyClass);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
MyClass::MyClass(QObject *parent)&lt;br /&gt;
  : QObject(parent)&lt;br /&gt;
  , d_ptr(new MyClassPrivate(this))&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
MyClass::~MyClass()&lt;br /&gt;
{&lt;br /&gt;
  Q_D(MyClass);&lt;br /&gt;
  delete d;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void MyClass::dummyFunc()&lt;br /&gt;
{&lt;br /&gt;
  Q_D(MyClass);&lt;br /&gt;
  d-&amp;gt;foobar();&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
The Chinese translation is available at: &lt;a href="http://blog.csdn.net/zhu_xz/archive/2010/11/25/6035861.aspx"&gt;http://blog.csdn.net/zhu_xz/archive/2010/11/25/6035861.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-2328752462306018613?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JdSbmRAjMbp4I3qlqNQuSiub-Iw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JdSbmRAjMbp4I3qlqNQuSiub-Iw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JdSbmRAjMbp4I3qlqNQuSiub-Iw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JdSbmRAjMbp4I3qlqNQuSiub-Iw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/nnXsjgZeiO8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/2328752462306018613/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/11/beauty-of-qt-1-d-pointer-private.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/2328752462306018613?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/2328752462306018613?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/nnXsjgZeiO8/beauty-of-qt-1-d-pointer-private.html" title="The Beauty of Qt 1: D-Pointer / Private Implementation" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/11/beauty-of-qt-1-d-pointer-private.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8MQnc_cCp7ImA9Wx9TFko.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-761400638904582069</id><published>2010-11-24T15:24:00.001+02:00</published><updated>2010-11-25T11:21:23.948+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-25T11:21:23.948+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="gfw" /><title>刚收到的一封以“对华援助协会”名义发送的钓鱼邮件</title><content type="html">如题，刚受到钓鱼邮件一封，打开后截图如下：&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_j2Abq_R5P6w/TO0Mgm5PokI/AAAAAAAADi0/NSGUq7LqqTM/s1600/snapshot1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="203" src="http://2.bp.blogspot.com/_j2Abq_R5P6w/TO0Mgm5PokI/AAAAAAAADi0/NSGUq7LqqTM/s640/snapshot1.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
如果你点击其中的链接，试图打开这个所为的“紧急通知”，就会被重定向到域名为&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;google-mail.dyndns.org&lt;/span&gt;&lt;/b&gt;上的一个和GMail登录页面完全相同的页面，截图如下：&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_j2Abq_R5P6w/TO0NNZOQvXI/AAAAAAAADi4/hxH9Vyy2s7I/s1600/snapshot2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="178" src="http://3.bp.blogspot.com/_j2Abq_R5P6w/TO0NNZOQvXI/AAAAAAAADi4/hxH9Vyy2s7I/s640/snapshot2.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
该钓鱼页面会&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;盗取你的GMail账户密码&lt;/span&gt;&lt;/b&gt;，并重定向到一个不存在的Google页面，极具迷惑性，请大家小心！！我现在暂时没有时间详细追查下去，晚点会仔细看看，并将结果向告诉大家！&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;更新&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
这个钓鱼邮件用到了&lt;a href="http://www.dyndns.com/"&gt;DynDNS.com&lt;/a&gt;的服务，将域名google-mail.dyndns.org指向IP地址115.160.146.163，而发送电子邮件的地址也是这个IP。而根据http://www.ip138.com/的查询结果，该IP地址位于香港。&lt;br /&gt;
&lt;br /&gt;
考虑到&lt;a href="http://www.chinaaid.org/"&gt;对华援助协会&lt;/a&gt;的性质，以及针对GMail账户的盗取，有理由认为这个钓鱼是熊猫大叔做的。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-761400638904582069?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/f3AzAlh9-c6HbnBpu-pDJ0gnfLc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/f3AzAlh9-c6HbnBpu-pDJ0gnfLc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/f3AzAlh9-c6HbnBpu-pDJ0gnfLc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/f3AzAlh9-c6HbnBpu-pDJ0gnfLc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/zf2o2RKSGLA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/761400638904582069/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/11/blog-post_24.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/761400638904582069?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/761400638904582069?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/zf2o2RKSGLA/blog-post_24.html" title="刚收到的一封以“对华援助协会”名义发送的钓鱼邮件" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_j2Abq_R5P6w/TO0Mgm5PokI/AAAAAAAADi0/NSGUq7LqqTM/s72-c/snapshot1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/11/blog-post_24.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcERX4-cSp7ImA9Wx9TE04.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-7458571700652449239</id><published>2010-11-21T11:28:00.001+02:00</published><updated>2010-11-21T12:40:04.059+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-21T12:40:04.059+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>彭德怀亲临攀枝花建设工地(14)</title><content type="html">在凤凰网上发现《&lt;a href="http://book.ifeng.com/lianzai/detail_2009_03/06/291196_46.shtml"&gt;彭德怀亲临攀枝花建设工地(14)&lt;/a&gt;》一文中有如此牛B的一段：&lt;br /&gt;
&lt;blockquote&gt;在江耀华&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;逝世二十多年后&lt;/span&gt;&lt;/b&gt;的全国科技大会上，攀钢的雾化提钒工艺获得了国家科技进步一等奖，当大会念到获奖者的名字时，上台领奖的竟然是一个&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;戴着红领巾的小姑娘--江耀华的女儿&lt;/span&gt;&lt;/b&gt;。全体代表起立，向这位无法到会的获奖者默哀致意。&lt;/blockquote&gt;请大家自行联想！&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-7458571700652449239?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/i27A9JoztVv35aaF9kBvLj2lJYE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/i27A9JoztVv35aaF9kBvLj2lJYE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/i27A9JoztVv35aaF9kBvLj2lJYE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/i27A9JoztVv35aaF9kBvLj2lJYE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/bFBa6vV0WTM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/7458571700652449239/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/11/14.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/7458571700652449239?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/7458571700652449239?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/bFBa6vV0WTM/14.html" title="彭德怀亲临攀枝花建设工地(14)" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/11/14.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cAQn06fyp7ImA9Wx9TEE0.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-9066976499124687409</id><published>2010-11-17T15:37:00.000+02:00</published><updated>2010-11-17T15:37:23.317+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-17T15:37:23.317+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>洪洞县警察夫妇家中被害</title><content type="html">全文转载《&lt;a href="http://news.163.com/10/1116/06/6LJDIKL700014AED.html"&gt;洪洞县警察夫妇家中被害&lt;/a&gt;》如下，看点用彩色标明：&lt;br /&gt;
&lt;blockquote&gt;楚天金报讯 据《新京报》报道 12日，山西临汾市洪洞县城中心地段一高档小区发生凶案，一对警察夫妇在家中遇害。&lt;br /&gt;
&lt;br /&gt;
11月12日上午，山西省临汾市洪洞县警方接到报警称，位于县城&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;中心地段一高档小区&lt;/b&gt;&lt;/span&gt;内发生凶案，一对夫妻在家中非正常死亡。&lt;br /&gt;
&lt;br /&gt;
知情人称，两名死者均为洪洞县公安局干警，两人系夫妻关系。男子王某，52岁，为洪洞县公安局交警大队&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;公路巡警中队原队长&lt;/span&gt;&lt;/b&gt;，王妻为洪洞县公安局&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;机关科室干警&lt;/span&gt;&lt;/b&gt;。&lt;br /&gt;
&lt;br /&gt;
据了解，遇害警察夫妇育有&lt;span class="Apple-style-span" style="color: red;"&gt;&lt;b&gt;两女一子&lt;/b&gt;&lt;/span&gt;，均&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;在美国留学&lt;/span&gt;&lt;/b&gt;，11日晚，子女联系父母，发现手机关机、家中电话无人应答，后找亲属和&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;司机&lt;/span&gt;&lt;/b&gt;，最后发现在家中遇害。知情人称，死者的&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;宝马&lt;/span&gt;&lt;/b&gt;车停在车库，楼道有一摊血迹，&lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;男子脖子有勒痕，女子身上无明显痕迹&lt;/span&gt;&lt;/b&gt;。&lt;br /&gt;
&lt;br /&gt;
洪洞一知情人告诉记者，死者王某为人低调，&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;生前曾开办过企业&lt;/span&gt;&lt;/b&gt;，在当地很有名气。&lt;br /&gt;
&lt;br /&gt;
知情人还称，死者家的&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;b&gt;大门没有遭到破坏&lt;/b&gt;&lt;/span&gt;，房间&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;茶几上放着一个茶杯&lt;/span&gt;&lt;/b&gt;。据悉，山西省、市、县警方已成立专案组，案件正在进一步调查中。&lt;br /&gt;
&lt;br /&gt;
另据网友爆料，洪洞县&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;公安局副局长&lt;/span&gt;&lt;/b&gt;，交警大队长王建勋被杀，系&lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;被狗链勒死&lt;/span&gt;&lt;/b&gt;，其妻也一并被杀。王为&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;亿万富翁&lt;/span&gt;&lt;/b&gt;，在洪洞有&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;三个煤矿&lt;/span&gt;&lt;/b&gt;。&lt;/blockquote&gt;请大家自行联想！&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-9066976499124687409?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/r3fC-0p8-t2OQncQUPIp0jLuemg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/r3fC-0p8-t2OQncQUPIp0jLuemg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/r3fC-0p8-t2OQncQUPIp0jLuemg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/r3fC-0p8-t2OQncQUPIp0jLuemg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/_UGbsxpztrU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/9066976499124687409/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/11/blog-post_17.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/9066976499124687409?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/9066976499124687409?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/_UGbsxpztrU/blog-post_17.html" title="洪洞县警察夫妇家中被害" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/11/blog-post_17.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUYHSHw-cCp7ImA9Wx5bF0w.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-7427676426356899917</id><published>2010-11-02T18:58:00.000+02:00</published><updated>2010-11-02T18:58:59.258+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-02T18:58:59.258+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>中国人民是不会上当的</title><content type="html">人民网的又一篇雄文，《&lt;a href="http://opinion.people.com.cn/GB/13029216.html"&gt;中国人民是不会上当的&lt;/a&gt;》。文章表示：&lt;br /&gt;
&lt;blockquote&gt;美国人均石油消耗量是中国的10倍以上，&lt;b&gt;平均1.2—1.3人拥有一辆汽车&lt;/b&gt;，这个模式如果搬到中国，&lt;b&gt;中国就要有16亿辆汽车&lt;/b&gt;。&lt;/blockquote&gt;这个，这个，中国人也多得离谱了点吧？已经有&lt;b&gt;19.2-20.8亿人&lt;/b&gt;了？既然如此，文中的其他观点笑笑也就过去了吧！&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-7427676426356899917?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vzS1KnxjatgDPTOCy-xcEqVwijY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vzS1KnxjatgDPTOCy-xcEqVwijY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vzS1KnxjatgDPTOCy-xcEqVwijY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vzS1KnxjatgDPTOCy-xcEqVwijY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/BKyLHZ5VyWk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/7427676426356899917/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/11/blog-post.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/7427676426356899917?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/7427676426356899917?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/BKyLHZ5VyWk/blog-post.html" title="中国人民是不会上当的" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/11/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcBQHY-fSp7ImA9Wx5bFk0.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-6828349215911901670</id><published>2010-11-01T11:34:00.000+02:00</published><updated>2010-11-01T11:34:11.855+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-01T11:34:11.855+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="qtwrt" /><category scheme="http://www.blogger.com/atom/ns#" term="nokia" /><category scheme="http://www.blogger.com/atom/ns#" term="maemo" /><category scheme="http://www.blogger.com/atom/ns#" term="n900" /><title>New release of Web Runtime for N900</title><content type="html">Finally, I'm happy to push the latest &lt;a href="http://maemo.org/packages/view/qtwrt/"&gt;Web Runtime&lt;/a&gt; (v1.1.0) for N900 to the &lt;a href="http://wiki.maemo.org/Extras-devel"&gt;extras-devel&lt;/a&gt; repository. Please &lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;note&lt;/span&gt;&lt;/b&gt; that this release is only tested against PR 1.3. There's no new features implemented compared to the &lt;a href="http://developer.qt.nokia.com/forums/viewthread/307/"&gt;previous release&lt;/a&gt; back in July, but only bug fixes. Personally, this is one of the last duties for me in the WRT project, and let's see what I would play with in the future ;)&lt;br /&gt;
&lt;blockquote&gt;&lt;b&gt;What is Web Runtime?&lt;/b&gt;&lt;br /&gt;
It's a development framework with which you can write applications in standard Web technologies, like HTML, CSS, and JavaScript. Also, a bunch of Device APIs are provided to grant you the access to native resources, e.g. file system, sensors, etc., using JavaScript.&lt;/blockquote&gt;To &lt;b&gt;install&lt;/b&gt; WRT on N900, you should first enable the &lt;a href="http://wiki.maemo.org/Extras-devel"&gt;extras-devel&lt;/a&gt; repository.&lt;br /&gt;
&lt;br /&gt;
If you have the previous release installed, you should first uninstall:&lt;br /&gt;
sudo gainroot&lt;br /&gt;
apt-get purge libwrt-experimental1&lt;br /&gt;
&lt;br /&gt;
Then install the new release:&lt;br /&gt;
sudo gainroot&lt;br /&gt;
apt-get install qtwrt&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://xizhizhu.blogspot.com/search/label/qtwrt"&gt;Have fun&lt;/a&gt; and feel free to go to the &lt;a href="http://developer.qt.nokia.com/forums/viewforum/20/"&gt;public forum&lt;/a&gt; for more questions ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-6828349215911901670?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/d_1L6OSOlAkB8zhlECb1OAd5k2M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d_1L6OSOlAkB8zhlECb1OAd5k2M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/d_1L6OSOlAkB8zhlECb1OAd5k2M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d_1L6OSOlAkB8zhlECb1OAd5k2M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/WpedYliPUz0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/6828349215911901670/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/11/new-release-of-web-runtime-for-n900.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/6828349215911901670?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/6828349215911901670?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/WpedYliPUz0/new-release-of-web-runtime-for-n900.html" title="New release of Web Runtime for N900" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>10</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/11/new-release-of-web-runtime-for-n900.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8FQHg5eCp7ImA9Wx5bEkU.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-3859990659729349604</id><published>2010-10-28T19:36:00.000+03:00</published><updated>2010-10-28T19:36:51.620+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-28T19:36:51.620+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="qml" /><category scheme="http://www.blogger.com/atom/ns#" term="qt" /><category scheme="http://www.blogger.com/atom/ns#" term="maemo" /><title>Hybrid application using QML and Qt C++</title><content type="html">Though &lt;a href="http://doc.qt.nokia.com/4.7/qdeclarativeintroduction.html"&gt;QML&lt;/a&gt; provides a nice way to design user interfaces, and JavaScript is employed there to implement the application logic and works pretty nice in many cases, we might still need Qt C++ in some situations (well, at least JavaScript has limited access outside its sandbox).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;1) integrate QML into Qt C++&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Suppose we have a QML file, named "myqml.qml", like this:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;// this line should be "import QtQuick 1.0" since Qt 4.7.1&lt;br /&gt;
import Qt 4.7&lt;br /&gt;
&lt;br /&gt;
Rectangle {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;id: myRectangle&lt;br /&gt;
&amp;nbsp;&amp;nbsp;width: 800&lt;br /&gt;
&amp;nbsp;&amp;nbsp;height: 480&lt;br /&gt;
&amp;nbsp;&amp;nbsp;color: "lightgray"&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Text {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;id: myText&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;text: "I love hybrid application!"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;anchors.centerIn: parent&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;font.pointSize: 28&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;font.bold: true&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
One easy way to integrate is to use the &lt;a href="http://doc.qt.nokia.com/4.7/qdeclarativeview.html"&gt;QDeclarativeView&lt;/a&gt; class, which provides a widget to display QML files. You just need the following three lines:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;QDeclarativeView view;&lt;br /&gt;
view.setSource(QUrl::fromLocalFile("myqml.qml"));&lt;br /&gt;
view.show();&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
However, &lt;i&gt;QDeclarativeView&lt;/i&gt; consumes more resources than normal widgets. Fortunately, we can &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;integrate QML into a graphics scene&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;. The following lines shows the basic usage:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;// provides an environment for instantiating QML components&lt;br /&gt;
QDeclarativeEngine engine;&lt;br /&gt;
&lt;br /&gt;
// encapsulates a QML component definition&lt;br /&gt;
QDeclarativeComponent component(&amp;amp;engine, QUrl::fromLocalFile("myqml.qml"));&lt;br /&gt;
&lt;br /&gt;
// creates the graphics item for QML at the engine's root context&lt;br /&gt;
QDeclarativeItem *item = qobject_cast&amp;lt;QDeclarativeItem *&amp;gt;(component.create());&lt;br /&gt;
&lt;br /&gt;
scene.addItem(item);&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Then with the help of the &lt;i&gt;QDeclarativeItem&lt;/i&gt; class, you can easily &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;access the properties&lt;/span&gt;&lt;/b&gt; of the QML element, e.g.:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;qDebug() &amp;lt;&amp;lt; item-&amp;gt;property("color").typeName();&lt;br /&gt;
item-&amp;gt;setProperty("color", QColor(255, 255, 255));&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;2) exposing Qt C++ objects to QML&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can also &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;expose native Qt C++ objects to QML&lt;/span&gt;&lt;/b&gt; through &lt;i&gt;QDeclarativeContext&lt;/i&gt;:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;QDeclarativeContext *context = engine-&amp;gt;rootContext();&lt;br /&gt;
context-&amp;gt;setContextProperty("textFromQt", QString("I love hybrid application!"));&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Then in QML, you can have e.g. the following line to access them:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;text: textFromQt&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
You can also use &lt;i&gt;QDeclarativePropertyMap&lt;/i&gt; to manage the exposed properties:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;QDeclarativePropertyMap map;&lt;br /&gt;
map.insert("key1", "value1");&lt;br /&gt;
map.insert("key2", "value2");&lt;br /&gt;
context-&amp;gt;setContextProperty("map", &amp;amp;map);&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;In a QML engine, there could be a couple of contexts, forming a tree structure. The child contexts inherit properties in the parent context. By default, there is only one root context, but you can always add more to give finer control of the exposed data, i.e. different QDeclarativeComponent inside the same context have the same exposed data set.&lt;/blockquote&gt;&lt;br /&gt;
To &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;expose a self-defined object&lt;/span&gt;&lt;/b&gt;, we can use the following code:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;// define a class with properties&lt;br /&gt;
class MyObject: public QObject&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Q_OBJECT&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// the NOTIFY signal is needed to inform about changes&lt;br /&gt;
&amp;nbsp;&amp;nbsp;// all properties will be exposed to QML&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)&lt;br /&gt;
public:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;MyObject(QObject *parent = 0) : QObject(parent), m_text("I love hybrid application!") {}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;QString text() const { return m_text; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void setText(QString &amp;amp;text)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;m_text = text;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;emit textChanged();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
signals:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void textChanged();&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;QString m_text;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// then just expose it so QML can access it through name "myObject"&lt;br /&gt;
engine-&amp;gt;rootContext()-&amp;gt;setContextProperty("myObject", new MyObject());&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Moreover, we can &lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;create new QML types&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;// define the new type&lt;br /&gt;
class MyType : public QDeclarativeItem&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Q_OBJECT&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;MyType(QDeclarativeItem *parent = 0) : QDeclarativeItem(parent)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;setFlag(QGraphicsItem::ItemHasNoContents, false);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;QPen pen(QColor(100, 100, 100), 2);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;painter-&gt;setPen(pen);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;painter-&gt;drawLine(0, 100, 100, 100);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// then register to expose it&lt;br /&gt;
qmlRegisterType&amp;lt;mychart&amp;gt;("com.blogspot.xizhizhu.mytype", 1, 0, "MyType");&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
In QML, you can use it like this:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;import com.blogspot.xizhizhu.mytype 1.0&lt;br /&gt;
&lt;br /&gt;
MyChart {&lt;br /&gt;
&amp;nbsp;id: myChart&lt;br /&gt;
&amp;nbsp;width: 100&lt;br /&gt;
&amp;nbsp;height: 200&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Now let's jump to &lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;invoke a Qt C++ function from QML&lt;/span&gt;&lt;/b&gt;. Basically, QML can invoke slots and functions declared with &lt;i&gt;Q_INVOKABLE&lt;/i&gt;. Suppose we have the following function in MyObject:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;Q_INVOKABLE void showMessage()&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;QMessageBox::information(NULL, "My Test", "Invoking a native function ;)");&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Then you can invoke it in QML:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;myObject.showMessage();&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;3) write plugins as QML extension&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The benefits for using plugins as QML extensions are similar to using shared libraries, and it can be easily achieved with the help of &lt;i&gt;QDeclarativeExtensionPlugin&lt;/i&gt;. Let's reuse the MyType class defined in the previous section. First, we need to &lt;b&gt;create a plugin&lt;/b&gt;:&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;class MyPlugin : public QDeclarativeExtensionPlugin&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Q_OBJECT&lt;br /&gt;
public:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;void registerTypes(const char *uri)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;qmlRegisterType&amp;lt;MyType&amp;gt;(uri, 1, 0, "MyType");&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Q_EXPORT_PLUGIN2(myPlugin, MyPlugin);&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Then &lt;b&gt;create a file named "qmldir"&lt;/b&gt; to define which plugin to load from where (suppose the plugin is called "myplugin):&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;plugin myplugin /path/to/plugin&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Now we can use &lt;i&gt;qmlviewer&lt;/i&gt; to launch the QML file:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;// no need to import now&lt;br /&gt;
MyChart {&lt;br /&gt;
&amp;nbsp;id: myChart&lt;br /&gt;
&amp;nbsp;width: 100&lt;br /&gt;
&amp;nbsp;height: 200&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;4) summary&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;li&gt;Use &lt;i&gt;QDeclarativeView&lt;/i&gt; or &lt;i&gt;QDeclarativeComponent&lt;/i&gt; to integrate a QML file into native Qt C++.&lt;/li&gt;&lt;li&gt;Qt C++ can access the properties of QML elements through &lt;i&gt;QDeclarativeItem&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;Expose native objects to QML through &lt;i&gt;QDeclarativeContext&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;New QML types can be exported through &lt;i&gt;qmlRegisterType&lt;/i&gt;.&lt;/li&gt;&lt;li&gt;The properties of native objects are exported as properties, and the slots or functions declared with Q_INVOKABLE can be invoked in QML.&lt;/li&gt;&lt;li&gt;Create plugins for extension using &lt;i&gt;QDeclarativeExtensionPlugin&lt;/i&gt;.&lt;/li&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-3859990659729349604?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/t9kxbtDmOPe33QCRYWJsHJZud_Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t9kxbtDmOPe33QCRYWJsHJZud_Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/t9kxbtDmOPe33QCRYWJsHJZud_Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t9kxbtDmOPe33QCRYWJsHJZud_Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/75UW3i_r1dc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/3859990659729349604/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/10/hybrid-application-using-qml-and-qt-c.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/3859990659729349604?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/3859990659729349604?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/75UW3i_r1dc/hybrid-application-using-qml-and-qt-c.html" title="Hybrid application using QML and Qt C++" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/10/hybrid-application-using-qml-and-qt-c.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAGRn06eSp7ImA9Wx5bEko.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-3710786756682407974</id><published>2010-10-28T17:51:00.001+03:00</published><updated>2010-10-28T17:55:27.311+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-28T17:55:27.311+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>沙祖康给迟浩田颁“世界杰出和谐人物”奖</title><content type="html">中新网报道称《&lt;a href="http://www.chinanews.com.cn/gn/2010/10-28/2618933.shtml"&gt;沙祖康给迟浩田颁“世界杰出和谐人物”奖&lt;/a&gt;》。文中提到：&lt;br /&gt;
&lt;blockquote&gt;中国原国防部长迟浩田将军27日晚从联合国副秘书长沙祖康手中接过世界和谐基金会“和谐奖评选委员会”提名授予的“世界杰出和谐人物”奖杯。&lt;br /&gt;
世界和谐奖在联合国65周年启动，奖杯由水晶做成艺术和平鸽，在联合国大厦背景上端栓有世界和谐钟图，象征着联合国和谐为和平的精神。&lt;br /&gt;
世界和谐基金会是由一批热爱和平、环保、来自五大洲的联合国前官员、投资家、教育家、科学家、退休将军、学生领袖等不同肤色的有志之士成立的联合国非政府组织，&lt;b&gt;归宿在联合国环境规划署&lt;/b&gt;。其宗旨是促进: “促进人与自然的和谐、人与人的和谐、人与社会的和谐、国家之间的和谐、经济之间和谐、宗教之间的和谐、及人体自身的和谐”。&lt;/blockquote&gt;&lt;br /&gt;
我是从来没有听说过这么个和谐基金会，于是就不和谐了Google了一番。然后就发现了两个名称、logo等相同的和谐基金会网站，一个以&lt;a href="http://www.whf-foundation.com/"&gt;.com&lt;/a&gt;作为顶级域名，另一个则用&lt;a href="http://www.whf-foundation.org/"&gt;.org&lt;/a&gt;作为顶级域名。不过根据网站上的介绍，两者应该为同一机构。&lt;br /&gt;
&lt;br /&gt;
根据这个.org网站的&lt;a href="http://www.whf-foundation.org/AboutUsC.html"&gt;介绍&lt;/a&gt;，“世界和谐基金会于2005年2月被联合国环境规划署委任以顾问一职，具有联合国非政府组织咨商地位。”我想，这个“顾问”，怎么也不能算是“归宿”吧？&lt;br /&gt;
&lt;br /&gt;
本来还想继续深挖，结果一不小心找到北青网在年初的一篇打假报道《&lt;a href="http://bkb.ynet.com/article.jsp?oid=62306422"&gt;“联合国和谐城市”调查&lt;/a&gt;》，上面提到：&lt;br /&gt;
&lt;blockquote&gt;联合国环境规划署中国办事处官员张文娟对《北京科技报》表示：自己从来没有听说过“世界和谐基金会”这个组织，也没有听说过环境规划署方面与该组织进行合作的消息。&lt;/blockquote&gt;&lt;br /&gt;
不知道这么个组织怎么邀请到“好五倍”的沙祖康的呢？&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-3710786756682407974?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RkcBZ5XKo5whLdhSsXRI3582y9Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RkcBZ5XKo5whLdhSsXRI3582y9Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RkcBZ5XKo5whLdhSsXRI3582y9Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RkcBZ5XKo5whLdhSsXRI3582y9Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/3sXt-PDaOYI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/3710786756682407974/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/10/blog-post_28.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/3710786756682407974?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/3710786756682407974?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/3sXt-PDaOYI/blog-post_28.html" title="沙祖康给迟浩田颁“世界杰出和谐人物”奖" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/10/blog-post_28.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4ARnkzeip7ImA9Wx5bEUs.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-6307863290866922297</id><published>2010-10-27T09:29:00.000+03:00</published><updated>2010-10-27T09:29:07.782+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-27T09:29:07.782+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>深圳市高层次专业人才住房补贴</title><content type="html">10月12日，深圳市人力资源和社会保障局发布《&lt;a href="http://www.sz.gov.cn/rsj/szsrzhsbj/shgs/201010/t20101012_1597331.htm"&gt;深圳市高层次专业人才2010年第三季度住房补贴拟发放及拟中止发放人员名单&lt;/a&gt;》。这样的大名单，自然少不了大名鼎鼎的腾讯公司老板&lt;b&gt;马化腾&lt;/b&gt;，编号为314，以地方级领军人才身份赫然上榜。当然榜单中也少不了其他诸如华为公司的众多大佬，就不一一列举了。&lt;br /&gt;
&lt;br /&gt;
遗憾的是，我没能在网上找到这个补贴发放的依据《深圳市高层次专业人才住房补贴发放规程》（深人发[2008]89号）。不过找到一个同年由深圳市政府发布的《&lt;a href="http://www.sz.gov.cn/rsj/zcfggfxwj/zyjsryl/gccrc/200810/t20081027_205109_4369.htm"&gt;深圳市高层次专业人才住房解决办法（试行）&lt;/a&gt;》（深府〔2008〕204号），应该具有一定参考价值吧？这份文件明确提及：&lt;br /&gt;
&lt;blockquote&gt;第五条  高层次专业人才享受住房补贴（包括购房补贴、购房贴息、租房补贴）的，按照以下建筑面积标准计算：&lt;br /&gt;
（一）两院院士200平方米，其他国家级领军人才150平方米。&lt;br /&gt;
（二）&lt;b&gt;地方级领军人才100平方米。&lt;/b&gt;&lt;br /&gt;
（三）后备级人才80平方米。&lt;/blockquote&gt;&lt;br /&gt;
莫非马大佬的住房不足100平米？？&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-6307863290866922297?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MsNvUA79GXH6po65Cj7TFhPmbhg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MsNvUA79GXH6po65Cj7TFhPmbhg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MsNvUA79GXH6po65Cj7TFhPmbhg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MsNvUA79GXH6po65Cj7TFhPmbhg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/4mbFC1jSnvM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/6307863290866922297/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/10/blog-post_27.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/6307863290866922297?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/6307863290866922297?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/4mbFC1jSnvM/blog-post_27.html" title="深圳市高层次专业人才住房补贴" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/10/blog-post_27.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUFQ30zeip7ImA9Wx5bEUo.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-5781663396313552815</id><published>2010-10-26T12:50:00.001+03:00</published><updated>2010-10-27T12:53:32.382+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-27T12:53:32.382+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="日人民报" /><title>我国公民享有言论出版自由是不争的事实</title><content type="html">话说人民日报又发表了雄文一篇，叫做《&lt;a href="http://opinion.people.com.cn/GB/13052219.html"&gt;我国公民享有言论出版自由是不争的事实&lt;/a&gt;》。&lt;br /&gt;
&lt;br /&gt;
好吧，看原文：&lt;br /&gt;
&lt;blockquote&gt;据统计，目前我国境内网站已达279万个，网民人数达到&lt;b&gt;4.2亿&lt;/b&gt;，互联网普及率达到31.8%，超过世界平均水平；各家网站都十分注重为网民提供发表言论的服务，约80%的网站提供电子公告服务；我国现有上百万个论坛、2.31亿个博客用户，每天人们通过论坛、新闻评论、博客等渠道发表的言论达&lt;b&gt;300多万条&lt;/b&gt;；超过&lt;b&gt;66%&lt;/b&gt;的中国网民经常在网上发表言论，就各种话题进行讨论，表达思想观点。&lt;/blockquote&gt;&lt;br /&gt;
小学计算题......4.2亿网民，66%经常发表言论，算下来就是2.7亿网民经常发表言论。然后每天竟有高达300多万条言论通过各种渠道被发表！相当于说：&lt;br /&gt;
如果这些活跃网民&lt;b&gt;每日一条言论&lt;/b&gt;，相当于每天有&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;98.5%&lt;/span&gt;&lt;/b&gt;的言论被删除。&lt;br /&gt;
如果这些活跃网民&lt;b&gt;每十天才发表一条言论&lt;/b&gt;，相当于每天有&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;85.2%&lt;/span&gt;&lt;/b&gt;的言论被删除。&lt;br /&gt;
如果这些活跃网民&lt;b&gt;每月才发表一条言论&lt;/b&gt;，相当于每天有&lt;b&gt;&lt;span class="Apple-style-span" style="color: red;"&gt;55.6%&lt;/span&gt;&lt;/b&gt;的言论被删除。&lt;br /&gt;
&lt;br /&gt;
还需要做评论吗？&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-5781663396313552815?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JqgzbVDix7b_nXp0cWubvd4pegU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JqgzbVDix7b_nXp0cWubvd4pegU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JqgzbVDix7b_nXp0cWubvd4pegU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JqgzbVDix7b_nXp0cWubvd4pegU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/EgPMIUgcQ-M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/5781663396313552815/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/10/blog-post.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5781663396313552815?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5781663396313552815?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/EgPMIUgcQ-M/blog-post.html" title="我国公民享有言论出版自由是不争的事实" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/10/blog-post.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QARXs9fip7ImA9Wx5XFUg.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-5613513485619929159</id><published>2010-09-10T22:23:00.004+03:00</published><updated>2010-09-15T14:49:04.566+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-15T14:49:04.566+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="qtwrt" /><category scheme="http://www.blogger.com/atom/ns#" term="诺基亚" /><category scheme="http://www.blogger.com/atom/ns#" term="nokia" /><category scheme="http://www.blogger.com/atom/ns#" term="maemo" /><category scheme="http://www.blogger.com/atom/ns#" term="n900" /><title>Unofficial Qt Web Runtime tutorial 2: Menu API</title><content type="html">If there is no API, Qt WRT is merely nothing but a naive web browser. Then what APIs are supported other than standard HTML and JavaScript now? You can first get a list of features already supported, or to be supported in the near future &lt;a href="http://bugs.meego.com/showdependencytree.cgi?id=2772&amp;amp;hide_resolved=0"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
As a summary, we have already supported the APIs of menus, &lt;a href="http://www.w3.org/TR/widgets-apis/"&gt;widget object&lt;/a&gt;, &lt;a href="http://www.w3.org/TR/widgets-uri/"&gt;URI schemes&lt;/a&gt;, &lt;a href="http://trac.webkit.org/wiki/WebInspector"&gt;web inspector&lt;/a&gt;, console log, some Device APIs, as well as some HTML 5 features and standard JavaScript from Qt WebKit. Let's start with the menu API.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;1 view menu&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You can create &lt;b&gt;the menu items to the chrome's menu bar&lt;/b&gt; (we call it view menu) with the following JavaScript code:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;var menuItem = new nokia.device.MenuItem("Menu item", changeTitle);&lt;br /&gt;
nokia.device.menu.addMenuItem(menuItem);&lt;br /&gt;
function changeTitle()&lt;br /&gt;
{                                            &lt;br /&gt;
&amp;nbsp;&amp;nbsp;nokia.device.menu.title = "New title";                          &lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Here, you have created a menu item named "Menu item" and added it to the menu bar. When it's triggered, the function changeTitle() will be called to set the menu's title to "New title".&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note&lt;/b&gt; that since on the device the menu's title is also the same as the window's title, it actually changes the window's title too.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;2 context menu&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
The &lt;b&gt;context menu&lt;/b&gt; can be created with the following piece of code:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;var contextMenu = new nokia.device.ContextMenu("contextMenuArea");&lt;br /&gt;
var changeTitleItem = new nokia.device.MenuItem("Change Title");&lt;br /&gt;
changeTitleItem.onselect = changeTitle;&lt;br /&gt;
contextMenu.addMenuItem(changeTitleItem);&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Here, a context menu is created and an item named "Change Title" is added to the menu. When you long tap on the HTML element with id "contextMenuArea", this context menu will pop up. Then if you select the "Change Title" item, the changeTitle() function will be called.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;Of course, only the widgets in the &lt;i&gt;windowed&lt;/i&gt; or &lt;i&gt;fullscreen&lt;/i&gt; mode could have &lt;b&gt;context menus&lt;/b&gt;; and only the widgets in the &lt;i&gt;windowed&lt;/i&gt; mode can have &lt;b&gt;view menus&lt;/b&gt;.&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;Note&lt;/b&gt; that there's a known bug (already fixed for the next release) that if you long tap on the area where no context menu is defined, an empty context menu is popped-up.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;3 sample&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Only the HTML file this time ;)&lt;br /&gt;
&lt;code class="prettyprint lang-html"&gt;&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;Menu sample&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function changeTitle()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (nokia.device.menu.title == "Title 1")&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nokia.device.menu.title = "Title 2";&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nokia.device.menu.title = "Title 1";&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function init()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var menuItem = new nokia.device.MenuItem("item", changeTitle);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nokia.device.menu.addMenuItem(menuItem);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var contextMenu = new nokia.device.ContextMenu("contextMenuArea");&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;contextMenu.addMenuItem(menuItem);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&amp;lt;body onload="init()"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;div id="contextMenuArea"&amp;gt;There is a context menu.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, one menu item can be added to multiple menus, exactly the same as native Qt apps. Here goes some screenshots:&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://media.share.ovi.com/m1/s/2428/c180ec06bf9f4804850c76e13ff5be20.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2428/c180ec06bf9f4804850c76e13ff5be20.jpg" width="320" /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href="http://media.share.ovi.com/m1/s/2428/d13371e97dfc4657a55d8887edfe6459.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2428/d13371e97dfc4657a55d8887edfe6459.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://media.share.ovi.com/m1/s/2428/fa9df2d3f04e4b5196488145bdff67e0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2428/fa9df2d3f04e4b5196488145bdff67e0.jpg" width="320" /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href="http://media.share.ovi.com/m1/s/2431/c099edca2f2247fd832c03ed7b83ca49.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2431/c099edca2f2247fd832c03ed7b83ca49.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
The first one shows the simple sample when launched. The second and third one show the view menu and the context menu, respectively, while the last one shows that the title has been updated after you tap on the menu. More screenshots can be found &lt;a href="http://share.ovi.com/album/xizhizhu.QtWebRuntim"&gt;here&lt;/a&gt;, while the sample code is available &lt;a href="http://gitorious.org/xizzhu-samples/qtwrt-menu-sample"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-5613513485619929159?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AvaGunsdIPr0F9TOEsIE9ZWokqM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AvaGunsdIPr0F9TOEsIE9ZWokqM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AvaGunsdIPr0F9TOEsIE9ZWokqM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AvaGunsdIPr0F9TOEsIE9ZWokqM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/k65YyQKt6HU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/5613513485619929159/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/09/unofficial-qt-web-runtime-tutorial-2.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5613513485619929159?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/5613513485619929159?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/k65YyQKt6HU/unofficial-qt-web-runtime-tutorial-2.html" title="Unofficial Qt Web Runtime tutorial 2: Menu API" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/09/unofficial-qt-web-runtime-tutorial-2.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcGR384eyp7ImA9Wx5XEU4.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-453931628633227590</id><published>2010-08-18T23:07:00.010+03:00</published><updated>2010-09-10T17:47:06.133+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-10T17:47:06.133+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="qtwrt" /><category scheme="http://www.blogger.com/atom/ns#" term="诺基亚" /><category scheme="http://www.blogger.com/atom/ns#" term="nokia" /><category scheme="http://www.blogger.com/atom/ns#" term="maemo" /><category scheme="http://www.blogger.com/atom/ns#" term="n900" /><title>Unofficial QtWRT tutorial 1: Hello, view modes!</title><content type="html">Almost one month ago, we &lt;a href="http://labs.trolltech.com/blogs/2010/07/19/the-qt-web-runtime-journey-begins/"&gt;announced&lt;/a&gt; Qt Web Runtime, and &lt;a href="http://download.qt.nokia.com/qtwrt/"&gt;released&lt;/a&gt; some snapshot for N900. Basically, QtWRT is a framework, using which you can write "native" application with standard web technology, e.g. HTML, CSS, and JavaScript. As a good starting point, you should take a look at &lt;a href="http://dkothari.blogspot.com/2010/08/qt-web-runtime-for-n900.html"&gt;this article&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note that we're still working on it, and it's now just in the technology preview state ;)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;1 install QtWRT&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
You should &lt;a href="http://wiki.maemo.org/Extras-devel"&gt;enable the extras-devel repository&lt;/a&gt; on your Rover and install the &lt;b&gt;&lt;i&gt;qtwrt-experimental&lt;/i&gt;&lt;/b&gt; package from there. Then, you can find in your Application Manager that Qt Web Runtime Technology Preview for N900 installed.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://media.share.ovi.com/m1/s/2371/612d8bc2545744dca9ccbf497309bbc8.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2371/612d8bc2545744dca9ccbf497309bbc8.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;2 config.xml&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To write your own web applications, besides the normal HTML pages, you also need a &lt;b&gt;config.xml&lt;i&gt;&lt;/i&gt;&lt;/b&gt; file to define e.g. the starting file, icon, features you need (i.e. access to Device APIs), as well as author's information, etc. More details and default values are defined &lt;a href="http://www.w3.org/TR/widgets/"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The following piece shows a minimum sample:&lt;br /&gt;
&lt;code class="prettyprint lang-xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;
&amp;lt;widget xmlns = "http://www.w3.org/ns/widgets"&amp;gt;&lt;br /&gt;
&amp;lt;/widget&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
You can also define the name and icon (only PNG files supported) of the web app in config.xml:&lt;br /&gt;
&lt;code class="prettyprint lang-xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;
&amp;lt;widget xmlns = "http://www.w3.org/ns/widgets"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;name&amp;gt;A sample web app&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;icon src="app_icon.png" /&amp;gt;&lt;br /&gt;
&amp;lt;/widget&amp;gt;&lt;/code&gt;&lt;br /&gt;
The name and icon will be appeared in the Application Grid or the Desktop menu --&amp;gt; Add widget based on the view mode the web app supports (see below).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;3 view modes&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
View modes define the visual presentation of web applications. The W3C spec has &lt;a href="http://www.w3.org/TR/view-mode/"&gt;defined&lt;/a&gt; five different view modes, but we only support three of them in this snapshot:&lt;br /&gt;
&lt;b&gt;windowed&lt;/b&gt; - The default view mode. You can find / launch web apps in this mode from the Application Grid. It also supports the native chromes and user-defined menus.&lt;br /&gt;
&lt;b&gt;fullscreen&lt;/b&gt; - It can also be found / launched from the Application Grid. No need to say what is full screen, right ;)&lt;br /&gt;
&lt;b&gt;minimized&lt;/b&gt; - It equals to the native widgets on the Home Screen.&lt;br /&gt;
&lt;br /&gt;
The following piece defines the view modes in config.xml:&lt;br /&gt;
&lt;code class="prettyprint lang-xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;
&amp;lt;widget xmlns = "http://www.w3.org/ns/widgets"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;viewmodes = "someviewmode fullscreen minimized" &amp;gt;&lt;br /&gt;
&amp;lt;/widget&amp;gt;&lt;/code&gt;&lt;br /&gt;
The unknown view mode "someviewmode" is ignored. It supports both "fullscreen" and "minimized" mode in this case. If no supported view mode is defined, "windowed" mode is used.&lt;br /&gt;
&lt;br /&gt;
You can get the current view mode through the &lt;b&gt;widget.viewMode&lt;/b&gt; interface in JavaScript.&lt;br /&gt;
&lt;br /&gt;
Also, the transfer among different view modes is supported, with the exception from windowed / fullscreen to minimized, e.g.:&lt;br /&gt;
&lt;code class="prettyprint lang-html"&gt;&amp;lt;a href="javascript:widget.viewMode='windowed'"&amp;gt;Go to windowed mode&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
With the following code, you can handle the view mode change event in the viewModeChanged function:&lt;br /&gt;
&lt;code class="prettyprint lang-javascript"&gt;widget.onviewmodechange = viewModeChanged;&lt;br /&gt;
function viewModeChanged(mode)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if (mode == "windowed") {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// going to windowed mode&lt;br /&gt;
&amp;nbsp;&amp;nbsp;} else if (mode == "minimized") {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// going to minimized mode&lt;br /&gt;
&amp;nbsp;&amp;nbsp;} else if (mode == "fullscreen") {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// going to full screen mode&lt;br /&gt;
&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;4 package your application and install it&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Well, I just assume you have enough knowledge to write whatever HTML page you like, and have renamed it to &lt;b&gt;&lt;i&gt;index.htm&lt;/i&gt;&lt;/b&gt; (the default starting file name).&lt;br /&gt;
&lt;br /&gt;
Now just zip all your HTML files together with the config.xml file. &lt;b&gt;Note&lt;/b&gt; that the config.xml file should be at the top level of the zip, and the name is case sensitive.&lt;br /&gt;
&lt;br /&gt;
Then please rename it to *.wgt and copy it to your Rover. To make it like a native application, you can install it from the File Manager, and you can find your installed web applications in Application Manager!&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;Eh, I'm talking about some details during the installation here. You can skip this if not interested.&lt;br /&gt;
&lt;br /&gt;
When you tap on the wgt file in File Manager, &lt;i&gt;widgetinstaller&lt;/i&gt; is launched. It does some sanity checking of it, e.g. whether it's a valid zip file, if the config.xml is valid, etc., then convert it to a Debian file, and use the Application Manager to install the generated Debian file.&lt;br /&gt;
&lt;br /&gt;
If you are interested in the generated Debian file, you can use the "--no-install" option of the widgetinstaller to have it copied to the current directory.&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;5 a sample&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
First, let's write the &lt;b&gt;config.xml&lt;/b&gt; file.&lt;br /&gt;
&lt;code class="prettyprint lang-xml"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;br /&gt;
&amp;lt;widget xmlns="http://www.w3.org/ns/widgets"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;id="http://xizhizhu.blogspot.com/qtwrt/view-modes-sample"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;viewmodes="minimized fullscreen windowed"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;name&amp;gt;View Modes Sample&amp;lt;/name&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;description&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Well, it shows how the view modes work.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;author href="http://xizhizhu.blogspot.com/" email="xizhi.zhu@gmail.com"&amp;gt;Xizhi Zhu&amp;lt;/author&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;license&amp;gt;In the public domain without any warranty.&amp;lt;/license&amp;gt;&lt;br /&gt;
&amp;lt;/widget&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Then the HTML file.&lt;br /&gt;
&lt;code class="prettyprint lang-html"&gt;&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;header&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;View Modes&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function init()&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;output = document.getElementById("viewmode");&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;output.innerHTML = widget.viewMode;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;widget.onviewmodechange = changeViewMode;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function changeViewMode(mode)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;output.innerHTML = widget.viewMode;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/header&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body onload="init()"&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;div id="viewmode"&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;a href="javascript:widget.viewMode='minimized'"&amp;gt;minimized&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;a href="javascript:widget.viewMode='windowed'"&amp;gt;windowed&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;a href="javascript:widget.viewMode='fullscreen'"&amp;gt;fullscreen&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Now let's zip the file, send it to N900 and install it from the File Manager. You can find it installed in the Application Manager and already launched in the home screen.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://media.share.ovi.com/m1/s/2371/e60a8041c7d84c70909e0be9b48c379f.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2371/e60a8041c7d84c70909e0be9b48c379f.jpg" width="320" /&gt;&lt;/a&gt;&lt;a href="http://media.share.ovi.com/m1/s/2371/67a55e14988b4ed290d4e21943addb79.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2371/67a55e14988b4ed290d4e21943addb79.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
You may ask, why the last line of "fullscreen" is not shown there? Well, that's due to the &lt;b&gt;fixed size&lt;/b&gt; in the &lt;i&gt;minimized&lt;/i&gt; mode, 312x82. Also, in the &lt;i&gt;minimized&lt;/i&gt; mode, you can't actually interact with it, but only tap on it and open the &lt;i&gt;windowed&lt;/i&gt; or &lt;i&gt;fullscreen&lt;/i&gt; mode if supported. In the &lt;i&gt;minimized&lt;/i&gt; mode, it's &lt;b&gt;the same as native widgets&lt;/b&gt; that you can move it around, close it and add it back, as well as the transparent background by default.&lt;br /&gt;
&lt;br /&gt;
Then you can tap the links to toggle between &lt;i&gt;windowed&lt;/i&gt; and &lt;i&gt;fullscreen&lt;/i&gt; mode. And for sure you'll find another "limitation" that you can't go back to &lt;i&gt;minimized&lt;/i&gt; mode from the link. The only way is to close the window. Well, that's exactly what is expected.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://media.share.ovi.com/m1/s/2371/90ca8dbb537d4053afb2bcd781a37922.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2371/90ca8dbb537d4053afb2bcd781a37922.jpg" width="320" /&gt;&lt;/a&gt;&lt;a href="http://media.share.ovi.com/m1/s/2371/7b05ca2788c349b280a02733b392cc1b.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://media.share.ovi.com/m1/s/2371/7b05ca2788c349b280a02733b392cc1b.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Another thing is, in the &lt;i&gt;fullscreen&lt;/i&gt; mode, it automatically shows the "go back to windowed" button if &lt;i&gt;windowed&lt;/i&gt; mode is supported, otherwise the "close" button. Emm, the same as the browser, right?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Updated on 19.8.2010&lt;/b&gt;&lt;br /&gt;
Screenshots added into the posts ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-453931628633227590?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GmRPCez6s6d00OPCXcPqwWFCJ4U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GmRPCez6s6d00OPCXcPqwWFCJ4U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GmRPCez6s6d00OPCXcPqwWFCJ4U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GmRPCez6s6d00OPCXcPqwWFCJ4U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/9uWir0VPTaY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/453931628633227590/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/08/unofficial-qtwrt-tutorial-1-hello-view.html#comment-form" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/453931628633227590?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/453931628633227590?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/9uWir0VPTaY/unofficial-qtwrt-tutorial-1-hello-view.html" title="Unofficial QtWRT tutorial 1: Hello, view modes!" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>13</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/08/unofficial-qtwrt-tutorial-1-hello-view.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcERXg6fyp7ImA9Wx5SGUU.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-7627897213577497332</id><published>2010-08-16T22:13:00.000+03:00</published><updated>2010-08-16T22:13:24.617+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-16T22:13:24.617+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ssl" /><category scheme="http://www.blogger.com/atom/ns#" term="qt" /><title>Basic samples for SSL communication over Qt</title><content type="html">&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;1) client&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;class SSLClient: public QObject&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
  SSLClient(QObject* parent = NULL)&lt;br /&gt;
    : QObject(parent)&lt;br /&gt;
  {&lt;br /&gt;
    connect(&amp;amp;client, SIGNAL(encrypted()),&lt;br /&gt;
            this, SLOT(connectionEstablished()));&lt;br /&gt;
    connect(&amp;amp;client, SIGNAL(sslErrors(const QList&amp;lt;QSslError&amp;gt; &amp;amp;)),&lt;br /&gt;
            this, SLOT(errorOccured(const QList&amp;lt;QSslError&amp;gt; &amp;amp;)));&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  void start(QString hostName, quint16 port)&lt;br /&gt;
  {&lt;br /&gt;
    client.setProtocol(QSsl::TlsV1);&lt;br /&gt;
    client.connectToHostEncrypted(hostName, port);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
public slots:&lt;br /&gt;
  // handle the signal of QSslSocket.encrypted()&lt;br /&gt;
  void connectionEstablished()&lt;br /&gt;
  {&lt;br /&gt;
    // get the peer's certificate&lt;br /&gt;
    QSslCertificate cert = client.peerCertificate();&lt;br /&gt;
&lt;br /&gt;
    // write on the SSL connection&lt;br /&gt;
    client.write("hello, world", 13);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  // handle the signal of QSslSocket.sslErrors()&lt;br /&gt;
  void errorOccured(const QList&amp;lt;QSslError&amp;gt; &amp;amp;error)&lt;br /&gt;
  {&lt;br /&gt;
    // simply ignore the errors&lt;br /&gt;
    // it should be very careful when ignoring errors&lt;br /&gt;
    client.ignoreSslErrors();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  QSslSocket client;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
  QApplication app(argc, argv);&lt;br /&gt;
&lt;br /&gt;
  SSLClient client;&lt;br /&gt;
  client.start("127.0.0.1", 8888);&lt;br /&gt;
&lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;2) server&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;code class="prettyprint lang-cpp"&gt;class SSLServer: public QTcpServer&lt;br /&gt;
{&lt;br /&gt;
  Q_OBJECT&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
  SSLServer(QObject* parent = NULL)&lt;br /&gt;
    : QTcpServer(parent)&lt;br /&gt;
  {&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  void start(QString certPath, QString keyPath, quint16 port)&lt;br /&gt;
  {&lt;br /&gt;
    listen(QHostAddress::Any, port);&lt;br /&gt;
    this-&gt;certPath = certPath;&lt;br /&gt;
    this-&gt;keyPath = keyPath;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
public slots:&lt;br /&gt;
  void readyToRead()&lt;br /&gt;
  {&lt;br /&gt;
    qDebug() &lt;&lt; serverSocket-&gt;readAll();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  void errorOccured(const QList&lt;QSslError&gt; &amp;amp;)&lt;br /&gt;
  {&lt;br /&gt;
    serverSocket-&gt;ignoreSslErrors();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
protected:&lt;br /&gt;
  void incomingConnection(int socketDescriptor)&lt;br /&gt;
  {&lt;br /&gt;
    serverSocket = new QSslSocket;&lt;br /&gt;
    if (serverSocket-&gt;setSocketDescriptor(socketDescriptor)) {&lt;br /&gt;
      connect(serverSocket, SIGNAL(readyRead()), this, SLOT(readyToRead()));&lt;br /&gt;
      connect(serverSocket, SIGNAL(sslErrors(const QList&lt;QSslError&gt; &amp;amp;)),&lt;br /&gt;
              this, SLOT(errorOccured(const QList&lt;QSslError&gt; &amp;amp;)));&lt;br /&gt;
      serverSocket-&gt;setProtocol(QSsl::TlsV1);&lt;br /&gt;
      serverSocket-&gt;setPrivateKey(keyPath);&lt;br /&gt;
      serverSocket-&gt;setLocalCertificate(certPath);&lt;br /&gt;
      serverSocket-&gt;startServerEncryption();&lt;br /&gt;
    } else {&lt;br /&gt;
      delete serverSocket;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
private:&lt;br /&gt;
  QSslSocket *serverSocket;&lt;br /&gt;
  QString certPath;&lt;br /&gt;
  QString keyPath;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char** argv)&lt;br /&gt;
{&lt;br /&gt;
  QApplication app(argc, argv);&lt;br /&gt;
&lt;br /&gt;
  SSLServer server;&lt;br /&gt;
  server.start("ca.cer", "ca.key", 8888);&lt;br /&gt;
&lt;br /&gt;
  return app.exec();&lt;br /&gt;
}&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-7627897213577497332?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cI2bayVcWu7V8MwoNJ02OBddPKk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cI2bayVcWu7V8MwoNJ02OBddPKk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cI2bayVcWu7V8MwoNJ02OBddPKk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cI2bayVcWu7V8MwoNJ02OBddPKk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/2mQ9HEfnWlM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/7627897213577497332/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/08/basic-samples-for-ssl-communication.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/7627897213577497332?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/7627897213577497332?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/2mQ9HEfnWlM/basic-samples-for-ssl-communication.html" title="Basic samples for SSL communication over Qt" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>9</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/08/basic-samples-for-ssl-communication.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EAQnc6cCp7ImA9WxFWEkw.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-230482575894746158</id><published>2010-05-30T14:40:00.000+03:00</published><updated>2010-05-30T14:40:43.918+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-30T14:40:43.918+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="webkit" /><category scheme="http://www.blogger.com/atom/ns#" term="qt" /><category scheme="http://www.blogger.com/atom/ns#" term="chrome" /><category scheme="http://www.blogger.com/atom/ns#" term="maemo" /><category scheme="http://www.blogger.com/atom/ns#" term="n900" /><title>JavaScript benchmarking on N900 PR1.2</title><content type="html">Two months earlier, I did my &lt;a href="http://xizhizhu.blogspot.com/2010/03/javascript-benchmarking-on-n900-and-my.html"&gt;JavaScript benchmarking&lt;/a&gt; on N900 PR1.1, and compare it with other platforms. Now, as N900 PR1.2 got released, Opera has &lt;a href="http://labs.opera.com/news/2010/05/11/"&gt;released&lt;/a&gt; a preview for Maemo, and Chrome is ported to N900 by &lt;a href="http://jacekowski.org/maemo/index.html"&gt;Jacekowski&lt;/a&gt;, I did another round of benchmarking.&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;V8&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;SunSpider&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Peacekeeper&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;MicroB (default browser)&lt;/b&gt;&lt;/td&gt;&lt;td&gt;21.2&lt;/td&gt;&lt;td&gt;35.12&lt;/td&gt;&lt;td&gt;128&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;FireFox&lt;/b&gt;&lt;/td&gt;&lt;td&gt;21.4&lt;/td&gt;&lt;td&gt;15.84&lt;/td&gt;&lt;td&gt;141&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Opera&lt;/b&gt;&lt;/td&gt;&lt;td&gt;49.5&lt;/td&gt;&lt;td&gt;24.41&lt;/td&gt;&lt;td&gt;119&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Qt 4.6.2&lt;/b&gt;&lt;/td&gt;&lt;td&gt;105&lt;/td&gt;&lt;td&gt;12.04&lt;/td&gt;&lt;td&gt;238&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;&lt;a href="http://gitorious.org/+qtwebkit-packagers/webkit/qtwebkit-maemo5"&gt;QtWebKit 2.0&lt;/a&gt;&lt;/b&gt;&lt;/td&gt;&lt;td&gt;104&lt;/td&gt;&lt;td&gt;9.36&lt;/td&gt;&lt;td&gt;286&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Chrome&lt;/b&gt;&lt;/td&gt;&lt;td&gt;113&lt;/td&gt;&lt;td&gt;8.84&lt;/td&gt;&lt;td&gt;344&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;For V8 and Peacemaker, the higher the score, the better performance it has. For Sunspider, it's the lower the better.&lt;br /&gt;
&lt;br /&gt;
Chrome is really fast as a result of its excellent V8 JavaScript engine and frequent release cycle.&lt;br /&gt;
&lt;br /&gt;
Qt 4.6.2 is still quite good, especially considering the fact that the WebKit integrated is quite old. Note that QtWebKit will be released &lt;a href="http://labs.trolltech.com/blogs/2010/03/03/qtwebkit-releases/"&gt;separately&lt;/a&gt; from Qt, meaning we could enjoy more about the latest WebKit technology then.&lt;br /&gt;
&lt;br /&gt;
However, both Opera and FireFox (MicroB uses FireFox's Gecko JavaScript engine) have quite a long way to go. Moreover, when running V8 and Peacekeeper, both MicroB and FireFox complained about unresponsive JavaScript.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-230482575894746158?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/u2V5BrZ4H_BW_EN4A4neo0lZQ3M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/u2V5BrZ4H_BW_EN4A4neo0lZQ3M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/u2V5BrZ4H_BW_EN4A4neo0lZQ3M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/u2V5BrZ4H_BW_EN4A4neo0lZQ3M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/USF2D_kE4rA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/230482575894746158/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/05/javascript-benchmarking-on-n900-pr12.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/230482575894746158?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/230482575894746158?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/USF2D_kE4rA/javascript-benchmarking-on-n900-pr12.html" title="JavaScript benchmarking on N900 PR1.2" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/05/javascript-benchmarking-on-n900-pr12.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQNQns5fSp7ImA9Wx5REUs.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-4335408958209068783</id><published>2010-05-15T22:43:00.003+03:00</published><updated>2010-08-18T23:13:13.525+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-18T23:13:13.525+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="诺基亚" /><category scheme="http://www.blogger.com/atom/ns#" term="nokia" /><category scheme="http://www.blogger.com/atom/ns#" term="n900" /><title>这位评论真的用过N900吗？！</title><content type="html">刚看了一篇&lt;a href="http://mobile.it168.com/a2010/0515/886/000000886613_2.shtml"&gt;谈论手机杯具&lt;/a&gt;的文章，说的是N900。不过很怀疑这位老兄是否真的用过N900......&lt;br /&gt;
&lt;br /&gt;
文章说：N900最大的尴尬在于它那被消极淡化的通话功能。&lt;br /&gt;
话说Nokia对Maemo/MeeGo系列的定义是“移动电脑”（mobile computer）吧！打开N900的&lt;a href="http://maemo.nokia.com/n900/"&gt;官方首页&lt;/a&gt;，上面就写得非常清楚：Nokia N900 mobile computer。本来定位就不是智能手机，所以通话功能被“淡化”不正常吗？或者说你见过哪部PDA会“强化”电话功能的？好吧，你会说我这样强词夺理了，那我们接着看......&lt;br /&gt;
&lt;br /&gt;
然后文章对N900的“消极淡化通话功能”列出了几个“铁证”：&lt;br /&gt;
1，机身正面没有任何拨号快捷键，哪怕是触控按键都没有。&lt;br /&gt;
2，默认桌面菜单也没有任何与通话相关的快捷方式。&lt;br /&gt;
3，QWERTY全键盘采用了三排式的布局，因此并没有单独的数字键。也就是说，打开侧滑盖还是没法直接拨号。&lt;br /&gt;
4，没有竖屏模式，也就是说诺基亚设计它的初衷就是让你始终横着拿它。横着打电话？有难度吧。。。&lt;br /&gt;
&lt;br /&gt;
好吧，我们看图说话：&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_j2Abq_R5P6w/S-7vRN42zTI/AAAAAAAADZU/8rV6v-Fdswk/s1600/homescreen.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_j2Abq_R5P6w/S-7vRN42zTI/AAAAAAAADZU/8rV6v-Fdswk/s320/homescreen.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;这是我N900上四个桌面之一，上面可以任意摆设各种Widget、快捷方式和联系人，也可以自行调整其放置的位置。标号为1的红圈就是&lt;b&gt;联系人&lt;/b&gt;的快捷方式，标号为2的红圈是&lt;b&gt;最近通话和拨号功能&lt;/b&gt;的快捷方式，标号为3的红圈则是放在&lt;b&gt;单个联系人&lt;/b&gt;的快捷方式。当然单个联系人也是可以自定义头像的，只不过考虑到隐私我暂时删除罢了。&lt;br /&gt;
&lt;br /&gt;
当然了，默认情况下，桌面也是有联系人和最近通话的快捷方式的，好像也有邮件或者短信息的快捷方式......我就不刷机证明了啊;)&lt;br /&gt;
&lt;br /&gt;
当然了，既然有如此方便的软键盘拨号，为何还要打开侧滑盖呢？&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://4.bp.blogspot.com/_j2Abq_R5P6w/S-75JVseeNI/AAAAAAAADZs/WtWzvp3h_fw/s1600/20100515_001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_j2Abq_R5P6w/S-75JVseeNI/AAAAAAAADZs/WtWzvp3h_fw/s320/20100515_001.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
然后我们再看看“没有竖屏模式”的笑话！你点开最近通话和拨号功能，然后看下图：&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="http://3.bp.blogspot.com/_j2Abq_R5P6w/S-7zjLp2xUI/AAAAAAAADZc/qYLlr3R5u5o/s1600/portrait.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_j2Abq_R5P6w/S-7zjLp2xUI/AAAAAAAADZc/qYLlr3R5u5o/s320/portrait.jpeg" /&gt;&lt;/a&gt;&lt;/div&gt;我觉得这个应该叫做“竖屏模式”了吧？！而且通话功能的竖屏模式是默认开启的......&lt;br /&gt;
&lt;br /&gt;
我想，我只能说这位搞评论的朋友没有用过N900吧！&lt;br /&gt;
&lt;br /&gt;
PS 这三张照片都是用另一部N900的相机在晚上10点左右拍摄的，外界光线不好，室内也没开灯:)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-4335408958209068783?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rVJJ2a0gjlMyYzaw1248pDnSt0w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rVJJ2a0gjlMyYzaw1248pDnSt0w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rVJJ2a0gjlMyYzaw1248pDnSt0w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rVJJ2a0gjlMyYzaw1248pDnSt0w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/OY5lchrH5lo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/4335408958209068783/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/05/n900.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4335408958209068783?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4335408958209068783?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/OY5lchrH5lo/n900.html" title="这位评论真的用过N900吗？！" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_j2Abq_R5P6w/S-7vRN42zTI/AAAAAAAADZU/8rV6v-Fdswk/s72-c/homescreen.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/05/n900.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IDRH8_eCp7ImA9WxFSFkk.&quot;"><id>tag:blogger.com,1999:blog-1750396291995171919.post-4151110868702109407</id><published>2010-03-20T15:11:00.027+02:00</published><updated>2010-04-19T05:52:55.140+03:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-19T05:52:55.140+03:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="webkit" /><category scheme="http://www.blogger.com/atom/ns#" term="chrome" /><category scheme="http://www.blogger.com/atom/ns#" term="iphone" /><category scheme="http://www.blogger.com/atom/ns#" term="maemo" /><category scheme="http://www.blogger.com/atom/ns#" term="n900" /><title>JavaScript benchmarking on N900 and my laptop</title><content type="html">I just ran some JavaScript benchmark tests of &lt;a href="http://v8.googlecode.com/svn/data/benchmarks/v5/run.html"&gt;V8 version 5&lt;/a&gt;, &lt;a href="http://www2.webkit.org/perf/sunspider-0.9.1/sunspider-0.9.1/driver.html"&gt;SunSpider v0.9.1&lt;/a&gt; and &lt;a href="http://service.futuremark.com/peacekeeper/run.action"&gt;Peacekeeper&lt;/a&gt; on my laptop. My laptop is HP EliteBook 6930p, which has Intel Core 2 Duo CPU P8600 @ 2.40GHz, 4 GB RAM, running KUbuntu 9.10 with kernel 2.6.31-20-generic. Also, I ran it on my N900 PR1.1 with Qt 4.6.2, and collected some results for &lt;a href="http://arstechnica.com/apple/reviews/2009/06/iphone-3g-s-review.ars/6"&gt;iPhone 3GS&lt;/a&gt;, &lt;a href="http://www.gubatron.com/blog/2010/01/10/droid-vs-nexus-1-sunspider-javascript-benchmark-showdown/"&gt;Droid and Nexus One&lt;/a&gt;, and &lt;a href="http://mobile.zol.com.cn/174/1744080.html"&gt;HTC Desire&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The following scores are from &lt;strong&gt;V8&lt;/strong&gt;, the higher the better.&lt;br /&gt;
FireFox for Ubuntu 3.5.8 - 248&lt;br /&gt;
Qt 4.6.2 – 910&lt;br /&gt;
Chrome 5.0.307.11 Beta – 4155&lt;br /&gt;
QtWebKit 2.0 – 2816&lt;br /&gt;
N900 - 105&lt;br /&gt;
iPhone 3GS - no results&lt;br /&gt;
Droid - 39.5&lt;br /&gt;
Nexus One - 63.5&lt;br /&gt;
HTC Desire - 66.1&lt;br /&gt;
&lt;br /&gt;
Then I found some &lt;a href="http://arstechnica.com/apple/reviews/2009/06/iphone-3g-s-review.ars/6"&gt;results&lt;/a&gt; of iPhone 3GS for V8 version 3:&lt;br /&gt;
N900 - 103&lt;br /&gt;
iPhone 3GS - 53&lt;br /&gt;
&lt;br /&gt;
The following scores are from &lt;strong&gt;SunSpider&lt;/strong&gt;, the lower the better.&lt;br /&gt;
FireFox for Ubuntu 3.5.8 – 2484.7&lt;br /&gt;
Qt 4.6.2 – 1136.0&lt;br /&gt;
Chrome 5.0.307.11 Beta – 462.1&lt;br /&gt;
QtWebKit 2.0 – 635.6&lt;br /&gt;
N900 - 12.5&lt;br /&gt;
iPhone 3GS - 16.7&lt;br /&gt;
Droid - 34.2&lt;br /&gt;
Nexus One - 14.7&lt;br /&gt;
HTC Desire - 12.02&lt;br /&gt;
&lt;br /&gt;
The following scores are from &lt;strong&gt;Peacekeeper&lt;/strong&gt;, the higher the better.&lt;br /&gt;
FireFox for Ubuntu 3.5.8 – 1510&lt;br /&gt;
Qt 4.6.2 – 3261&lt;br /&gt;
Chrome 5.0.307.11 Beta – 4324&lt;br /&gt;
QtWebKit 2.0 – 4288&lt;br /&gt;
N900 - 244&lt;br /&gt;
&lt;br /&gt;
Chrome’s V8 engine is &lt;span style="color: red;"&gt;&lt;strong&gt;really fast&lt;/strong&gt;&lt;/span&gt;, and WebKit still has a long way to go!&lt;br /&gt;
&lt;br /&gt;
Also, N900 performs &lt;span style="color: red;"&gt;&lt;strong&gt;much better&lt;/strong&gt;&lt;/span&gt; than iPhone 3GS, Droid and Nexus. Considering HTC Desire, N900 wins easily on V8, but lost a little on SunSpider. However, if you consider MicroB, the default browser on N900, it’s a &lt;b&gt;disaster&lt;/b&gt; due to the slow engine of Gecko and N900 even used a pretty old version.&lt;br /&gt;
&lt;br /&gt;
Then the &lt;a href="http://acid3.acidtests.org/"&gt;ACID3&lt;/a&gt; test.&lt;br /&gt;
FireFox for Ubuntu 3.5.8 – 93&lt;br /&gt;
Qt 4.6.2 – 100&lt;br /&gt;
Chrome 5.0.307.11 Beta – 100&lt;br /&gt;
QtWebKit 2.0 – 100&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* The test for QtWebKit 2.0 is done with the revision number of 56441.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1750396291995171919-4151110868702109407?l=xizhizhu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/W_UUwpqLFFO1bs5X1aO8J1n2cgE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W_UUwpqLFFO1bs5X1aO8J1n2cgE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/W_UUwpqLFFO1bs5X1aO8J1n2cgE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W_UUwpqLFFO1bs5X1aO8J1n2cgE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/heBM/~4/stajxn99mMI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://xizhizhu.blogspot.com/feeds/4151110868702109407/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://xizhizhu.blogspot.com/2010/03/javascript-benchmarking-on-n900-and-my.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4151110868702109407?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/1750396291995171919/posts/default/4151110868702109407?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/heBM/~3/stajxn99mMI/javascript-benchmarking-on-n900-and-my.html" title="JavaScript benchmarking on N900 and my laptop" /><author><name>Xizhi Zhu</name><uri>http://www.blogger.com/profile/11132645470363367082</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="26" height="32" src="http://bp2.blogger.com/_j2Abq_R5P6w/SD4zbE6izGI/AAAAAAAAAWk/FFfsf_dL-Bs/S220/blogphotoxizhizhu.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://xizhizhu.blogspot.com/2010/03/javascript-benchmarking-on-n900-and-my.html</feedburner:origLink></entry></feed>

