Dedian  
-- 关注搜索引擎的开发
日历
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567
统计
  • 随笔 - 82
  • 文章 - 2
  • 评论 - 228
  • 引用 - 0

导航

常用链接

留言簿(8)

随笔分类(45)

随笔档案(82)

文章档案(2)

Java Spaces

搜索

  •  

积分与排名

  • 积分 - 64852
  • 排名 - 816

最新评论

阅读排行榜

评论排行榜

 

GData, Google data API, provides a simple standard protocol for reading and writing data on the web, which supports two common XML-based syndication formats (Atom and RSS).

Briefly browse the documents and javadoc of GData, I found that it is very similiar to my thought on my current clustering searching engine system, designing an interface of data structure for all the request to searching engine servers, and employing an other interface to handle external/internal requests and fill up the data structure.

Although my first version of searching engine has been deployed on LiveDigital, I am still working on the new version with clustering design. source code has been packaged and implementation document is almost done, I still hope I can learn something from GData, more professional and structrual design. 

posted @ 2006-05-16 06:01 Dedian 阅读(253) | 评论 (0)编辑 收藏
 
  1. Google Blog - googleblog.blogspot.com
  2. Google Talkabout - googletalk.blogspot.com
  3. Google Base Blog - googlebase.blogspot.com
  4. Google Video - googlevideo.blogspot.com
  5. Inside Google Desktop - googledesktop.blogspot.com
  6. Google Code - code.google.com
  7. Inside AdWords - adwords.blogspot.com
  8. Inside AdSense - adsense.blogspot.com
  9. Google Reader Blog - googlereader.blogspot.com
  10. Blogger Buzz - buzz.blogger.com
  11. AdWords API Blog - adwordsapi.blogspot.com
  12. Google Enterprise Blog - googleenterprise.blogspot.com
  13. Google Research - googleresearch.blogspot.com
  14. Google Maps API Blog - googlemapsapi.blogspot.com
  15. Google Writely - writely.blogspot.com
  16. Inside Google Book Search - booksearch.blogspot.com
posted @ 2006-05-16 03:57 Dedian 阅读(211) | 评论 (0)编辑 收藏
 
Purpose:

To control access to an object, provide a surrogate or placeholder (proxy) for it. As a mostly used strategy, Proxy can defer the creation and initialization of the object until it is on demand.

Structure:

Similar to adapter, client includes an object of proxy to access, and proxy includes a real object that proxy represents.

Difference from Adapter:

Adapter provides a different interface to the object it adapts. In contrast, Proxy provides the same interface as its subject. As a protection of real object, Proxy can refuse to perform an operation that the subject will perform.

Example:
http://www.javaworld.com/javaworld/jw-02-2002/jw-0222-designpatterns.html

Reference:
Book: (GoF)Design Patterns
http://en.wikipedia.org/wiki/Proxy_design_pattern
http://www.inf.bme.hu/ooret/1999osz/DesignPatterns/Proxy4/
http://alumni.media.mit.edu/~tpminka/patterns/Proxy.html


posted @ 2006-05-12 04:10 Dedian 阅读(278) | 评论 (0)编辑 收藏
 
Purpose:

Encapsulate a set of objects which interact with each other. The benefit to do this is keeping objects from communicating with each other directly. All the messages between objects should be sent to mediator at first and then mediator will control and coordinate those interaction. Also, mediator can handle external interaction request and decide which object to response the external request.

Structure:

star topology: Mediator class is as a hub which connects to a set of classes (colleague classes).

Difference from Facade Pattern:

Facade differs from Mediator in that it abstracts a subsystem of objects to provide a more convenient interface. Its protocol is unidirectional. That is, Facade objects make requests of the subsystem classes but not vice versa. In contrast, Mediator enables cooperative behavior that colleague objects don't or can't provide, and the protocol is multidirectional.

reference:

Gamma, E., R. Helm, R. Johnson, J. Vlissides (1995). Design Patterns. Addison Wesley. ISBN 0.201-63361-2
http://sern.ucalgary.ca/courses/seng/443/W02/assignments/Mediator/
http://my.execpc.com/~gopalan/design/behavioral/mediator/mediator.html
posted @ 2006-05-12 03:24 Dedian 阅读(299) | 评论 (0)编辑 收藏
 
Just wanna add an additional screen for better working, LCD monitor is my favorite thought, here is good article for purchase guide:

http://reviews.cnet.com/4520-7610_7-5084364-3.html

and also I have some interests in ViewSonic type

http://www.viewsonic.com/products/desktopdisplays/lcddisplays/valueseries/va902b/

