Googlebot和 Mediapartners-Google 抓取报告中的怪事

Googlebot是google搜索抓取机器人,而Mediapartners-Google是为显示相关广告而抓取网页的机器人。

这几天,在Googlebot的抓取报告中出现这样的莫名其妙的字眼:


我们已成功访问您的主页。

-----------------------------------------------------------

restriction. not be translated.

而在Mediapartners-Google的抓取报告中出现莫名其妙的robots.txt拦截网址,问题是我在robots.txt中根本就没有拦截这些网址:


        已拦截网址      拦截原因  [?]    上一次抓取尝试     尝试失败

  http:/ / 209. 85. 165. 104/ search? q= cache:hIzBannSd6wJ:java. learndiary. com/ diaries/ 1367. jsp+error+1045+access+denied+for+user+root%40localhost&hl= zh-CN&gl= us&ct= clnk&cd= 7 Robots.txt 文件 2006-12-29 1

  http:/ / 64. 233. 161. 104/ search? q= cache:tvsE7YLr87kJ:java. learndiary. com/ diaries/ 1481. jsp+hibernate+spring&hl= zh-CN&gl= us&ct= clnk&cd= 128 Robots.txt 文件 2006-12-27 1

截图分别如下:

1)、Googlebot的抓取报告

2)、Mediapartners-Google的抓取报告

Thinking in Patterns Chapter 14: Algorithmic partitioning

Thinking in Patterns with Java V0.9: Chapter 14: Algorithmic partitioning: TIPatterns.htm#_Toc41169746

1, Sections:

Algorithmic partitioning  106

  Command: choosing the operation at run-time  106

    Exercises. 109

  Chain of responsibility. 109

    Exercises

2, The main content and feeling:

  1) Command pattern:

  It is "wrapping a method in an object". From my understanding, a Command is a very simple class with a sole method to resolve a specific task. When I perform a big task, I can put some of these Command objects together, and in a "manager" class, call these object's own sole method to perform its specific little task, and, in this way, to finish that big task through these little object's contributions.

 

  In my first touch of these patterns, I think there are clear differents between Command Pattern and Strategy Pattern:

  Command Pattern: Put serveral Command objects together to perform a common task, just like draw together to fight on a common enemy;

  Strategy Pattern: At a specific time use a specific Strategy to accomplish a different result.

  But, why does Bruce say below in the book:

 


 I would hazard to say that Command provides flexibility while you’re writing the program, whereas Strategy’s flexibility is at run time. Nonetheless, it seems a rather fragile distinction.

 

 

  Maybe, Bruce describe it from the structural aspect, I look at them at the function's aspect.

  

  2) Chain of Responsibility:

  That just an "Expert System", there are several experts in this system, and, these experts wait here in line. When a problem come, from the first expert to the last expert, every expert try to resolve this problem. If one can't do it, then the problem be handed to the next expert, until the problem be rosolved or the last expert can't do it yet, then an un-resolved problem is retruned.

  From this view aspect, Chain of Responsibility just like an auto-selected Strategy Pattern: the method for resolving problem is auto selected in the former, and a manual-selected strategy used for a problem in the later.

  A question raises, what if the problem handed to the Expert System need serveral experts to resolve them respectively? Maybe, this problem need to be cuted into serveral little problems then hand them into the expert system successively.

  In this pattern, Bruce says GoF use many words to create an linked list to contain these "experts", it is because GoF wrote that Design Pattern at the time "before the Standard Template Library (STL) was incorporated into most C++ compilers'. But, in Java, a ready-made List is here.

  In fact, I need review these content when I finish the first reading of this book. So, although there are some place I can't understand it very clearly, but, I must go on, finish the first reading of entire book in shortest time is the most import thing. I just only read half of this book. After reading this book once, the J2EE Design Patterns need me to read. So, don't tie at any specific point, go! go! go!

