<?xml version="1.0" encoding="GBK" ?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dcterms="http://purl.org/dc/terms/">
 <channel>
  	  <title><![CDATA[天水一方]]></title>
	  <link>http://wanweiqun.blog.163.com</link>
	  <description><![CDATA[在天边，在水一方！ 我是谁？谁是我？我是我的谁？谁是谁的我？]]></description>
	  <language>zh-CN</language>
	  <pubDate>Sat, 5 Jul 2008 15:53:56 +0800</pubDate>
	  <lastBuildDate>Sat, 5 Jul 2008 15:53:56 +0800</lastBuildDate>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <generator><![CDATA[NetEase Space]]></generator>
	  <managingEditor><![CDATA[wanweiqun]]></managingEditor>
	  <webMaster><![CDATA[kokko]]></webMaster>
		  <ttl>120</ttl>
	  <image>
	  	<title><![CDATA[天水一方]]></title>
	  	<url>http://ava.blog.163.com/photo/h5t82ha9z2krPlBuraBzSQ==/175921860444427027.jpg</url>
	  	<link>http://wanweiqun.blog.163.com</link>
	  </image>
  <item>
  	<title><![CDATA[what do you want????]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/20915592008652507918</link>
    <description><![CDATA[<div><font size="4">to be or not to be,that is the question!!<br>whether 'its nobler in the mind to suffer!<br>the slings and arrows of cutrageous fortune<br>or to take arms against a sea of troubles<br>or to take arms against a sea of troubles<br>and by opposing end them <br>to die ;to sleep NO more;and by a sleep,to say we end<br>the heart-ache;and the thousand natural shocks<br>that flesh is heir to;'tis a consummation devoutly to be wish'd</font></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/20915592008652507918</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/20915592008652507918</guid>
    <pubDate>Sat, 5 Jul 2008 14:50:07 +0800</pubDate>
    <dcterms:modified>2008-07-05T14:50:07+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[电子商务网站垂直搜索分析(转载)]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920086524922745</link>
    <description><![CDATA[<div><p>
　　在本系列的第二篇文章中分析了现有垂直搜索中的两个行业：房地产搜索(搜房网、焦点网等)和招聘搜索(职脉网、职友集等)。这些分析仅仅是从技术角度
出发，对垂直搜索的一些技术性能做了比较，和商业模式并没有什么关系。从分析结构可以看得出来，作为后起之秀的职脉搜索、酷讯搜索在技术性能上表现不错。
本文将继续对电子商务领域的垂直搜索做一些比较分析。
</p>
<p>
　　三、 购物类：
</p>
<p>　　购物搜索在美国和欧洲已经完全被网民所接受，甚至已经成为各大搜索引擎聚头的主要收入来源之一。现在的购物搜索一个最大特点就是比价购物，就是
利用爬虫获取各电子商务网站上的商品信息，然后根据用户的输入，列出同一产品在不同购物网站上的价格，更好一些的购物搜索还可以对商品的外观、质量等等其
他属性进行比较，方便用户的网上消费。美国的主要购物搜索有：Shopping.com(18.38%),BizRate(17.35%), <a href="http://searchwhatis.techtarget.com.cn/searchwhatis/66/2026566.shtml" target="_blank" >Yahoo</a>
Shopping(14.39%), Shopzilla(13.6%), Froogle(8.49%), MSN
eShop(3.76%)。从其中可以看出，尽管在垂直搜索领域也有开放式搜索巨头的进入，然而和一些专业的垂直搜索相比，其市场份额并非占主导地位。对
于国内的购物搜索，还处于起步阶段，主要源于两个原因：a)电子商务网站的不完善;b)用户的网络购买量不大。下面列出了四家购物搜索做一个比较。
</p>
<p>
　　1)www.8848.com alexa排名：26960
</p>
<p>
　　8848最初是一家纯粹的电子B2C购物网站，2003年9月，8848重新开始筹备新的业务发展规划，将业务重点转向建立中国第一个专业购物搜索引擎——8848购物引擎。目前8848是一家搜索和商品发布同时存在的一个电子商务综合网站。
</p>
<p>
　　爬虫：支持
</p>
<p>
　　搜索速度：慢
</p>
<p>
　　分词支持：不支持
</p>
<p>
　　相关度排序：不支持
</p>
<p>
　　容错支持(模糊搜索)：不支持
</p>
<p>
　　易用性：较好
</p>
<p>
　　附加一点：该搜索引擎很不稳定，经常down机
</p>
<p>
　　2)shopping.sogou.com
</p>
<p>
　　是搜狐旗下搜狗搜索引擎的一个新推出的产品，处于测试阶段，很不稳定。测试页面没有打开，故以下数据均为空。
</p>
<p>
　　爬虫：无
</p>
<p>
　　搜索速度：无
</p>
<p>
　　分词支持：无
</p>
<p>
　　相关度排序：无
</p>
<p>
　　容错支持(模糊搜索)：无
</p>
<p>
　　易用性：无
</p>
<p>
　　3)www.yok.com alexa排名：416
</p>
<p>
　　这是一家元搜索引擎提供商，即综合了各个主流搜索引擎或者内容提供商站内搜索的内容。没有自己的引擎和索引。搜索性能完全受宿主搜索引擎的性能。
</p>
<p>
　　爬虫：无
</p>
<p>
　　搜索速度：无
</p>
<p>
　　分词支持：无
</p>
<p>
　　相关度排序：无
</p>
<p>
　　容错支持(模糊搜索)：无
</p>
<p>
　　易用性：无
</p>
<p>
　　4)www.askyaya.com alexa排名：1796
</p>
<p>
　　比价购物搜索的代表，东方网旗下的网站，自称为继搜狐之后第 2 个自主拥有搜索引擎核心技术的门户网站。
</p>
<p>
　　爬虫：有
</p>
<p>
　　搜索速度：较快
</p>
<p>
　　分词支持：不支持
</p>
<p>
　　相关度排序：不支持
</p>
<p>
　　容错支持(模糊搜索)：不支持
</p>
<p>
　　易用性：一般
</p>
<p>
　　四.B2B搜索类
</p>
<p>　　B2B搜索主要是根据用户输入的关键词找到提供和关键词相关产品或者服务的商家，通常包括供货搜索、求购搜索、企业搜索等。B2B搜索在国内已
经比较成熟，像早期的114查询，其实就是B2B搜索的雏形，目前像中国黄页网，各地的黄页网，阿里巴巴、铭万网等都提供了该功能，但性能都一般，下面给
出几个典型的B2B搜索的代表网站，做一分析比较。
</p>
<p>
　　1)b2b.sogou.com alexa排名：4978
</p>
<p>
　　搜狐旗下的B2B搜索，主要是提供了对搜狐黄页内部的企业信息进行搜索的功能。
</p>
<p>
　　爬虫：无
</p>
<p>
　　搜索速度：较快
</p>
<p>
　　分词支持：不支持
</p>
<p>
　　相关度排序：支持
</p>
<p>
　　容错支持(模糊搜索)：不支持
</p>
<p>
　　易用性：较好
</p>
<p>
　　2)www.bseek.com alexa排名：无
</p>
<p>
　　一个专门的B2B搜索引擎，刚推出不久，综合性能一般。
</p>
<p>
　　爬虫：有
</p>
<p>
　　搜索速度：慢
</p>
<p>
　　分词支持：支持
</p>
<p>
　　相关度排序：不支持
</p>
<p>
　　容错支持(模糊搜索)：不支持
</p>
<p>
　　易用性：较好
</p>
<p>
　　3)www.hc360.com alexa排名：126
</p>
<p>
　　慧聪旗下的B2B搜索引擎，使用了中搜的引擎，核心技术不错。主要提供了供求、产品、公司、价格等搜索。数据源来自慧聪网。
</p>
<p>
　　爬虫：有
</p>
<p>
　　搜索速度：一般
</p>
<p>
　　分词支持：支持
</p>
<p>
　　相关度排序：不支持
</p>
<p>
　　容错支持(模糊搜索)：不支持
</p>
<p>
　　易用性：较好
</p>
<p>
　　4)www.b2b8.com alexa排名：4839
</p>
<p>
　　一家专门提供B2B搜索的网站，做了B2B网站联盟，是国内最早提供商机搜索的网站之一。在B2B搜索领域，算是比较有规模的搜索网站。但其引擎的技术性能非常一般，还需要很大的改进!
</p>
<p>
　　爬虫：有
</p>
<p>
　　搜索速度：很慢
</p>
<p>
　　分词支持：不支持
</p>
<p>
　　相关度排序：不支持
</p>
<p>
　　容错支持(模糊搜索)：不支持
</p>
<p>
　　易用性：一般
</p>
<p>
　　以上对目前国内典型的几家购物搜索和B2B搜索做了一些技术方面的分析，所有内容仅为个人测评的结果和观点，各位朋友如有异议之处，发送邮件联系我：
</p>
<p>
　　本文同时发表在 http://blog.jobmet.com/entry.php?u=doudou
</p>
<p>
　　作者联系方式：zhaojian513@<a href="http://searchwhatis.techtarget.com.cn/searchwhatis/175/2093175.shtml" target="_blank" >gmail</a>.com
</p></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920086524922745</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920086524922745</guid>
    <pubDate>Sat, 5 Jul 2008 14:49:22 +0800</pubDate>
    <dcterms:modified>2008-07-05T14:49:22+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[告诉你如何做网站运营(转)]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/20915592008652487362</link>
    <description><![CDATA[<div><p>&nbsp;&nbsp;&nbsp; 1. 网站需要有好的内容<br>
2. 用户贡献内容是第一步。用好的方式找到有价值的内容是第二步。为找到的好内容找到合适的，感兴趣的读者是第三步。让用户互动起来是第四步。<br>
3. 好的方式找到有价值的内容的方法有两种。一种是事先过滤，是预测性的，过滤什么，不过滤什么，靠的是少数编辑；另一种是事后过滤，我们不知道什么东西是好的，什么东西是流行的，我们只懂得监测，观察，分析，靠的是大量的用户数据。<br>
4.
事先过滤:靠的是少数编辑对于大众口味，流行趋势的把握，他们最乐于的事情是根据自己的判断与理解调整所推荐的内容和位置，并从事后的Pageview的
反映来检测自己的价值判断，通过这样的反复检测，最终形成自己对于流行，对于热点的理解，以此为指导思想来承担过滤的工作。事实上，经过一系列的正反馈的
锻炼之后，成就了一个优秀的编辑，我们这个世界的热点就是由这样一群人所制造出来的。他们的价值不可否认!<br>
5. 事后过滤: 靠的科学的对大量的用户数据进行挖掘，无论是是根据Pagerank来判断一个网页的价值，还是根据浏览者的喜好趋势推荐相关物品，又或者根据一系列小众群体的收藏，评论，digg行为找出优质内容，这样的手段都是2.0的核心<br>
<br>
网站运营之前我们还需要更深入的了解下我们的网站：<br>
1. 我们的网站为谁服务？目的是什么？<br>
2. 正在做什么？如何做的更好？<br>
3. 互联网的100：9：1法则同样适用我们的网站--大部分用户不做任何事情<br>
4. 给用户足够的提示或演示，让用户明白他们正在做什么<br>
5. 核心用户最为重要，我们必须花精力培养核心用户，并维护好他们，特别是在早期。<br>
6. 同时要引导新鲜的血液。欢迎他们，引导他们，满足他们。<br>
7. 寻找提供给用户可玩性的功能，满足游戏心态。如，提供排行榜让用户更积极。。。<br>
8. 请记住我们不是网站的“主人”。记住：用户只是在我们这开party，而我们并不是他们的“老板”<br>
9. 信誉重于生命。对人如此，对网站同样如此。<br>
<br>
现实一些, 别好高骛远, 目标庞大常常导致失败<br>
*&nbsp;少就是多, 把产品做得尽可能的简单, 小巧<br>
* 注重前期的设计, 尤其是界面的<br>
* 宁可做一点点好东西, 也不要一大堆垃圾.&nbsp; 也就是宁缺勿滥, 这个用于项目目标,用于选人, 也用于项目本身的进度</p></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/20915592008652487362</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/20915592008652487362</guid>
    <pubDate>Sat, 5 Jul 2008 14:48:07 +0800</pubDate>
    <dcterms:modified>2008-07-05T14:48:07+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[今天]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920086524641509</link>
    <description><![CDATA[<div><p>&nbsp;&nbsp;&nbsp;
今天4月29号了，时间过得还真快，转眼，从妈妈肚子里出来有24载了。首先，我要谢谢朋友们的祝福！我要说的是：我会快乐的！呵呵，其实人生就是这样
的，有痛有乐，今天是我离开爸妈以来第一次过生日！以前我一直把自己的生日当成人生中的负担，唉，也说不清楚。只是每当我生日的时候，我就会想起生我的父
母把我含辛茹苦的养大的辛酸。自读大学以来，我心理有的多是负担。我天天害怕自己将来不能混出个名堂，害怕对不起父辈们的栽培，所以我努力学习，从那时起
我就害怕长大，也就害怕自己的生日了，当别人都在开party庆祝自己又大了一岁的时候，我只能告诉自己：再努力点，到30岁的时候，再过生日吧！没想到
时间过得这么快，一转眼就快奔30了。面对自己的人生和生命中的一切，我只想对我的生活说声谢谢！谢谢那些给我快乐，帮助，和痛苦伤心的人们，是父母给我
带来了生命，而是你们给我带来了人生中的酸甜苦辣，还有那种种回忆！而不论他们是美好的还是痛苦的，这都将是我人生中一道道靓丽的风景！</p><p>&nbsp;&nbsp;&nbsp; 最后我要说的是：现在拥有的、曾经拥有的和即将拥有的，不论今天，还是明天，我都很开心快乐！再次谢谢大家的祝福！在这里也祝大家天天快乐！</p></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920086524641509</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920086524641509</guid>
    <pubDate>Sat, 5 Jul 2008 14:46:41 +0800</pubDate>
    <dcterms:modified>2008-07-05T14:46:41+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[nslookup]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920086510533824</link>
    <description><![CDATA[<div>C:\Documents and Settings\kokko&gt;nslookup www.itbeing.com<br>Server:&nbsp; dialdns.bta.net.cn<br>Address:&nbsp; 202.106.46.151<br><br>Non-authoritative answer:<br>Name:&nbsp;&nbsp;&nbsp; premium10.geo.yahoo8.akadns.net<br>Addresses:&nbsp; 68.142.212.128, 68.142.212.130, 68.142.212.140, 68.142.212.138<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 68.142.212.141, 68.142.212.120, 68.142.212.127, 68.142.212.129<br>Aliases:&nbsp; www.itbeing.com</div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920086510533824</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920086510533824</guid>
    <pubDate>Sat, 5 Jul 2008 10:53:38 +0800</pubDate>
    <dcterms:modified>2008-07-05T10:53:38+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[准备走自己的路]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920086311229641</link>
    <description><![CDATA[<div>
终于到家了，这几天有点累，有很多人都关心我的去向，呵呵，纷纷打来电话来问我有什么打算，我在这里谢谢大家关心，想了很久，决定为自己做点什么事情，趁
着现在还年轻，去追求自己的梦想。有朋友说我应该再锻炼几年，可以找家顶级公司或者出国看看，日本的一个朋友打来电话，邀请我出国远渡日本，我婉言拒绝
了，其实我一直以为出国是一种逃避现实的方式，不到万不得已，我还是不愿意出去的，我宁愿待在国内，有朋友说我应该自己做点事情，希望我回去广州，能一起
做点事情。思前想后，我也觉得是该出去走走的时候了，虽然时机似乎还不是很成熟，但是我不能一直等下去，再等下去就30岁了，等到一切都成熟，我的人生也
已经走完了，毕竟人生是一个过程，不管是失败还是成功，我都希望自己能做自己想做的事情，爱自己该爱的人。所以，我想对自己说，准备走自己的路吧！ 

&nbsp;&nbsp;&nbsp;&nbsp; 同时我也看清楚了一些事情，也许是我太年轻了，容易被人忽悠吧，呵呵，不过我想这是最后一次吧。人不可能在一个地方跌倒两次吧。祝自己好运吧<br>
&nbsp;&nbsp;&nbsp;&nbsp; 最后还是要再次感谢大家的关心，让我知道这个世界上除了我的父母和亲人，还有人在关心我，谢谢你们啦，也谢谢你们的建议，我会努力的！</div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920086311229641</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920086311229641</guid>
    <pubDate>Thu, 3 Jul 2008 23:22:09 +0800</pubDate>
    <dcterms:modified>2008-07-03T23:22:09+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[困扰我的几个问题]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/20915592008631080916</link>
    <description><![CDATA[<div>最近我一直在思考几个问题：<br>
1、当初马云回杭州的时候，为什么他一句话，就有那么多人跟着他走？<br>
2、当初马云带会杭州的团队，为什么他们在创业的过程中就没有一人离开？而百度一上市，CTO就离职了？<br>
3、当年马云带回去的团队，学历也都不高，有的甚至是他的学生，刚刚毕业，也没有什么经验，而现在他们有的身为部门高级主管，有的还是底层干部？像孙彤宇，贵为淘宝总裁，阿里巴巴副总裁戴珊，有还是经理的麻长炜？</div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/20915592008631080916</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/20915592008631080916</guid>
    <pubDate>Thu, 3 Jul 2008 22:08:00 +0800</pubDate>
    <dcterms:modified>2008-07-03T22:08:00+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[CNO]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920086211512757</link>
    <description><![CDATA[<div><p>跟朋友聊天，他问我昨天跟他说的CNO是什么意思，我百度了一下，百度知道解释如下：<br>ChiefNegotiationOfficer&nbsp; 首席谈判官 
<br>释义：现代企业和商务活动成功与否，极大程度上取决于谈判技巧与能力。毋庸置疑，首席谈判官必须炼就卓越的谈判策划和实战能力，才能成为商界的赢家，才能在掌控自己命运时得心应手。首席谈判官负责架构公司谈判团队，介绍最有效的谈判技能，阐释最新颖独到的谈判理念。<br>CNO：News 
首席新闻官，向媒体披露公司网站被黑、裁员、被收购等重大新闻。<br><br>我自己的释义：<br>CNO：Chief N 
officer，首席集成官，哪里缺人就补哪里，什么都做，叫做CNO。 </p></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920086211512757</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920086211512757</guid>
    <pubDate>Wed, 2 Jul 2008 23:05:12 +0800</pubDate>
    <dcterms:modified>2008-07-05T14:43:11+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[创业者成功之道]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920086181847607</link>
    <description><![CDATA[<div><p  style="margin: 0cm 0cm 0pt; text-indent: 21pt;"><span style="font-family: 宋体;">做一个好人；</span></p>
<p  style="margin: 0cm 0cm 0pt; text-indent: 21pt;"><span style="font-family: 宋体;">认识几个好人；</span></p>
<p  style="margin: 0cm 0cm 0pt; text-indent: 21pt;"><span style="font-family: 宋体;">遇上一个好机会；</span></p>
<p  style="margin: 0cm 0cm 0pt; text-indent: 21pt;"><span style="font-family: 宋体;">有几个好点子；</span></p>
<p  style="margin: 0cm 0cm 0pt; text-indent: 21pt;"><span style="font-family: 宋体;">坚持干下去。</span></p></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920086181847607</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920086181847607</guid>
    <pubDate>Tue, 1 Jul 2008 08:18:47 +0800</pubDate>
    <dcterms:modified>2008-07-01T08:18:47+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[背包算法]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/2091559200853044634295</link>
    <description><![CDATA[<div><pre><font color="#0d00e0"><p>/**<br> * 背包问题<br> * 背包问题是计算机科学里的经典问题。在最简单的形式中，包括试图将不同重量的数据项放到<br> * 背包中．以使背包最后达到指定的总重量。不需要把所有的选项都放入背包中。<br> * 举例来说，假设想要背包精确地承重20磅，并且有5个可以选择放入的数据项，它们的重量<br> * 依次为11磅、8磅、7磅、6磅和5磅。对于选择放入的数据项数量不大时，人类很善于通过观察<br> * 就可以解决这个问题。于是大概可以计算出只有8磅、7磅和5磅的数据项加在一起和为20磅。<br> * 如果想要计算机来解决这个问题，就需要给计算机更详细的指令。算法如下：<br> * 1．如果在这个过程中的任何时刻，选择的数据项的总和符合目标重量，工作就完成了。<br> * 2．从选择第一个数据项开始。剩余的数据项的加和必须符合背包的目标重量减去第一个数据&nbsp;&nbsp;</p><p> *&nbsp;&nbsp;&nbsp;&nbsp; 项的重量；这是一个新的目标重量。<br> * 3．逐个地试每种剩余数据顶组合的可能性。但是，注意并不需要去试所有的组合，因为只要&nbsp;&nbsp;</p><p> *&nbsp;&nbsp;&nbsp;&nbsp; 数据顶朗和大于目标重量的时候，就停止添加数据项。<br> * 4．如果设有组合合适的话，放弃第—‘个数据项，并且从第二个数据项开始再重复一边整个&nbsp;&nbsp;</p><p> *&nbsp;&nbsp;&nbsp;&nbsp; 过程。<br> * 5．继续从第三个数据项开始，如此下去直到你已经试过所有的组合，这时知道没有解决答案&nbsp;&nbsp;</p><p> *&nbsp;&nbsp;&nbsp;&nbsp; 。<br> *&nbsp;&nbsp;&nbsp;&nbsp; 在刚刚描述的这个例子中，从11开始。现在想要剩余的数据项和为9(20减去u)。对于9，<br> *&nbsp;&nbsp;&nbsp;&nbsp; 从很小的8开始。现在想要剩余的数据项和为1(9减去8)。从7开始，但是它大于L，于是尝&nbsp;&nbsp;</p><p> *&nbsp;&nbsp;&nbsp;&nbsp; 试6，然后试5*它们都太大了d现在已经试过了所有的数据项，所以知道包含8的任何组合&nbsp;&nbsp;&nbsp;</p><p> *&nbsp;&nbsp;&nbsp;&nbsp; 和都不可能为9。接着尝试7，于是现在开始找的目标为2(9减去7)。<br> *<br> */</p><p>public class Beibao{<br>&nbsp;&nbsp;&nbsp;&nbsp; static int[] a=new int[5]; //背包重量<br>&nbsp;&nbsp;&nbsp;&nbsp; static int[] b=new int[5]; //结果数组<br>&nbsp;&nbsp;&nbsp;&nbsp; static int flag=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //下一个候选项<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp; static int bound=20;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //总重量<br>&nbsp;&nbsp;&nbsp;&nbsp; static int totle=0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //每次选择后的总重量<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp; public static void inserttry(int i,int leftbound,int t){<br>&nbsp;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bsp;&nbsp; }<br>}&nbsp; <br></p><br><p><br></p><p>今天碰到一个问题，有哥们问我背包算法的实现，我写了一下，之后看到在</p><p>http://bbs.phpchina.com/viewthread.php?tid=67540&amp;extra=&amp;page=3有人用php实现了！</p><p>有时间可以把算法总结一下！</p><p>$str = 'A:80  B:158  C:464  D:608  E:1326  F:5164  G:2724  H:1452';<br>$str = explode('  ',$str);<br>$product = array();<br>foreach($str as $_str){<br> $val = explode(':',$_str);<br> $product[$val[0]] = $val[1];<br>}<br>sort($product);<br>$total = 1166;<br>$sub = array();<br>foreach($product as $key=&gt;$val){<br> if($val&lt;=$total){<br>  $sub[$key] = $val;<br> }<br>}<br></p></font></pre></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/2091559200853044634295</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/2091559200853044634295</guid>
    <pubDate>Mon, 30 Jun 2008 16:46:34 +0800</pubDate>
    <dcterms:modified>2008-06-30T16:48:26+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[Mysql保存图片示例]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/20915592008550847782</link>
    <description><![CDATA[<div><P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我们通常在数据库中所使用的文本或整数类型的字段来保存数据，假如我们现在需要将图片保存到数据库该怎么办呢？</SPAN><FONT face="Times New Roman"> <SPAN lang=EN-US>MySQL</SPAN></FONT><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据库使用专门的字段来保存大容量的数据，数据类型为</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BLOB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BLOB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是一个二进制大对象，可以容纳可变数量的数据；有</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">4</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">种</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BLOB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类型：</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">TINYBLOB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">BLOB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MEDIUMBLOB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">LONGBLOB</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，区别在于他们容纳的数据的最大长度不同。</SPAN></P>
<H2 style="MARGIN: 13pt 0cm"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">保存图片</SPAN></H2>
<P style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore"><FONT face="Times New Roman">1、<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></FONT></SPAN></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">创建数据表保存图片</SPAN><SPAN lang=EN-US></SPAN></B></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">CREATE TABLE images(</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>id int NOT NULL AUTO_INCREMENT PRIMARY KEY,</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>image BLOB</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">);</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">说明：</SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">id----</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">主键</SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">image----</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用来保存图片的</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">blob</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">对象字段。</SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1; tab-stops: list 18.0pt"><FONT face="Times New Roman"><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="mso-fareast-font-family: 'Times New Roman'"><SPAN style="mso-list: Ignore">2、<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>PHP</SPAN></B></FONT><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">脚本上传图片</SPAN><SPAN lang=EN-US></SPAN></B></P>
<P style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上传界面</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">upload.html</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><SPAN lang=EN-US></SPAN></B></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;head&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;title&gt;</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上传图片</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/title&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/head&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;body&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;form method="post" enctype="multipart/form-data" action="upload.php"&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图片</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">&lt;input type="file" name="images" value="" /&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;input type="submit" value="upload" /&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/form&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/body&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/html&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上传脚本</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">upload.php</FONT></SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：</SPAN><SPAN lang=EN-US></SPAN></B></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?php</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">if(isset($_FILES['images'])){</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if($_FILES['images']['error']){</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>die("Please upload a photo!&lt;a href='javascript:history.back()'&gt;go back&lt;/a&gt;");</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}else{</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$uploaddir = './';</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$uploadfile = $uploaddir . basename($_FILES['images']['name']);</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$isUpload = false;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$tmpName = $_FILES['images']['tmp_name'];</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$size = filesize($tmpName);</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if($size&gt;0){</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$photo = addslashes(fread(fopen($tmpName,'r'),$size));</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>include( "class.Mysql.php" );</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$conn = new Mysql();</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$conn-&gt;connect( 'localhost', 'root', '123456','test');</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$sql = "INSERT INTO images (image) VALUES ('$photo')";</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if($conn-&gt;query( $sql ))</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>echo "File is valid, and was successfully uploaded.\n";</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>else</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>echo "Mysql query error!\n";</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>die("&lt;a href='javascript:history.back()'&gt;go back&lt;/a&gt;");</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">}</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">?&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&nbsp;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这样，我们就可以成功的把图片保存到数据库中。</SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">注：</SPAN><SPAN lang=EN-US></SPAN></B></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果在将图片插入</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MySQL</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的过程中出现问题，可以检查一下</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">MySQL</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">数据库所允许的最大数据包的大小。</SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&nbsp;</FONT></SPAN></P>
<H2 style="MARGIN: 13pt 0cm"><SPAN style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">显示图片</SPAN></H2>
<P style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图片读取显示脚本</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">show.php:</FONT></SPAN></B></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?php</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">include( "class.Mysql.php" );</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">$id = intval($_GET['id']);</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">if($id&gt;0){</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$conn = new Mysql();</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$conn-&gt;connect( 'localhost', 'root', '123456','test');</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$sql = "SELECT * FROM `images` WHERE `id`={$id}";</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$rs = $conn-&gt;getOne($sql);</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>if(!empty($rs)){</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>header( "Content-type: image/jpg");</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>echo $rs['image'];</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}else{</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>die("No data is founded!Please check the id was correct!");</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">}else{</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>die("Param error!");</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">}</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">?&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">界面显示脚本</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">photo.php:</FONT></SPAN></B></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;?php</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">$id = intval($_GET['id']);</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">if($id&lt;=0){</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman"><SPAN style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>die("Id param value Losted!");</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">}</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">?&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;head&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;title&gt;</FONT></SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图片显示</SPAN><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/title&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/head&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;body&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;img src="show.php?id=&lt;?=$_GET['id']?&gt;" /&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/body&gt;</FONT></SPAN></P>
<P style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US><FONT face="Times New Roman">&lt;/html&gt;</FONT></SPAN></P>
<P><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">显示结果：</SPAN></P>
<P><SPAN style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><A href="http://img.blog.163.com/photo/bPMidt90RHzp46JE5lxnDg==/2009731333714832428.jpg" target=_blank><IMG src="http://img.blog.163.com/photo/bPMidt90RHzp46JE5lxnDg==/2009731333714832428.jpg"></A></SPAN></P></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/20915592008550847782</comments>
    <slash:comments>1</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/20915592008550847782</guid>
    <pubDate>Thu, 5 Jun 2008 12:08:47 +0800</pubDate>
    <dcterms:modified>2008-06-05T12:08:47+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[Linux Shell脚本]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/20915592008542424420</link>
    <description><![CDATA[<div>参考：<br><a href="http://www.linuxsir.org/main/?q=node/135" target="_blank">http://www.linuxsir.org/main/?q=node/135</a><br><a href="http://www.linuxsir.org/main/?q=node/134" target="_blank">http://www.linuxsir.org/main/?q=node/134</a><br></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/20915592008542424420</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/20915592008542424420</guid>
    <pubDate>Wed, 4 Jun 2008 14:04:24 +0800</pubDate>
    <dcterms:modified>2008-06-04T14:04:51+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[使用ETags减少Web应用带宽和负载]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920085333622203</link>
    <description><![CDATA[<div><h2>介绍 </h2>
<p>最近，大众对于REST风格应用架构表现出强烈兴趣，这表明Web的优雅设计开始受到人们的注意。现在，我们逐渐理解了“<a href="http://www.w3.org/TR/webarch/">3W架构</a>（Architecture
of the World Wide
Web）”内在所蕴含的可伸缩性和弹性，并进一步探索运用其范式的方法。本文中，我们将探究一个可被Web开发者利用的、鲜为人知的工具，不引人注意的
“ETag响应头（ETag Response
Header）”，以及如何将它集成进基于Spring和Hibernate的动态Web应用，以提升应用程序性能和可伸缩性。 </p>
<p>我们将要使用的Spring框架应用是基于“宠物诊所（petclinic）”的。下载文件中包含了关于如何增加必要的配置及源码的说明，你可以自己尝试。 </p>
<h2>什么是“ETag”？ </h2>
<p>HTTP协议规格说明定义ETag为“被请求变量的实体值” （参见<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"> http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a> —— 章节 14.19）。 另一种说法是，ETag是一个可以与Web资源关联的记号（token）。典型的Web资源可以一个Web页，但也可能是JSON或XML文档。服务器单独负责判断记号是什么及其含义，并在HTTP响应头中将其传送到客户端。 </p>
<h2>ETag如何帮助提升性能？ </h2>
<p>聪明的服务器开发者会把ETags和GET请求的“If-None-Match”头一起使用，这样可利用客户端（例如浏览器）的缓存。因为服务器首
先产生ETag，服务器可在稍后使用它来判断页面是否已经被修改。本质上，客户端通过将该记号传回服务器要求服务器验证其（客户端）缓存。 </p>
<p>其过程如下： </p>
<ol><li>客户端请求一个页面（A）。 </li><li>服务器返回页面A，并在给A加上一个ETag。 </li><li>客户端展现该页面，并将页面连同ETag一起缓存。 </li><li>客户再次请求页面A，并将上次请求时服务器返回的ETag一起传递给服务器。 </li><li>服务器检查该ETag，并判断出该页面自上次客户端请求之后还未被修改，直接返回响应304（未修改——Not Modified）和一个空的响应体。 </li></ol>
<p>本文的其余部分将展示在基于Spring框架的Web应用中利用ETag的两种方法，该应用使用Spring
MVC。首先我们将使用Servlet 2.3 Filter，利用展现视图（rendered
view）的MD5校验和（checksum）以实现生成ETag的方法（<a href="http://bitworking.org/news/150/REST-Tip-Deep-etags-give-you-more-benefits">一个“浅显的”ETag实现</a>）。 第二种方法使用更为复杂的方法追踪view中所使用的model，以确定ETag有效性（<a href="http://bitworking.org/news/150/REST-Tip-Deep-etags-give-you-more-benefits">一个“深入的”ETag实现</a>）。尽管我们使用的是Spring MVC，但该技术可以应用于任何MVC风格的Web框架。 </p>
<p>在我们继续之前，强调一下这里所展现的是提升动态产生页面性能的技术。已有的优化技术也应作为整体优化和应用性能特性调整分析的一部分来考虑。（见下）。 </p>
<blockquote>
<p><strong>自顶向下的Web缓存</strong> </p>
<p>本文主要涉及对动态生成页面使用HTTP缓存技术。当考虑提升Web应用的性能的时候，应采取一个整体的、自顶向下的方法。为了这一目的，理解HTTP请求经过的各层是很重要的，应用哪些适当的技术取决于你所关注的热点。例如： </p>
<ul><li>将Apache作为Servlet容器的前端，来处理如图片和javascript脚本这样的静态文件，而且还可以使用<a href="http://httpd.apache.org/docs/2.2/mod/core.html#fileetag">FileETag指令</a>创建ETag响应头。 </li><li>使用针对javascript文件的优化技术，如将多个文件合并到一个文件中以及压缩空格。 </li><li>利用GZip和缓存控制头（Cache-Control headers）。 </li><li>为确定你的Spring框架应用的痛处所在，可以考虑使用 <a href="http://www.springframework.org/docs/api/org/springframework/aop/interceptor/JamonPerformanceMonitorInterceptor.html">JamonPerformanceMonitorInterceptor</a>。 </li><li>确信你充分利用ORM工具的缓存机制，因此对象不需要从数据库中频繁的再生。花时间确定如何让查询缓存为你工作是值得的。 </li><li>确保你<strong>最小化数据库中获取的数据量</strong>，尤其是大的列表。如果每个页面只请求大列表的一个小子集，那么大列表的数据应由其中某个页面一次获得。 </li><li>使放入到HTTP session中的数据量最小。这样内存得到释放，而且当将应用集群的时候也会有所帮助。 </li><li>使用<strong>数据库明细（database profiling）</strong>工具来查看在查询的时候使用了什么索引，在更新的时候整个表没有被上锁。 </li></ul>
<p>当然，应用性能优化的至理名言是：两次测量，一次剪裁（measure twice, cut once）。哦，等等，这是对木工而言的！没错，但是它在这里也很适用！ </p>
</blockquote>
<h2>ETag Filter内容体 </h2>
<p>我们要考虑的第一种方法是创建一个Servlet Filter，它将基于页面（MVC中的“View”）的内容产生其ETag
记号。乍一看，使用这种方法所获得的任何性能提升看起来都是违反直觉的。我们仍然不得不产生页面，而且还增加了产生记号的计算时间。然而，这里的想法是减
少带宽使用。在大的响应时间情形下，如你的主机和客户端分布在这个星球的两端，这很大程度上是有益的。我曾见过东京办公室使用纽约服务器上托管的应用，其
响应时间达到了 350 ms。随着并发用户数的增长，这将变成巨大的瓶颈。 </p>
<h3>代码 </h3>
<p>我们用来产生记号的技术是基于从页面内容计算MD5哈希值。这通过在响应之上创建一个包装器来实现。该包装器使用字节数组来保存所产生的内容，在filter链处理完成之后我们利用数组的MD5哈希值计算记号。 </p>
<p>doFilter方法的实现如下所示。 </p>
<pre> <font color="#0000ff">public void</font> doFilter(ServletRequest req, ServletResponse res, FilterChain chain) <font color="#0000ff">throws</font> <font color="#006699">IOException</font>,<br> ServletException {<br>  HttpServletRequest servletRequest = (HttpServletRequest) req;<br>  HttpServletResponse servletResponse = (HttpServletResponse) res;<br><br>   <font color="#0000ff">ByteArrayOutputStream</font> baos = <font color="#0000ff">new</font> <font color="#0000ff">ByteArrayOutputStream</font>();<br>  ETagResponseWrapper wrappedResponse = new ETagResponseWrapper(servletResponse, baos);<br>  chain.doFilter(servletRequest, wrappedResponse);<br><br>   <font color="#0000ff">byte</font>[] bytes = baos.toByteArray();<br><br>   <font color="#0000ff">String</font> token = <font color="#800000">'"'</font> + ETagComputeUtils.getMd5Digest(bytes) + '"';<br>  servletResponse.setHeader(<font color="#800000">"ETag"</font>, token); <font color="#006600">// always store the ETag in the header</font><br><br>   <font color="#0000ff">String</font> previousToken = servletRequest.getHeader(<font color="#800000">"If-None-Match"</font>);<br>  <font color="#0000ff">if</font> (previousToken != <font color="#0000ff">null</font> &amp;&amp; previousToken.equals(token)) { <font color="#006600">// compare previous token with current one</font><br>   logger.debug(<font color="#800000">"ETag match: returning 304 Not Modified"</font>);<br>   servletResponse.sendError(HttpServletResponse.SC_NOT_MODIFIED);<br>   <font color="#006600">// use the same date we sent when we created the ETag the first time through</font><br>   servletResponse.setHeader(<font color="#800000">"Last-Modified"</font>, servletRequest.getHeader(<font color="#800000">"If-Modified-Since"</font>));<br>  } <font color="#0000ff">else</font>  {   <font color="#006600">// first time through - set last modified time to now </font><br>   <font color="#0000ff">Calendar</font> cal = <font color="#0000ff">Calendar</font>.getInstance();<br>   cal.set(<font color="#0000ff">Calendar</font>.MILLISECOND, 0);<br>   <font color="#0000ff">Date</font> lastModified = cal.getTime();<br>   servletResponse.setDateHeader(<font color="#800000">"Last-Modified"</font>, lastModified.getTime());<br><br>    logger.debug(<font color="#800000">"Writing body content"</font>);<br>   servletResponse.setContentLength(bytes.length);<br>   ServletOutputStream sos = servletResponse.getOutputStream();<br>   sos.write(bytes);<br>   sos.flush();<br>   sos.close();<br>  }<br> } </pre>
<small style="font-weight: bold;">清单 1：ETagContentFilter.doFilter</small>
<p>你需注意到，我们还设置了Last-Modified头。这被认为是为服务器产生内容的正确形式，因为其迎合了不认识ETag头的客户端。 </p>
<p>下面的例子使用了一个工具类EtagComputeUtils来产生对象所对应的字节数组，并处理MD5摘要逻辑。我使用了javax.security MessageDigest来计算MD5哈希码。 </p>
<pre><font color="#0000ff">public static byte</font>[] serialize(<font color="#006699">Object</font> obj) <font color="#0000ff">throws</font> <font color="#006699">IOException</font> {<br>  <font color="#0000ff">byte</font>[] byteArray = <font color="#0000ff">null</font>;<br>  <font color="#006699">ByteArrayOutputStream</font> baos = <font color="#0000ff">null</font>;<br>  <font color="#006699">ObjectOutputStream</font> out = <font color="#0000ff">null</font>;<br>  try {<br>   <font color="#006600">// These objects are closed in the finally</font>.<br>   baos = <font color="#0000ff">new</font> <font color="#006699">ByteArrayOutputStream</font>();<br>   out = <font color="#0000ff">new</font> <font color="#006699">ObjectOutputStream</font>(baos);<br>   out.writeObject(obj);<br>   byteArray = baos.toByteArray();<br>  } <font color="#0000ff">finally</font> {<br>   <font color="#0000ff">if</font> (out != <font color="#0000ff">null</font>) {<br>    out.close();<br>   }<br>  }<br>  <font color="#0000ff">return</font> byteArray;<br> }<br><br>  <font color="#0000ff">public static</font> String getMd5Digest(<font color="#0000ff">byte</font>[] bytes) {<br>  MessageDigest md;<br>  <font color="#0000ff">try</font> {<br>   md = MessageDigest.getInstance("<font color="#800000">MD5</font>");<br>  } <font color="#0000ff">catch</font> (NoSuchAlgorithmException e) {<br>   <font color="#0000ff">throw new</font> RuntimeException(<font color="#800000">"MD5 cryptographic algorithm is not available."</font>, e);<br>  }<br>  <font color="#0000ff">byte</font>[] messageDigest = md.digest(bytes);<br>  BigInteger number = <font color="#0000ff">new</font> BigInteger(1, messageDigest);<br>  <font color="#006600">// prepend a zero to get a "proper" MD5 hash value</font><br>  StringBuffer sb = <font color="#0000ff">new</font> StringBuffer('<font color="#800000">0</font>');<br>  sb.append(number.toString(16));<br>  <font color="#0000ff">return</font> sb.toString();<br> }</pre>
<strong><small>清单 2：ETagComputeUtils</small></strong>
<p>直接在web.xml中配置filter。 </p>
<pre>    &lt;filter&gt;<br>       &lt;filter-name&gt;ETag Content Filter&lt;/filter-name&gt;<br>       &lt;filter-class&gt;org.springframework.samples.petclinic.web.ETagContentFilter&lt;/filter-class&gt;<br>     &lt;/filter&gt;<br><br>      &lt;filter-mapping&gt;<br>       &lt;filter-name&gt;ETag Content Filter&lt;/filter-name&gt;<br>       &lt;url-pattern&gt;/*.htm&lt;/url-pattern&gt;<br>     &lt;/filter-mapping&gt;</pre>
<strong><small>清单 3：web.xml中配置filter。</small></strong>
<p>每个.htm文件将被EtagContentFilter过滤，如果页面自上次客户端请求后没有改变，它将返回一个空内容体的HTTP响应。 </p>
<p>我们在这里展示的方法对特定类型的页面是有用的。但是，该方法有两个缺点： </p>
<ul><li>我们是在页面已经被展现在服务器之后计算ETag的，但是在返回客户端之前。如果有Etag匹配，实际上并不需要再为model装进数据，因为要展现的页面不需要发送回客户端。 </li><li>对于类似于在页脚显示日期时间这样的页面，即使内容实际上并没有改变，每个页面也将是不同的。 </li></ul>
<p>下一节，我们将着眼于另一种方法，其通过理解更多关于构造页面的底层数据来克服这些问题的某些限制。 </p>
<h2>ETag拦截器（Interceptor） </h2>
<p>Spring MVC HTTP
请求处理途径中包括了在一个controller前插接拦截器（Interceptor）的能力，因而有机会处理请求。这儿是应用我们ETag比较逻辑的
理想场所，因此如果我们发现构建一个页面的数据没有发生变化，我们可以避免进一步处理。 </p>
<p>这儿的诀窍是你怎么知道构成页面的数据已经改变了？为了达到本文的目的，我创建了一个简单的ModifiedObjectTracker，它通过
Hibernate事件侦听器清楚地知道插入、更新和删除操作。该追踪器为应用程序的每个view维护一个唯一的号码，以及一个关于哪些
Hibernate实体影响每个view的映射。每当一个POJO被改变了，使用了该实体的view的计数器就加1。我们使用该计数值作为ETag，这样
当客户端将ETag送回时我们就知道页面背后的一个或多个对象是否被修改了。 </p>
<h3>代码 </h3>
<p>我们就从ModifiedObjectTracker开始吧： </p>
<pre><font color="#0000ff">public interface</font> ModifiedObjectTracker {<br>  <font color="#0000ff">void</font> notifyModified(&gt; <font color="#006699">String</font> entity);<br> }</pre>
<p>够简单吧？这个实现还有一点更有趣的。任何时候一个实体改变了，我们就更新每个受其影响的view的计数器： </p>
<pre><font color="#0000ff">public void</font> notifyModified(<font color="#006699">String</font> entity) {<br>  <font color="#006600">// entityViewMap is a map of entity -&gt; list of view names</font><br>  <font color="#006699">List</font> views = getEntityViewMap().get(entity);<br><br>   <font color="#0000ff">if</font> (views == <font color="#0000ff">null</font>) {<br>   <font color="#0000ff">return</font>; // <font color="#006600">no views are configured for this entity</font><br>  }<br><br>   <font color="#0000ff">synchronized</font> (counts) {<br>   <font color="#0000ff">for</font> (<font color="#006699">String</font> view : views) {<br>    <font color="#006699">Integer</font> count = counts.get(view);<br>    counts.put(view, ++count);<br>   }<br>  }<br> }</pre>
<p>一个“改变”就是插入、更新或者删除。这里给出的是侦听删除操作的处理器（配置为Hibernate 3 LocalSessionFactoryBean上的事件侦听器）： </p>
<pre><font color="#0000ff">public class</font> DeleteHandler <font color="#0000ff">extends</font> DefaultDeleteEventListener {<br>  <font color="#0000ff">private</font> ModifiedObjectTracker tracker;<br><br>   <font color="#0000ff">public void</font> onDelete(DeleteEvent event) <font color="#0000ff">throws</font> HibernateException {<br>   getModifiedObjectTracker().notifyModified(event.getEntityName());<br>  }<br><br>  <font color="#0000ff">public</font> ModifiedObjectTracker getModifiedObjectTracker() {<br>   <font color="#0000ff">return</font> tracker;<br>  }<br>   <font color="#0000ff">public void</font> setModifiedObjectTracker(ModifiedObjectTracker tracker) {<br>   <font color="#0000ff">this</font>.tracker = tracker;<br>  }<br> }</pre>
<p>ModifiedObjectTracker通过Spring配置被注入到DeleteHandler中。还有一个SaveOrUpdateHandler来处理新建或更新POJO。 </p>
<p>如果客户端发送回当前有效的ETag（意味着自上次请求之后我们的内容没有改变），我们将阻止更多的处理，以实现我们的性能提升。在Spring MVC里，我们可以使用HandlerInterceptorAdaptor并覆盖preHandle方法： </p>
<pre><font color="#0000ff">public final boolean</font> preHandle(HttpServletRequest request, HttpServletResponse response, <font color="#006699">Object</font> handler) <font color="#0000ff">throws</font><br> ServletException, <font color="#006699">IOException</font> {<br>  <font color="#006699">String</font> method = request.getMethod();<br>  if (!"GET".equals(method))<br>   <font color="#0000ff">return true</font>;<br><br>   <font color="#006699">String</font> previousToken = request.getHeader("<font color="#800000">If-None-Match</font>");<br>  <font color="#006699">String</font> token = getTokenFactory().getToken(request);<br><br>   <font color="#006600">// compare previous token with current one</font><br>  <font color="#0000ff">if</font> ((token != <font color="#0000ff">null</font>) &amp;&amp; (previousToken != null &amp;&amp; previousToken.equals(<font color="#800000">'"'</font> + token + <font color="#800000">'"'</font>))) {<br>   response.sendError(HttpServletResponse.SC_NOT_MODIFIED);<br>   <font color="#006600">// re-use original last modified timestamp</font><br>   response.setHeader("<font color="#800000">Last-Modified</font>", request.getHeader("<font color="#800000">If-Modified-Since</font>"))<br>   <font color="#0000ff">return false</font>; <font color="#006600">// no further processing required</font><br>  }<br><br>   <font color="#006600">// set header for the next time the client calls</font><br>  <font color="#0000ff">if</font> (token != null) { <br>   response.setHeader(<font color="#800000">"ETag"</font>, <font color="#800000">'"'</font> + token + <font color="#800000">'"'</font>);<br><br>    <font color="#006600">// first time through - set last modified time to now</font><br>   <font color="#006699">Calendar</font> cal = <font color="#006699">Calendar</font>.getInstance();<br>   cal.set(<font color="#006699">Calendar</font>.MILLISECOND, 0);<br>   <font color="#006699">Date</font> lastModified = cal.getTime();<br>   response.setDateHeader("<font color="#800000">Last-Modified</font>", lastModified.getTime());<br>  }<br><br>   <font color="#0000ff">return true</font>;<br> }</pre>
<p>我们首先确信我们正在处理GET请求（与PUT一起的ETag可以用来检测不一致的更新，但其超出了本文的范围。）。如果该记号与上次我们发送的记
号相匹配，我们返回一个“304未修改”响应并“短路”请求处理链的其余部分。否则，我们设置ETag响应头以便为下一次客户端请求做好准备。 </p>
<p>你需注意到我们将产生记号逻辑抽出到一个接口中，这样可以插接不同的实现。该接口有一个方法： </p>
<pre><font color="#0000ff">public interface</font> ETagTokenFactory {<br>  <font color="#0000ff">String</font> getToken(<font color="#006699">HttpServletRequest</font> request);<br> }</pre>
<p>为了把代码清单减至最小，SampleTokenFactory的简单实现还担当了ETagTokenFactory的角色。本例中，我们通过简单返回请求URI的更改计数值来产生记号： </p>
<pre><font color="#0000ff">public String</font> getToken(<font color="#006699">HttpServletRequest</font> request) {<br>  <font color="#006699">String</font> view = request.getRequestURI();<br>  <font color="#006699">Integer</font> count = counts.get(view);<br>  <font color="#0000ff">if</font> (count == null) {<br>   <font color="#0000ff">return</font> null;<br>  }<br><br>   <font color="#0000ff">return</font> count.toString();<br> }</pre>
<p>大功告成！ </p>
<h3>会话 </h3>
<p>这里，如果什么也没改变，我们的拦截器将阻止任何搜集数据或展现view的开销。现在，让我们看看HTTP头（借助于<a href="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders</a>），看看到底发生了什么。下载文件中包含了配置该拦截器的说明，因此owner.htm“能够使用ETag”： </p>
<p>我们发起的第一个请求说明该用户已经看过了这个页面： </p>
<pre>----------------------------------------------------------  <br><strong>http://localhost:8080/petclinic/owner.htm?ownerId=10  </strong><br><br> GET /petclinic/owner.htm?ownerId=10 HTTP/1.1<br> Host: localhost:8080<br> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4<br> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br> Accept-Language: en-us,en;q=0.5<br> Accept-Encoding: gzip,deflate<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br> Keep-Alive: 300<br> Connection: keep-alive<br> Cookie: JSESSIONID=13D2E0CB63897F4EDB56639E46D2BBD8<br> X-lori-time-1: 1182364348062<br> If-Modified-Since: Wed, 20 Jun 2007 18:29:03 GMT<br> If-None-Match: "-1"<br><br> HTTP/1.x 304 Not Modified<br> Server: Apache-Coyote/1.1<br> Date: Wed, 20 Jun 2007 18:32:30 GMT</pre>
<p>我们现在应该做点修改，看看ETag是否改变了。我们给这个物主增加一个宠物： </p>
<pre>----------------------------------------------------------<br> <strong>http://localhost:8080/petclinic/addPet.htm?ownerId=10<br><br></strong> GET /petclinic/addPet.htm?ownerId=10 HTTP/1.1<br> Host: localhost:8080<br> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4<br> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br> Accept-Language: en-us,en;q=0.5<br> Accept-Encoding: gzip,deflate<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br> Keep-Alive: 300<br> Connection: keep-alive<br> Referer: http://localhost:8080/petclinic/owner.htm?ownerId=10<br> Cookie: JSESSIONID=13D2E0CB63897F4EDB56639E46D2BBD8<br> X-lori-time-1: 1182364356265<br><br> HTTP/1.x 200 OK<br> Server: Apache-Coyote/1.1<br> Pragma: No-cache<br> Expires: Thu, 01 Jan 1970 00:00:00 GMT<br> Cache-Control: no-cache, no-store<br> Content-Type: text/html;charset=ISO-8859-1<br> Content-Language: en-US<br> Content-Length: 2174<br> Date: Wed, 20 Jun 2007 18:32:57 GMT<br> ----------------------------------------------------------<br> <strong>http://localhost:8080/petclinic/addPet.htm?ownerId=10  </strong><br> <br> POST /petclinic/addPet.htm?ownerId=10 HTTP/1.1<br> Host: localhost:8080<br> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4<br> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br> Accept-Language: en-us,en;q=0.5<br> Accept-Encoding: gzip,deflate<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br> Keep-Alive: 300<br> Connection: keep-alive<br> Referer: http://localhost:8080/petclinic/addPet.htm?ownerId=10<br> Cookie: JSESSIONID=13D2E0CB63897F4EDB56639E46D2BBD8<br> X-lori-time-1: 1182364402968<br> Content-Type: application/x-www-form-urlencoded<br> Content-Length: 40<br> name=Noddy&amp;birthDate=1000-11-11&amp;typeId=5<br> HTTP/1.x 302 Moved Temporarily<br> Server: Apache-Coyote/1.1<br> Pragma: No-cache<br> Expires: Thu, 01 Jan 1970 00:00:00 GMT<br> Cache-Control: no-cache, no-store<br> Location: http://localhost:8080/petclinic/owner.htm?ownerId=10<br> Content-Language: en-US<br> Content-Length: 0<br> Date: Wed, 20 Jun 2007 18:33:23 GMT</pre>
<p>因为对addPet.htm我们没有配置任何已知ETag，也没有设置头信息。现在，我们再一次查看id为10的物主。注意ETag这时是1： </p>
<pre>----------------------------------------------------------<br> <strong>http://localhost:8080/petclinic/owner.htm?ownerId=10<br><br></strong> GET /petclinic/owner.htm?ownerId=10 HTTP/1.1<br> Host: localhost:8080<br> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4<br> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br> Accept-Language: en-us,en;q=0.5<br> Accept-Encoding: gzip,deflate<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br> Keep-Alive: 300<br> Connection: keep-alive<br> Referer: http://localhost:8080/petclinic/addPet.htm?ownerId=10<br> Cookie: JSESSIONID=13D2E0CB63897F4EDB56639E46D2BBD8<br> X-lori-time-1: 1182364403109<br> If-Modified-Since: Wed, 20 Jun 2007 18:29:03 GMT<br> If-None-Match: "-1"<br><br> HTTP/1.x 200 OK<br> Server: Apache-Coyote/1.1<br> Etag: "1"<br> Last-Modified: Wed, 20 Jun 2007 18:33:36 GMT<br> Content-Type: text/html;charset=ISO-8859-1<br> Content-Language: en-US<br> Content-Length: 4317<br> Date: Wed, 20 Jun 2007 18:33:45 GMT</pre>
<p>最后，我们再次查看id为10的物主。这次我们的ETag命中了，我们得到一个“304未修改”响应： </p>
<pre>----------------------------------------------------------<br> http://localhost:8080/petclinic/owner.htm?ownerId=10<br><br> GET /petclinic/owner.htm?ownerId=10 HTTP/1.1<br> Host: localhost:8080<br> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4<br> Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br> Accept-Language: en-us,en;q=0.5<br> Accept-Encoding: gzip,deflate<br> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br> Keep-Alive: 300<br> Connection: keep-alive<br> Cookie: JSESSIONID=13D2E0CB63897F4EDB56639E46D2BBD8<br> X-lori-time-1: 1182364493500<br> If-Modified-Since: Wed, 20 Jun 2007 18:33:36 GMT<br> If-None-Match: "1"<br><br> HTTP/1.x 304 Not Modified<br> Server: Apache-Coyote/1.1<br> Date: Wed, 20 Jun 2007 18:34:55 GMT</pre>
<p>我们已经利用HTTP缓存节约了带宽和计算时间！ </p>
<p><strong>细粒度印记（The Fine Print）</strong>：实践中，我们可以通过以更细粒度的跟踪对象变化来获得更大的功
效，例如使用对象id。然而，这种使修改对象关联到view上的想法高度依赖应用程序的整体数据模型设计。这里的实现
（ModifiedObjectTracker）是说明性的，有意为更多的探索提供想法。它并不是旨在生产环境中使用（比如它在簇中使用还不稳定）。一个
可选的更深的考虑是使用数据库触发器来跟踪变化，让拦截器访问触发器所写入的表。 </p>
<h2>结论 </h2>
<p>我们已经看了两种使用ETag减少带宽和计算的方法。我希望本文已为你当下或将来基于Web的项目提供了精神食粮，并正确评价在底层利用ETag响应头的做法。 </p>
<p>正如牛顿（Isaac
Newton）的名言所说：“如果说我看得更远，那是因为我站在巨人的肩膀上。”REST风格应用的核心是简单、好的软件设计、不要重新发明轮子。我相信
随着使用量和知名度的增长，针对基于Web应用的REST风格架构有益于主流应用开发的迁移，我期盼着它在我将来的项目中发挥更大的作用。 </p>
<h2>关于作者 </h2>
<p>Gavin Terrill 是BPS公司的首席技术执行官。Gavin已经有20多年的软件开发历史了，擅长企业Java应用程序，但仍拒绝扔掉他的TRS-80。闲暇时间Gavin喜欢航海、钓鱼、玩吉他、品红酒（不分先后顺序）。 </p>
<h3>感谢 </h3>
<p>我要感谢我的同事Patrick Bourke和Erick Dorvale的帮助，他们对这篇文章提供的反馈意见。 </p>
<p>代码和说明可以从<a href="http://www.gavin.terrill.com/wpcf/wpcf-0.1.zip">这里</a>下载。 </p><br>原文：<br>http://www.infoq.com/articles/etags;jsessionid=0D00AD9E523A2A30718B7693E87DCFE0</div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920085333622203</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920085333622203</guid>
    <pubDate>Tue, 3 Jun 2008 15:36:22 +0800</pubDate>
    <dcterms:modified>2008-06-03T15:39:15+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[数据库集群和负载平衡解决方案之Sequoia]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920085322848728</link>
    <description><![CDATA[<div>

<p style="font-weight: bold;" ><font size="3"><span style="font-size: 12pt; font-family: 宋体;">什么是<span lang="EN-US">Sequoia</span>？</span></font></p><p >

</p><p ><span lang="EN-US">Sequoia</span><span style="font-family: 宋体;">是一个提供数据库集群，负载平衡和故障转移的中间件解决方案，它是</span><span lang="EN-US">C-JDBC</span><span style="font-family: 宋体;">项目的扩展和延伸。</span><span style="font-size: 12pt; font-family: 宋体;" lang="EN-US">Sequoia</span><span style="font-size: 12pt; font-family: 宋体;">主要平衡分布式和可复制数据库多节点之间的数据查询。它通过透明故障转移来处理各节点和网络链接失败问题；支持数据库热恢复，联机操作和在线升级。</span></p><p ></p><div style="text-align: center;"><img src="http://sequoia.continuent.org/uploads/sequoia/HomePage/continuent_org_sequoia.jpg"><br></div><p ><span style="font-size: 12pt; font-family: 宋体;"><span lang="EN-US"></span></span></p><p style="font-weight: bold;" ><br></p><p style="font-weight: bold;" >特点：</p>1、无需修改代码和数据库。<br>2、基于JDBC Drvier的数据库访问操作。<br>3、透明的故障转移和故障恢复能力。<br>4、性能可扩展性，独一无二的负载平衡和查询结果缓存。<br>5、集成基于JMX的管理和检测。<br>6、平台独立和可移植性，完全基于JRE 1.4的java代码实现。<br>7、开放源代码（Apache v2 license）。<br>8、由Continuent提供专业的支持，培训和资讯。<br><br><p ><br>参考：<br></p>http://sequoia.continuent.org/HomePage</div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920085322848728</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920085322848728</guid>
    <pubDate>Tue, 3 Jun 2008 14:28:48 +0800</pubDate>
    <dcterms:modified>2008-06-03T14:28:48+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[月薪1万5的高级程序员笔试题]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/2091559200842832730894</link>
    <description><![CDATA[<div>高级程序员选做题：<br>1、冒泡排序PHP实现，请附上流程图和代码。<br>
<div style="display: none;">
&lt;?php<br>$s = array( 3,2,4,6,5,1 );<br>$total = count($s);<br>for($i=1;$i&lt;$total;$i++){<br>&nbsp;&nbsp; &nbsp;$isok = true;<br>&nbsp;&nbsp; &nbsp;for($j=0;$j&lt;$total-$i;$j++){<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if($s[$j]&lt;$s[$j+1]){<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$isok = false;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$temp = $s[$j];<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$s[$j] = $s[$j+1];<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$s[$j+1] = $temp;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br>&nbsp;&nbsp; &nbsp;}<br>&nbsp;&nbsp; &nbsp;if($isok)break;<br>}<br>print_r($s);<br>?&gt;<br>
</div>
2、请用简单描叙下单例模式，请附上相关流程和代码。<br>3、请提供一个你认为比较合理的MVC架构解决方案，要求简洁，快速，不要繁杂；请附上流程和相关说明。<br>4、你平时都读过什么书？你逛书店吗？每一年读几本书？你关注哪个技术领域？<br>5、请简要介绍下你的未来职业生涯规划。<br>6、请简单说明你认为自己设计得比较牛的算法，请附上流程图或者相关伪代码，并做简单说明。<br>7、请介绍下Mysql数据库索引机制。<br>8、请提供Mysql Data Server负载平衡的解决方案，要求低成本（包括维护成本等相关费用）。<br>9、请设计一个留言板系统，包括用户提交留言，管理员回复、删除留言操作，不要求提供代码，要求提供数据库表结构设计和用例流程，包括详细设计需求说明书。<br><br>请将答案发送到weiqun#eefocus.com，我们将为您提供8000-15000/m的薪水范围，谢谢合作！<br></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/2091559200842832730894</comments>
    <slash:comments>3</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/2091559200842832730894</guid>
    <pubDate>Wed, 28 May 2008 15:27:30 +0800</pubDate>
    <dcterms:modified>2008-06-20T12:26:19+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[Read/Write Splitting with MySQL-Proxy]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/2091559200842725235599</link>
    <description><![CDATA[<div>http://www.infoq.com/news/2007/10/mysqlproxyrwsplitting;jsessionid=B0C0E063D9960E3CF5F57F82FA755FB2<br>http://www.infoq.com/cn/news/2007/10/mysqlproxyrwsplitting<br></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/2091559200842725235599</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/2091559200842725235599</guid>
    <pubDate>Tue, 27 May 2008 14:52:35 +0800</pubDate>
    <dcterms:modified>2008-05-27T14:52:35+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[JS分段获取URL解析]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/2091559200842342018986</link>
    <description><![CDATA[<div>URL : 统一资源定位符 (Uniform Resource Locator, URL)<br><br>完整的URL由这几个部分构成：<br>scheme://host:port/path?query#fragment<br><br>scheme&nbsp;&nbsp;= 通信协议 (常用的http,ftp,maito等)<br>host = 主机 (域名或IP)<br>port = 端口号<br>path = 路径<br><br>query = 查询<br>可选，用于给动态网页（如使用CGI、ISAPI、PHP/JSP/ASP/ASP.NET等技术制作的网页）传递参数，可有多个参数，用”&amp;”符号隔开，每个参数的名和值用”=”符号隔开。<br><br>fragment = 信息片断<br>字符串，用于指定网络资源中的片断。例如一个网页中有多个名词解释，可使用fragment直接定位到某一名词解释。(也称为锚点.)<br><br>对于这样一个URL<br><a href="http://www.master8.net/seo/?ver=1.0&amp;id=6#imhere" target="_blank"><u>http://www.master8.net:80/seo/?ver=1.0&amp;id=6#imhere</u></a><br><br>我们可以用javascript获得其中的各个部分<br>1, window.location.href<br>整个URl字符串(在浏览器中就是完整的地址栏)<br><br>2,window.location.protocol<br>URL 的协议部分<br>本例返回值:http:<br><br>3,window.location.host<br>URL 的主机部分<br>本例返回值:<a href="http://www.master8.net/" target="_blank"><u>www.master8.net</u></a><br><br>4,window.location.port<br>URL 的端口部分<br>如果采用默认的80端口(update:即使添加了:80)，那么返回值并不是默认的80而是空字符<br>本例返回值:”"<br><br>5,window.location.pathname<br>URL 的路径部分(就是文件地址)<br>本例返回值:/seo/<br><br>6,window.location.search<br>查询(参数)部分<br>除了给动态语言赋值以外，我们同样可以给静态页面,并使用javascript来获得相信应的参数值<br>本例返回值:?ver=1.0&amp;id=6<br><br>7,window.location.hash<br>锚点<br>本例返回值:#imhere</div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/2091559200842342018986</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/2091559200842342018986</guid>
    <pubDate>Fri, 23 May 2008 16:20:18 +0800</pubDate>
    <dcterms:modified>2008-05-23T16:20:18+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[辞呈]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/209155920084220571033</link>
    <description><![CDATA[<div><P style="TEXT-INDENT: 2em">尊敬的公司主管：</P>
<P style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 您好</P>
<P style="TEXT-INDENT: 2em">我带着非常沉重而复杂的心情写了这封辞呈。由于个人原因，我请求辞去我在公司的职务，我将于5月31号正式离开公司，请批准，在此期间我将完成我所承担的相关项目，并完成相关交接以及协助公司对新人进行入职培训，使他尽快熟悉工作。</P>
<P style="TEXT-INDENT: 2em">进入公司工作的两年时间里，得到了公司各位同事的帮助和领导的信任，我在这里表示真诚的谢意。经过这两年在公司的技术开发工作，公司给予我多次参加大小项目的实施机会，使我积累了很多宝贵的经验，学到了许多工作以外的处世为人等做人的道理，同时也发现了自身的一些不足和缺点，这些都将是我未来的工作和生活中一笔宝贵的财富，我在这里对于公司两年来的照顾和给予我的相关机会表示真心的感谢。在过去的两年里，可以说是人生中比较愉快的时光，公司的和谐的气氛，就象一个大家庭一样，同事之间融洽和睦相处，我们一起分享成功的喜悦，一起承受压力，一起成长，一起向前迈进；说真的离开这里，离开这些曾经同甘共苦的同事，确实很舍不得，我从内心希望这份友谊，这份感情能继续并永久保持下去，但愿我们能有再次合作的机会。</P>
<P style="TEXT-INDENT: 2em">最后真诚的祝愿公司在今后的发展旅途中步步为赢、蒸蒸日上！</P>
<P style="TEXT-INDENT: 2em">此致</P>
<P style="TEXT-INDENT: 2em">&nbsp;</P>
<P style="TEXT-INDENT: 2em">敬礼</P>
<P style="TEXT-INDENT: 2em">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 二零零八年五月二十二日</P></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/209155920084220571033</comments>
    <slash:comments>1</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/209155920084220571033</guid>
    <pubDate>Thu, 22 May 2008 00:57:10 +0800</pubDate>
    <dcterms:modified>2008-05-22T01:04:51+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[HTC 文件的简介]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/20915592008421113140818</link>
    <description><![CDATA[<div>从5.5版本开始，Internet&nbsp;Explorer（IE）开始支持Web&nbsp;行为的概念。这些行为是由后缀名为.htc的脚本文件描述的，它们定义了
一套方法和属性，程序员几乎可以把这些方法和属性应用到HTML页面上的任何元素上去。Web&nbsp;行为是非常伟大的因为它们允许程序员把自定义的功能“连
接”到现有的元素和控件，而不是必须让用户下载二进制文件（例如ActiveX&nbsp;控件）来完成这个功能。Web&nbsp;行为还是推荐的扩展IE对象模型和控件集
的方法。微软在它的开发者站点上的DHTML&nbsp;行为库栏目里提供了几个定制的Web行为。<br>参考：<br>http://ajax.cnrui.cn/article/2/3/2006/20060715369.shtml<br>http://www.pconline.com.cn/pcedu/empolder/wz/javascript/0312/249879.html<br></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/20915592008421113140818</comments>
    <slash:comments>0</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/20915592008421113140818</guid>
    <pubDate>Wed, 21 May 2008 11:31:40 +0800</pubDate>
    <dcterms:modified>2008-05-21T11:31:40+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[Left you to live does not have the pleasure]]></title>	
    <link>http://wanweiqun.blog.163.com/blog/static/2091559200841992517124</link>
    <description><![CDATA[<div>有个朋友让我翻译这句话，我说：离开你的生活毫无乐趣。转眼我来到北京已经2年了，还是在苦苦挣扎着，我不知道方向在哪里，在跟一个在国外的哥们聊天，突然发现好累，也许是真的累了，也许是离开的时候了；这个城市似乎没有任何东西值得我留恋，也许是有的吧，只是我没有发现而已，整天忙碌的生活，让我放弃了很多享受年轻的机会，也许我真的不再年轻了吧！我一直以为那些随着时光的流逝而慢慢会变淡的东西，反而越来越强烈了；人似乎是很可笑的一种动物，越是得不到的东西越想得到，得到之后又不好好珍惜。如果人的大脑就象硬盘一样，可以把不需要的数据格式化一下就好，其实硬盘格式化了数据还是会存在的，还可以恢复过来，只是我们看不到他了，以为它不存在了；如果低格的话，就会对硬盘造成伤害；如果它是内存，用完就释放了，那生命就会失去很多精彩。也许是真的！离开你的生活将会真的毫无乐趣吗？ 在这个世界上似乎唯一值得我去追求的就剩一样东西了。对自己说：<span>珍惜今日吧，因为它是明日最美好的回忆！！</span></div>]]></description>
	    <author><![CDATA[kokko]]></author>
	    <comments>http://wanweiqun.blog.163.com/blog/static/2091559200841992517124</comments>
    <slash:comments>1</slash:comments>
    <guid isPermaLink="true">http://wanweiqun.blog.163.com/blog/static/2091559200841992517124</guid>
    <pubDate>Mon, 19 May 2008 21:25:17 +0800</pubDate>
    <dcterms:modified>2008-05-19T21:25:17+08:00</dcterms:modified>
  </item>    
  <item>
  	<title><![CDATA[我的密友]]></title>	
    <link></link>
    <description><![CDATA[<div>
			<a href="http://blog.163.com/thcl_553/" target="_blank"><img src="http://ava.blog.163.com/photo/Nrqt0j1oF1F2KayBhIrU0Q==/2539185764906835278.jpg" border="0" />宝宝</a>
			<a href="http://hi-baby.blog.163.com/" target="_blank"><img src="http://ava.blog.163.com/photo/Xuu27_GBEsbHhiwlRyhPnQ==/169447935981508743.jpg" border="0" />红袖天香</a>
			<a href="http://qq19851090.blog.163.com/" target="_blank"><img src="http://ava.blog.163.com/photo/IOnkIRrKJAIUIxTWRNJ6gw==/179018085188060543.jpg" border="0" />乱㈦≮ハ≯糟</a>
			<a href="http://yuanlin22.blog.163.com/" target="_blank"><img src="http://ava.blog.163.com/photo/l648pt4KZwu5eiaZupq2qg==/5117778026553602343.jpg" border="0" />兔兔</a>
			<a href="http://blog.163.com/gevinjxe521@126/" target="_blank"><img src="http://ava.blog.163.com/photo/rLvlqpGcGw5DDRjL7a5Vtg==/1207809125065796680.jpg" border="0" />娥娥V晓晓的世界</a>
			<a href="http://bailu28150.blog.163.com/" target="_blank"><img src="http://ava.blog.163.com/photo/V8LSPdizbYqju6NfQT0WAA==/484981384873716809.jpg" border="0" />{厷紸.ノ殿下</a>
			<a href="http://blog.163.com/tianxiaohui86@126/" target="_blank"><img src="http://ava.blog.163.com/photo/U9jE-lxqktXeXxtXo4nM7g==/5425993126051653406.jpg" border="0" />绿光</a>
			<a href="http://wdbk163.blog.163.com/" target="_blank"><img src="http://ava.blog.163.com/photo/5-TG34BOif6h7pR_R-Xcig==/5430496725679136465.jpg" border="0" />牛仔女</a>
</div>]]></description>
    <guid isPermaLink="false">http://wanweiqun.blog.163.com/friends</guid>
    <pubDate>Tue, 1 Jan 2008 00:00:00 +0800</pubDate>
    <dcterms:modified>2008-01-01T00:00:00+08:00</dcterms:modified>
  </item>    
 </channel>
</rss>