but i am not sure if it is best deal :(. coz PRINCETON also has a not bad deal which is cheaper and with DVI connector...

still thinking and hunting, should be settled down by this week.
posted @ 2006-05-11 05:39 Dedian 阅读(207) | 评论 (2)编辑 收藏
 
http://www.metanotes.com/
posted @ 2006-05-06 10:00 Dedian 阅读(179) | 评论 (0)编辑 收藏
 
Just installed on my xp machine today, updated with Callisto Discovery Site, seems lots of plugins have been integrated. I'd like to see c++, TPTP, WST and UML plugin tools in it. But still don't know how to play Visual Editor ...can't get rid of crutch thought from Microsoft kits..
posted @ 2006-05-05 11:29 Dedian 阅读(244) | 评论 (0)编辑 收藏
 
问:
都是撞车而死,J2EE程序员与.Net程序员有什么区别?

答:
J2EE程序员死前有刹车的痕迹----一种打破常规的操作。
posted @ 2006-05-05 11:19 Dedian 阅读(393) | 评论 (1)编辑 收藏
 
虚无主义者是这样一种人,对于如其所是地存在的世界,他断定它不应当存在;对于如其应是地存在的世界,他断定它并不实存。

--摘自朋友的Blog

这个说的比较抽象,俺翻译如下,不知是否达意:

if exists(A)
{
     Assert(!A.bExisting);
}
else if(A != null && A.bExisting)
{
     Assert(!exists(A));
}

 


posted @ 2006-05-04 13:34 Dedian 阅读(306) | 评论 (0)编辑 收藏
 
1. Design your own Exception hierarchy to handle all categories of potential errors in your system
2. extend Exception class for your throwable error-handled classes
3. Throw your defined exception classes in your code block in necessary
4. Embed error information in your defined exception
5. if you develop with new Java, be noticed that Exception implements serializable interface, you need define a static final variable for serial version UID, otherwise, warn message will be given by new compiler.

here is a good article to talk about this issue.
posted @ 2006-05-03 06:58 Dedian 阅读(205) | 评论 (0)编辑 收藏
 
1. put every class in certain packages, including those test classes, not like to use Default package
2. generate .Jar file including thoes packages.
3. write script files (*.sh) to run certain test java classes in .Jar in same folder as my .Jar file and set CLASSPATH in my script files
ex:
export CLASSPATH=$CLASSPATH:com.mycompany.util-1.0.0.jar
java com.mycompany.util.TestClass
4. then run the script file...

or, we can use command line like this: java -classpath *.jar ..TestClass

Note: be sure to use complete path for testing classes, otherwise famours NoClassDefFound error will be thrown out.
posted @ 2006-05-02 05:15 Dedian 阅读(246) | 评论 (0)编辑 收藏
 
1. String --> InputStream

InputStream convertToInputStream(String str)
{
        ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes());
        return is;
}

2. InputStream --> String
    
String convertToString(InputStream is)
{
      
       BufferedReader in = new BufferedReader(new InputStreamReader(is));
        StringBuffer buffer = new StringBuffer();
        String line = "";
        while ((line = in.readLine()) != null)
        {
             buffer.append(line);
         }
         return buffer.toString();
           
}

When I do the socket programming, I always need to deal with inputstream and string, above are the basic ways to so that, but I am not sure if there are any simpler ways to do that...

posted @ 2006-04-29 05:17 Dedian 阅读(618) | 评论 (3)编辑 收藏
 

To configure a persistent CLASSPATH under Windows XP:

  1. Click the Start Button
  2. Select the Control Panel
  3. Click Switch to Classic View
  4. Click the System button
  5. Select the Advanced tab
  6. Click the Environment Variables button
  7. Click the New button to create a CLASSPATH or the Edit button to edit an existing CLASSPATH
  8. Enter CLASSPATH as the variable name
  9. Enter the list of directories or jar files in your CLASSPATH as the variable value, using a semicolon to separate entries in your list
  10. Click OK
  11. Click OK
  12. Click OK
posted @ 2006-04-28 03:05 Dedian 阅读(283) | 评论 (3)编辑 收藏
 
It is common problem of convertion between int & string for certian computer language. Well, in Java, following are some easy ways I usually apply:

1. int --> String
    a. apply "+" operation with an empty string
          ex:
          int index = 20;
          String indexStr = "" + index;
    b. use String function
          ex:
          int index = 20;
          String indexStr = String.valueOf(index);
    c. convert to Integer class firstly
          ex:
          int index = 20;
          Integer Index = new Integer(index);
          String indexStr = Index.toString();
          or
          String indexStr = Integer.toString(index);

2. String --> int
    a. use class Integer parse funtion
       ex:
       String indexStr = "20";
       int index = Integer.parseInt(indexStr);
       or
       int index = (new Integer(indexStr)).intValue();

note: above convertion methods can be applied to other number types, such as float, long, double...

P.S. for 1.a method, should be noticed that following two expression are different:
int i = 7;
int j = 8;

String str1 = i + j + ""; //(str1 == "15")
String str2 = "" + i + j; //(str2 == "78")
 
posted @ 2006-04-25 09:22 Dedian 阅读(730) | 评论 (0)编辑 收藏
 
purpose:

Make your code robust and protect your code from invalid data, events or other unexpectable impact.

good habits:

-- Handle for invalid inputs (data from external sources, routine input parameters)
    a. garbage in, nothing out
    b. garbage in, error message out
    c. no garbage allowed in

-- Build your own assert machanism (for debugging purpose)
    a. avoid putting executable code into assertion (otherwise will miss some execution code when releasing)
   
-- Error-Handling Techniques
    a. return a neutral/closest value
    b. skip to next valid data
    c. return last valid data
    d. Log a warning message to a file (Log file)
    e. Return a defined error code (Throw an exception)
    f. call an error-processing routine/object
    g. display an error message (System.out.print)
    h. shut down

-- tips for Exception mechanism
    a. avoid throwing exceptions in constructors and destrictors unless you catch them in the same place.
    b. throw exceptions at the right level of abstraction
    c. avoid empty catch blocks
    d. consider creating your own project-specific exception class, which can serve as the base class for all exceptions thrown on your project. This supports centralizing and standardizing logging, error reporting and so on.

-- Damage-containment strategy: Barricade your program (add a firewall layer for your code which maybe contains Assertions and Error-handlers)

-- Debugging Aids
    a. use offensive programming to notify yourself the potential errors
    b. handle exception cases in a way that makes them obvious during development and recoverable when production code is running.
    c. use version-control tools and build tools like ant and make


posted @ 2006-04-22 05:40 Dedian 阅读(150) | 评论 (0)编辑 收藏
仅列出标题
共6页: 上一页 1 2 3 4 5 6 下一页 
 
Copyright © Dedian Powered by: 博客园 模板提供:沪江博客