3, Questions about programming:

  1), The point is to decouple the choice of function to be called from the site where that function is called.

  2),  something you can normally only do by writing new code but in the above example could be done by interpreting a script.

  3), What is the famous "callback" technique?

4, Questions about english language:

1), Strange words:

   functor, collectively, incorporated into, BabelFish, Bisection, ConjugateGradient, fragile

2), Difficult sentences:

On the other hand, with a Command object you typically just create it and hand it to some method or object, and are not otherwise connected over time to the Command object.

 

********************************************************************************************************

Class diagram of //: chainofresponsibility:FindMinima.java in section: Chain of responsibility

                                     incomplete

让孩子唱孩子应该唱的,玩孩子应该玩的吧

今天,有两个事情使我要写这篇日记。

1、某处元旦节庆祝。其中有两个小学二三年级的孩子唱歌和跳舞,唱的是S.H.E的《不想长大》,歌词是这样的:


...

我不想我不想不想长大

长大后世界就没有花

我不想我不想不想长大

我宁愿永远又笨又傻

我不想我不想不想长大

长大后我就会失去他

我深爱的他深爱我的他

已经变的不像他

...

完整的见:

http://mp3.baidu.com/m?tn=baidump3lyric&word=%B2%BB%CF%EB%B3%A4%B4%F3&ct=150994944&lm=-1&lf=3

其中一个还跳着很成人的舞姿。

相反,有个成人上台表演跳的是很传统的蒙古草原舞蹈。

2、女儿让我给她买一种贴纸画,我不知道是哪种(后来知道是泡泡糖里的),就看了另外的贴纸画,清一色的是武侠小说里的人物:好像有:小龙女,小李飞刀什么的。听店主说,这种贴纸卖得很好。这个小店就紧挨着一个幼儿园。

而且,我想起现在许多小孩都在唱不是他们该唱的歌,看不是他们该看的漫画(尤其是有些日本的卡通漫画),这让我很想说:让孩子唱孩子应该唱的,玩孩子应该玩的吧。

在我的心里,孩子的世界应该是童话的、纯洁的世界。里面有灿烂的阳光、蓝蓝的天、绿绿的草、五颜六色的花,还有蝴蝶等。。。

但是,现实是严竣的,以上两个小事只是冰山一角。

难道,我们找不到给孩子唱的,给孩子玩的吗?我不这样认为。而且,我也不认为,孩子们就只有看外国动画、漫画(这段时间我们的孩子嘴里常念叨的是什么:奥特曼、迪克、超人、怪兽;葫芦娃也有提,时候不多;我想,我们从来没有给她看这些,一定是她的小朋友圈子中互相交流的热门主题,哪个最英雄,我要当奥特曼、超人,打怪兽...)。我们的血液里天生有一份最值钱的祖宗留下的、世界仅有的宝贵财富:5000年厚重的文化传承,这一点也可以说,中国人是世界最富有的人,我们应该为生为中国人而骄傲。

难道,这悠悠5000年的文化还找不到怎样来滋润孩子心灵的灵感和源泉吗?不会吧。我们完全可以以现代的科技,随便在5000年的历史长河中捡一点,就能做出至少是中国的唐老鸭和米老鼠,进一步,做成世界级的东西也不是没有可能。我们的东西有不少是外国人在发挥,像日本的三国文化(包括:游戏、漫画等),美国的花木兰,当然,应该还有太多,不过我没有去找,如果是专心去找,肯定有不少的。

作为一个家长、孩子的父亲,我希望我们的孩子能够唱他们该唱的、玩他们该玩的、看他们该看的。

linux下的换行符号引起Resin3的struts-config.xml解析报错

由于linux和windows的换行符不一致,有时在这种系统间的文件交换就会出现问题。我就碰到这样的问题。

本来应该是这样的Struts-config.xml内容:


        <action

            attribute="loginForm"

            input="/login.jsp"

            name="loginForm"

            path="/loginAction"

            type="com.learndiary.website.action.account.LoginAction">

            <forward name="success" path="/loginSuccess.jsp" />

            <forward name="failure" path="/login.jsp" />

        </action>

可能是从windows转到linux下变成了这样:


        <action^M^M

            attribute="loginForm"^M^M

            input="/login.jsp"^M^M

            name="loginForm"^M^M

            path="/loginAction"^M^M

            type="com.learndiary.website.action.account.LoginAction">^M^M

            <forward name="success" path="/loginSuccess.jsp" />^M^M

            <forward name="failure" path="/login.jsp" />^M^M

        </action>

这在本地的Tomcat5和空间原来的Resin2下都没有问题,但是当空间改为Resin3后,每次重新启动应用就报错:


The content of element type "action" must match "(icon?,display-name?,description?,set-property*,exception*,forward*)".

...

但是奇怪的是,应用启动后的工作看起来还是正常的。

下面附的是相关的文字:(转自:http://www.real-blog.com/linux-bsd-notes/67

Unix 及 Windows 文字檔轉換

大家如果試過在 Linux 及 Windows 文字檔分享的話,會發現文字檔的 “換行” 不一樣。在 Windows 用記事本開啟 Unix 文字檔時,文件不會開新行,需要使用支援 Unix 格式的文字編輯器才可看到分行;而在 Linux 開啟 Windows 的文字檔時,在每一行最後會有字元 Ctrl-m (^M)。以下是使用 Perl 在 Linux 下將文字檔轉換的方法:

Windows 格式 -> Unix 格式

perl -p -e ’s/\r$//’ < winfile.txt > unixfile.txt

Unix 格式 -> Windows 格式

perl -p -e ’s/\n/\r\n/’ < unixfile.txt > winfile.txt

February 13, 2006 · Linux / BSD 筆記, Windows 筆記 ·

1 Comment »

   1.

      UNIX WINDOWS MAC三者的回车都不一样,好像是:windows是0×0d 0×0a

      UNIX是0×0d MAC是0×0a吧。记不太清楚了。大体上是这样的。

      Comment by 数据恢复 — April 6, 2006 @

始终没有搞懂Java中的字符编码问题

在本站动态页面静态化中,使用的是用程序访问网页,然后把返回的内容写入静态文件。由于本站是采用UTF-8编码,所以,保存的静态文件就要以UTF-8格式保存。

在我本机的环境下(redhat linux9.0 + jdk1.4.2 + tomcat5 )和现在的空间环境windows2000 advanced + jdk1.5 + Resin3.0.18下,使用下面的代码可以正确保存为UTF-8静态文件:


/*

 * Created on 2006-12-1

 */

package com.learndiary.website.util;

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import com.learndiary.website.model.UserInfo;

public class ToHtml extends HttpServlet {

private static Log __log = LogFactory.getFactory().getInstance("com.learndiary.website.util.ToHtml");

public void service(

HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException {

String url = "";

String name = "";

ServletContext sc = getServletContext();

String fileName = request.getParameter("fileName");

String artID = request.getParameter("artID");

String pageNum = request.getParameter("pageNum");

String webPath = null;

        if (fileName.equals("main")){

url = "/main.do";

webPath = "/index.htm";

__log.info("main url is: " + url +" ; static html file name is: " + webPath);

}else if(fileName.equals("goal")){

url = "/disGoalContentAction.do?goalID=" + artID; // 你要生成的页面的文件名。

webPath = "/goals/" + artID + ".htm";

__log.info("goal url is: " + url +" ; static html file name is: " + webPath);

}else if(fileName.equals("diary")){

    url = "/disDiaryContentAction.do?goalID=" + artID; // 你要生成的页面的文件名。

    webPath = "/diaries/" + artID + ".htm";

    __log.info("diary url is: " + url +" ; static html file name is: " + webPath);

    }else if(fileName.equals("sitemap")){

    url = "/mapGenerateAction.do?artID=" + artID + "&pageNum=" + pageNum ; // 你要生成的页面的文件名。

    int articleID = Integer.parseInt(artID);

    if (articleID == 0){

        webPath = "/sitemaps/goals-" + pageNum + ".htm";

    }else if (articleID > 0){

        webPath = "/sitemaps/goal" + artID + "-" + pageNum + ".htm";

    }

    __log.info("sitemap url is: " + url +" ; static html file name is: " + webPath);

    }

        name = request.getRealPath(webPath);

       

        __log.info("real name is: " + name);

       

RequestDispatcher rd = sc.getRequestDispatcher(url);

final ByteArrayOutputStream os = new ByteArrayOutputStream();

final ServletOutputStream stream = new ServletOutputStream() {

public void write(byte[] data, int offset, int length) {

os.write(data, offset, length);

}

public void write(int b) throws IOException {

os.write(b);

}

};

final PrintWriter pw = new PrintWriter(new OutputStreamWriter(os));

HttpServletResponse rep = new HttpServletResponseWrapper(response) {

public ServletOutputStream getOutputStream() {

return stream;

}

public PrintWriter getWriter() {

return pw;

}

};

rep.setContentType("text/html; charset=UTF-8");

rd.include(request, rep);

pw.flush();

FileOutputStream fos = new FileOutputStream(name);



byte[] ob= os.toByteArray();

//String string =new String(ob, "GB2312");//在本站如果输入繁体字等这样不能显示繁体字(应该是只能正确处理GB2312的内容)

String string =new String(ob);//这样才能正确处理繁体字

byte[] ob2 = string.getBytes("UTF-8");

fos.write(ob2);

        //os.writeTo(fos);

fos.close();

String jspName = webPath.replaceAll(".htm", ".jsp");

if (!HtmlsManager.isExist(jspName, request)){ //write another same name's jsp static file that will include html file

FileOutputStream jspFos = new FileOutputStream(name.replaceAll(".htm", ".jsp"));

String content = "<%@ include file=\"/common/jsp301.jsp\" %>".concat("<jsp:include page=\"" + webPath + "\" />");

byte[] jspOb = content.getBytes("UTF-8");

jspFos.write(jspOb);

jspFos.close();

__log.info("wrote static file name in ToHtml.java is: " + jspName + ", and content is: " + content);

}

__log.info("wrote static file name in ToHtml.java is: " + name);



}

}

而在原来的空间环境下:windows2000 advanced + jdk1.5 + Resin2下,上面红色的部分必须为下面的代码才行,否则是乱码:


FileOutputStream fos = new FileOutputStream(name);

        os.writeTo(fos);

fos.close();

String jspName = webPath.replaceAll(".htm", ".jsp");

if (!HtmlsManager.isExist(jspName, request)){ //write another same name's jsp static file that will include html file

FileOutputStream jspFos = new FileOutputStream(name.replaceAll(".htm", ".jsp"));

String content = "<%@ include file=\"/common/jsp301.jsp\" %>".concat("<jsp:include page=\"" + webPath + "\" />");

byte[] jspOb = content.getBytes();

jspFos.write(jspOb);

jspFos.close();

__log.info("wrote static file name in ToHtml.java is: " + jspName + ", and content is: " + content);

}

__log.info("wrote static file name in ToHtml.java is: " + name);

由于我对上面文件操作和字符编码的掌握也是模棱两可的,也不知道为什么要这样做,只知道这样做的结果是正确的。所以,就算是结果正确,上面的代码也很有可能有问题。像这些基础的技术确实应该真正理解和掌握。

这里有一个JAVA字符编码讲得比较透彻的文章,以后可以照着学一下。

    上篇:http://www.pconline.com.cn/pcedu/empolder/gj/java/0404/366404.html

    下篇:http://www.pconline.com.cn/pcedu/empolder/gj/java/0405/368760.html

Resin-3.0.18中出现的 "c:if" must not contain the '<' characte

本站移入Resin3.0.18后出现了一些问题,其中就是当调用一个jsp文件:/disall2.jsp时,出现下列报错,而这在原来的Resin2.*和Tomcat5.0.*是没有出现过的。


500 Servlet Exception

/disall2.jsp:1: org.xml.sax.SAXParseException: The value of attribute "test"

associated with an element type "c:if" must not contain the '<' character.

Resin-3.0.18 (built Fri, 24 Feb 2006 02:47:03 PST)

经过一行一行的检查文件中的<c:if>标记(JSTL的标记),发现下面一段可疑的代码:


     <c:if test="false">

      <font size="3">

     </c:if>

     <c:if test="false">

      <font size="4">

     </c:if>

里面有小于号“<”,于是试着把上面的代码改成:


     <c:if test="false">

      <font size="3">

     </c:if>

     <c:if test="false">

      <font size="4">

     </c:if>

这样,就OK了。

在JSTL的关系运算中,有两套等效的运算符。如:ge 相当于 >= ;lt 相当于 < ;le 相当于 <= 等等。

完整的有:


类别  运算符

算术运算符 + 、 - 、 * 、 / (或 div )和 % (或 mod )

关系运算符 == (或 eq )、 != (或 ne )、 < (或 lt )、 > (或 gt )、 <= (或 le )和 >= (或 ge )

逻辑运算符 && (或 and )、 || (或 or )和 ! (或 not )

验证运算符 empty

但是它们的使用有什么区别呢?我还不知道。谁知道了提一下,谢谢。

网页上几段script代码引起的网页正文加载问题

我发现诸如:

<script src="http://dict.cn/hc/" type="text/javascript"></script>

这类的script加载代码如果执行不能完成有可能引起整个网页的加载不能完成。

我发觉这类代码的执行是顺序进行的。也就是说,如果某段这类的代码没有执行完成的话,它后面的内容也不会执行。所以,如果后面有网页正文的内容的话,整个网页正文都显不出来。如果把这类代码放在了一个表格中,由于表格必须里面所有的内容加载完后才能显示出来,当这类代码的执行不能完成,所有表格的内容都显示不出来。

今天中午,我发现由于Dict.CN的划词代码(我放在网页的最前面的)执行不能完成,导致整个网页内容不能显示出来;还有,奇怪的是,今天cnzz的统计代码也不能执行完成,导致其后面的内容不能执行(如我统计帖子访问的计数代码,不是cnzz的统计计数,是我自己的用数据库保存的帖子访问计数。)

现在,我按:自己的页面统计计数代码,Dict.CN划词翻译代码,cnzz统计代码的顺序把这些代码放在了紧接</body>的前面,也是全部网页的最后。这样,这些代码就不会影响整个网页正文的加载了。

划词翻译的开关状况代码仍然是放在网页的最前面的,我想,这个开关状态代码没有调用Dict.CN网站上的资源,不会引起加载延迟吧。

附上面提到的几段script代码:

1、划词翻译状态开关代码,放在网页的最前面:


<span id="dict_status"></span>

下面的代码按序放在紧接</body>之前(这个位置科不科学还未考证):

2、本站自己的帖子页面计数代码:


<script language="javascript" src="/count.do?artID=<c:out value="${aGoal.articleID}"/>"></script>

3、Dict.CN的划词翻译代码:


<script src="http://dict.cn/hc/" type="text/javascript"></script>

<script type="text/javascript">

dictInit();

</script>

4、cnzz的页面访问统计代码:


<script src='http://s**.cnzz.com/stat.php?id=***&web_id=***&show=pic' language='JavaScript' charset='gb2312'></script>

看来,script在网页上用处真的很大,什么时候也该好好学一下了。

怎样控制iframe内嵌网页的位置

在日记静态页面嵌入jsp动态页面的一些总结和疑问中有一个问题如下:


1、页面菜单上部的用户信息是用iframe嵌入的,像下面:

   <!-- show user state with iframe framework -->

   <iframe frameborder="0" name="user_state" width="771" height="30"

scrolling="no" src="/common/userState.jsp"></iframe>

/common/userState.jsp是从当前session中取出用户的相关信息显示出来。

不过,我发现: 在firefox中位置不动的信息条在IE中却可以用鼠标上下移动,而且,始

位置在底部,还把字脚给挡住了,搞不懂怎么做了?

昨天,在把Dict.CN的部分免费学英语服务加在网站上的过程中,借鉴了iciba.com的多爱英文中的查词代码,把上面的代码改成下面这个样子,这样,在IE和firefox中这个iframe中的内容都能靠上正常显示了。如下:


<DIV><IFRAME border="0" marginWidth="0" marginHeight="0" src="/common/userState.jsp" frameBorder="no" width="771" scrolling="no" height="21"></IFRAME></DIV>

我不知道究竟是DIV的原因还是marginWidth或者marginHeight的原因,反正结果正常了。又是一个知其然不知其所以然的问题:)。

以后对这类技术还是应该进行系统的学习才是解决这些问题的根本。

把Dict.CN的部分免费学英语服务加在网站上

今天开始,我试着在用Dict.CN的部分服务:包括:划词、英语口语每日一句、中英文词及短语双向翻译。就是大家现在看到的本站每一网页的顶部那一排内容。Dict.CN他们的免费服务不止这些,完整的包括(摘自他们的使用帮助):

1. 在线拼音输入法

2. 在线Dict.CN机器人

3. QQ迷你门户

4. 划词助手-划遍天下网

5. 鼠标右键单词查询

6. Dict.CN站点划词翻译

7. Web API接口

8. 在您的主页上提供在线词典服务

9. 在您的博客上显示每日学口语的例句和发音

 

因为,Dict.CN的“中英文词及短语双向翻译”只适用于GB2312网页,在我的UTF-8网页上输入中文查询英文是乱码,不能工作。于是,我就把这个功能用iframe框架放在了一个GB2312的网页上,连带也把每日一句放进去了。因为那个划词翻译(也是可以中英文互译的)必须放在当前被翻译的页面中,所以就没有放进iframe框架内。

还有,如果为了避免加载速度影响整个网页的显示而采用原来使用的延迟加载技术(让del.icio.us不影响页面的加载(转帖)),好像划词翻译和每日一句就不会当鼠标移到上面而自动发音,不知道为什么。所以,就没有使用这种延迟加载技术。不过,现在来看,还没有看到Dict.CN因加载速度而影响整个网页加载的情况。服务的加载速度也许是这类网站发展壮大的关键因素之一,试想,你的服务和技术再好,却加载太慢,谁还有耐心等待你的优质服务?这也是这类网站要真正做大就必须想办法盈利的重大原因和前提之一。服务好-》盈利-》服务更好-》更盈利。。。,这才是这类网站(也许是更多的网站)做大做好,更好为网友服务的根本之道。

几个月前曾经试过的www.iciba.com的每日一句(在网站上显示每日一句>英语和在帖子中背单词),后来因为iciba的每日一句输出代码失效长达一个月以上就没有用了(取消了网站头部无效的金山词霸每日一句展示)。不过,金山词霸现在也专门推出了供其他网站调用资源的免费代码,包括(摘自他们的网站):

词典搜索

短句搜索

每日一句

每日 E文

即划即译

我不知道Dict.CN的服务究竟如何,也不知与iciba.com相比的优势和劣势,作为一个用户,我只用适合自己和适合上这个网站的朋友的服务。

附本站的用上述的Dict.CN的免费服务的代码,因为我是多个服务一起使用,就把每日一句中一个多余Dict.CN的链接去掉了(正常使用一般看不见这个链接,但是用linux下的w3m浏览器就看见了,而且在搜索引擎眼中这个链接应该是可见的),但是保留了查词功能中的Dict.CN的链接。实际上,Dict.CN的这个链接在我看来,从功能上的使用上来说仍然是多余的。但是,尊重Dict.CN的意见,特地保留了这个链接,也算是对Dict.CN为广大网友提供免费服务的赞赏吧:)。话又说转来,像单独的我们这样的小站,挂链接和不挂链接对Dict.CN也没有什么影响。Dict.CN只有取得许多网友的赞赏才能蓬勃发展,成为在线词典甚至在线英语学习的重量级网站。

下面是源码1:/common/dict.jsp,用<%@ include file="/common/dict.jsp" %>加在每一网页的顶部。


<table border="0" width="771" align="center">

<tr align="center">

<td width="105">

<span id="dict_status"></span>

<script src="http://dict.cn/hc/" type="text/javascript"></script>

<script type="text/javascript">

dictInit();

</script>

</td>

<td>

<DIV><IFRAME border="0" marginWidth="0" marginHeight="0" src="/common/dict_search.jsp" frameBorder="no" width="666" scrolling="no" height="45"></IFRAME></DIV>

</td>

</tr>

</table>

源码2:/common/dict_search.jsp


<%@ page contentType="text/html; charset=GB2312" %>

<html>

 <head>

  <title>

   Dict.CN english-chinese word search

  </title>

   <link rel="stylesheet" href="/common/web_font.css" type="text/css">

 </head>

 <body>

<table border="0" width="666" align="center">

 <tr align="center">

 <td>

 <span id="dict_daily">

 </span>

<script language="JavaScript" src="http://dict.cn/daily.php" defer="defer">

</script>

 </td>

 <td>

<form method="post" target="_blank"

action="http://dict.cn/search/">

<input maxlength=256 size=21 name=q><br>

<input type="submit" value="Look Up">

<a href="http://dict.cn" target="_blank">在线词典</a>

</form>

 </td>

 </tr>

 </table>

 </body>

</html>

上面的查词中有一个Dict.cn的链接,当我在linux的w3m浏览器输入了生词后按TAB键的焦点落在了链接上,而不是提交按纽。所以,我把这个链接移到了后面。我想,保留这个链接还是必要的。一是对Dict.CN意见的尊重,对他们服务的赞赏;二是这样做应该对他们的产品的推广有利,不管是从搜索引擎优化的角度还是让用户更好的记住他们:Dict.CN。一句话,Dict.CN在他们的网站上要求“定制效果时希望您能尽量保留在线词典的链接”是恰当的:)

Thinking in Patterns Ch. 13: Reducing interface complexity

Thinking in Patterns with Java V0.9: Chapter 13: Reducing interface complexity: TIPatterns.htm#_Toc41169743

1, Sections:

 Facade. 105

   Package as a variation of Facade  106

2, The main content and feeling:

  What is Facade? Bruce tell me:"If something is ugly, hide it inside an object.".

  After reading this chapter, I can got some below:

 

  1), Design pattern is really a pratical technique.

  Although I read this book, and know some of Facade, and know its example://:

facade:Facade.java, but, I feel I can't understand it without a real applying

of this pattern. Maybe, I will use it later.

  2), Just like Bruce's feeling:"To me, the Facade has a rather "procedural" (non-object-oriented) feel to it: you are just calling some functions to give you objects."

  3), Facade is most useful to C++ programmer, in java, "package" is a

build-in Facade.

 

3, Questions about programming:

  

  1), If it is that the function of Facade Pattern is only acting as a factory to create some objects? It can't call another object's method to process something in a static method just like below?


class A {

  void f(){}

}

public class B {

  static void doFinA() {

    (new A()).f();

  }

}

  

Then, I can do something like this:

B.doFinA();

4, Questions about english language:

1), Strange words:

    cast about, mold, first-cut, tax adviser, tax code, mediator, as if, to be

fair, clash, majority

2), Difficult sentences:

 

                                     incomplete