<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    URL分別用三個List保存,
    一個是boring,這個list中的url最后來下載
    其他兩個是interesting和average
    當搜索到url時檢查是否包含設定為boring的詞,并放入boring中

    用戶可設定“深度搜索”:每搜到一個url就放在list的最前面
    也可廣度

    有些網頁鏈接要特殊處理:

    url = textReplace("?", URLEncoder.encode("?"), url);
    url = textReplace("&", URLEncoder.encode("&"), url);
    private String textReplace(String find, String replace, String input)
    {
        int startPos = 0;
         while(true)
        {
            int textPos = input.indexOf(find, startPos);
            if(textPos < 0)
            {
                break;
            }
            input = input.substring(0, textPos) + replace + input.substring(textPos + find.length());
            startPos = textPos + replace.length();
        }
        return input;
    }

    讀取資源代碼:

    BufferedInputStream remoteBIS = new BufferedInputStream(conn.getInputStream());
    ByteArrayOutputStream baos = new ByteArrayOutputStream(10240);
    byte[] buf = new byte[1024];
    int bytesRead = 0;
    while(bytesRead >= 0)
    {
        baos.write(buf, 0, bytesRead);
        bytesRead = remoteBIS.read(buf);
    }

    byte[] content = baos.toByteArray();


    建立多級目錄:

    File f = new File(fileName);
    f.getParentFile().mkdirs();
    FileOutputStream out = new FileOutputStream(fileName);
    out.write(content);
    out.flush();
    out.close();


    給一個變量寫doc:(在eclipse中,鼠標置上會顯示)

    /**
    * Set of URLs downloaded or scheduled, so we don't download a
    * URL more than once.
    * Thread safety: To access the set, first synchronize on it.
    */
    private Set urlsDownloadedOrScheduled;


    這種log挺好:(apache log4j)

    private final static Category _logClass = Category.getInstance(TextSpider.class);

    /*
    顯示信息: 2005-05-01 11:40:44,250 [main] INFO? TextSpider.java:105 - Starting Spider...
    */
    _logClass.info("Starting Spider...");

    posted @ 2006-02-16 14:10 羅明 閱讀(620) | 評論 (0)編輯 收藏
     
    當下載第一個URL時(一般是網站主頁),如果等待時間過長,那么其他線程要么會認為網站已下載完而結束,要么會在下面標*代碼處拋出NullPointerException, 很少能夠存活下來。

    else if(queueSize() == 0)       /* queueSize()已經被同步 */
    {
        break;
    }
    URLToDownload nextURL;
    synchronized(queue)
    {
        nextURL = queue.getNextInQueue();
        downloadsInProgress++;
    }
    synchronized(urlsDownloading)
    {
        urlsDownloading.add(nextURL);
    }
    int newDepth = nextURL.getDepth() + 1; **********************


    估計可能是線程交叉了,還沒來得及同步就跑到后面去執行getDepth()了。
    nextURL = queue.getNextInQueue();后面加上判斷就OK了:

    synchronized(queue)
    {
        nextURL = queue.getNextInQueue();
        if(nextURL == null)
        {
            continue;
        }

        downloadsInProgress++;
    }


    posted @ 2006-02-16 14:10 羅明 閱讀(1110) | 評論 (0)編輯 收藏
     

    I had to get obsessed with keyboard shortcuts when using IDEA.
    Apparently some of that must have rubbed off, because
    lately I've been looking for shortcuts to methods and classes in Eclipse 3.0.

    There are two traversal shortcuts I use all the time: Ctrl-O and Ctrl-T.

    Ctrl-O shows the methods of the class in the current editor in a popup.
    Hit Ctrl-O when the popup is up, and you'll see all the inherited
    methods as well. This is incredibly useful, as it allows me to bounce
    between methods even when I'm not sure which class is implementing
    which method.

    Ctrl-T shows the type hierarchy of a selected type in a popup. This is the
    complement to Ctrl-O. When I'm sure of what
    interface I'm looking at, but I really want to pick a particular implementation
    and want to go trawling through that
    implementation for a bit, Ctrl-T will show me all the subclasses or
    implementors for that type.

    There is a third option which I haven't used much. Ctrl-F3 shows the
    methods of a selected type in a popup. I can see how this can be useful,
    but in practice I have a pretty good idea of which methods are attached
     to which classes and Ctrl-Space fills most of my needs there.

    However, I have been missing a couple of things. These are the shortcuts
    I just found recently, and are very good for hitting up random files:

    Ctrl-E shows a popup list of all the open files.
    Ctrl-Shift-T creates a dialog box that you can use to navigate to any class.
    Ctrl-Shift-R creates a dialog box that shows any resource in the project
    (basically any file.)
    Alternately, there's an Eclipse plugin called GotoFile which seems to behave
    a little more "IDEAish".

    Finally, I found a plugin which actually integrates Eclipse with Windows!
    Eclipse Platform Extensions is actually functional and useful, although
    you wouldn't guess it by looking at the website. Although it says that
    it provides a "System GC" functionality, it actually does far more,
    like provide a "Open in Windows Explorer" and
    "Open Command Window here" dialog to the Package Explorer.

    posted @ 2006-02-16 14:09 羅明 閱讀(388) | 評論 (0)編輯 收藏
     

    Installing the help system as an infocenter

    You can allow your users to access the help system over the Internet or an intranet, by
    installing the infocenter and the documentation plug-ins on a server. Clients view help
    by navigating to a URL, and the help system is shown in their web browser. The
    infocenter help system can be used both for client applications and for web
    applications, either of which can have their help accessed remotely. All features
    of help system except infopops and active help are supported.

    The infocenter help system allows passing number of options that can be used to
    customize various aspects of the infocenter. The following options are supported:

    • -eclipsehome eclipseInstallPath - specifies Eclipse installation directory.
      This directory is a parent to "plugins" directory and eclipse executable.
      The option must be provided, when current directory from which infocenter
      is launched, is not the same as Eclipse installation directory.
    • -data instanceArea - specifies a path that Eclipse can use to write instance data.
      The value can be an absolute path of a directory, or a path relative to Eclipse
      installation directory. The option must be provided when Eclipse is installed in
      the read only location, or has been customized to override osgi.instance.area
      or osgi.instance.area.default properties.
    • -host helpServerHost - specifies host name of the interface that help server
      will use. It overrides host name specified in the application server plugin preferences.
    • -port helpServerPort - specifies port number that help server will use. It overrides
      port number specified in the application server plugin preferences.
    • -locales localeList - specifies a list of locales that infocenter will recognize and
      provide a customized content for. If the option is not specified, infocenter will
      build navigation, and index documents for each preferred locale of the browsers
      accessing the infocenter. When the option is present, locales from browser
      requests will be matched with locales in the list. If browser preferred locale
      does not exist in the list, but its language part does, it will be used. Subsequently,
      additional browser locales in decreased order of preference will be matched
      against the list. If none of the browser locales (or its language part) matches any
      locale on the list, the client will be served content in the default locale - server
      locale or locale passed with -nl option. For example using options
      -nl en -locales de en es fr it ja ko pt_BR zh_CN zh_TW
      will cause infocenter operating in 10 locales. All other locales will receive content
      for en locale.
    • -dir rtl - sets right-to-left rendering direction of help UI in the browser.
    • -noexec - indicates that Eclipse executable should not be used. You may need to use
      this option when running on a platform for which Eclipse executable is not available.
    • Additionally, most options accepted by Eclipse executable can be passed. They are
      especially useful during debugging and for applying customization to Eclipse.
      For example, passing options
      -vmargs -Xmx256M 
      increases memory available to the infocenter and will allow serving a larger book collection.

    Installation/packaging

    These steps are for the help system integrator and are not meant to address all the possible scenarios.
     It is assumed that all your documentation is delivered as Eclipse plug-ins and, in general, you are
    familiar with the eclipse help system.

    1. Download the Eclipse Platform Runtime Binary driver from www.eclipse.org.
    2. Install (unzip) the driver in a directory, d:\myApp. This will create an eclipse sub-directory,
      d:\myApp\eclipse that contains the code required for the Eclipse platform
      (which includes the help system).

    How to start or stop infocenter from command line

    The org.eclipse.help.standalone.Infocenter class has a main method that you can use to
    launch infocenter from a command line. The command line arguments syntax is:

    -command start | shutdown | [-eclipsehome eclipseInstallPath] 
    [-data instanceArea] [-host helpServerHost] [-locales localeList]
    [-port helpServerPort] [-dir rtl] [-noexec] [platform options]
    [-vmargs JavaVMarguments]

    To start an infocenter on port 8081 issue a start command by running

    java -classpath d:\myApp\eclipse\plugins\org.eclipse.help.base_3.1.0.jar 
    org.eclipse.help.standalone.Infocenter -command start -eclipsehome
    d:\myApp\eclipse -port 8081

    To shut the infocenter down issue a shutdown command by running

    java -classpath d:\myApp\eclipse\plugins\org.eclipse.help.base_3.1.0.jar 
    org.eclipse.help.standalone.Infocenter -command shutdown -eclipsehome
    d:\myApp\eclipse

    Using the infocenter

    Start the web server. Point a web browser to the path "help" web application running on a port
    specified when starting the infocenter.  On the machine the infocenter is installed, this would be
    http://localhost:8081/help/.

    How to start or stop infocenter from Java

    When including infocenter as part of another application, it may be more convenient to start it
    and stop using Java APIs instead of using system commands. Follow the steps if it is the case:

    1. Make sure d:\myApp\eclipse\plugins\org.eclipse.help.base_3.1.0.jar is on your app classpath.
      The class you use to start, and shut down the infocenter isorg.eclipse.help.standalone.Infocenter.
    2. Create an array of String containing options that you want to pass to the infocenter. Typically,
      the eclipsehome and port options are needed.
      String[] options = new String[] { "-eclipsehome", "d:\\myApp\\eclipse" ,
      "-port", "8081" };
    3. In your application, create an instance of the Help class by passing the options.
      Infocenter infocenter = new Help(options); 
    4. To start the help system:
      helpSystem.start();
    5. To shut the infocenter down:

      helpSystem.shutdown(); 

    Making infocenter available on the web

    Eclipse contains a complete infocenter and does not require other server software to run.
    However, in unsecure environment like Internet, it is recommended infocenter is not accessed
    directly by clients, but is made available through an HTTP server or an application server.
    Most servers come with modules or servlets for delegating certain request to other web
    resources. For example, one may configure a proxy module of Apache HTTP Server to
    redirect requests made to http://mycompany.com/myproduct/infocenter to
    http://internalserver:8081/help that runs an infocenter. Adding the lines

    LoadModule proxy_module modules/ApacheModuleProxy.dll
    ProxyPass /myproduct/infocenter http://internalserver:8081/help
    ProxyPassReverse /myproduct/infocenter http://internalserver:8081/help
    
    to conf/httpd.conf file of Apache server running mycompany web site accomplishes this.

    Some versions of Apache HTTP server, may contain AddDefaultCharset directive enabled in
    configuration file. Remove the directive or replace with

    AddDefaultCharset Off
    to have browsers display documents using correct character set.

    Running multiple instance of infocenter

    Multiple instances of infocenter can be run on a machine from one installation. Each started
    instance must use its own port and be provided with a workspace, hence -port and -data
    options must be specified. The instances can serve documentation from different set of plug-ins,
    by providing a valid platform configuration with -configuration option.

    If -configuration is not used and configuration directory is shared among multiple infocenter
    instances, with overlapping set of locales, it must be ensured that all search indexes are created
    by one infocenter instance before another instance is started. Indexes are saved in the configuration
    directory, and write access is not synchronized across infocenter processes.

    [Optional] Installing a minimal set of plug-ins

    The infocenter does not require the entire  Eclipse Platform package. It is possible to run the
    infocenter with the following plug-ins (located in the  eclipse\plugins directory):

    org.apache.lucene
    org.eclipse.core.runtime
    org.eclipse.help
    org.eclipse.help.appserver
    org.eclipse.help.base
    org.eclipse.help.webapp
    org.eclipse.osgi
    org.eclipse.tomcat
    org.eclipse.update.configurator

    Some documentation plug-ins may have dependencies on other plug-ins, usually by specifying required
    plug-ins in their plugin.xml. The dependent plug-ins need to be installed on the infocenter as well.
    Additionally, plug-ins that were designed for earlier than 3.0 version of Eclipse implicitly require an org.eclipse.core.runtime.compatibility being present plug-in to work.

    Infocenter plug-ins can be updated without restarting the infocenter, using commands explained
    in Updating a running infocenter from command line topic. To use this functionality, the minimal
    set of plug-ins must include org.eclipse.update.core plug-in.

    See Help System Preferences for more information on customizing help system.

    posted @ 2006-02-16 14:08 羅明 閱讀(574) | 評論 (0)編輯 收藏
     
    Class.forName is excellent
    例:

    Class.forName("weblech.util.Log4j");

    在Log4j里定義一個靜態類構造器,里面放apache log4j的初始代碼。

    其他如注冊數據源、界面本地化。。。

    Eclipse看代碼是最爽的:
    查看類的引用、代碼導航
    posted @ 2006-02-16 14:07 羅明 閱讀(283) | 評論 (0)編輯 收藏
     

          調試網頁時出錯,無意中發現出錯頁的源文件中有這樣一段注釋:

    <title>404 Not Found</title>
    <h1>404 Not Found</h1>
    /asfsfdsd.jsp was not found on this server.
    <p /><hr />
    <small>
    Resin 2.0.3 (built Wed Oct 17 10:11:08 PDT 2001)
    </small>
    </address>

    <!--
      -- Unfortunately, Microsoft has added a clever new
      -- "feature" to Internet Explorer.  If the text in
      -- an error's message is "too small", specifically
      -- less than 512 bytes, Internet Explorer returns
      -- its own error message.  Yes, you can turn that
      -- off, but *surprise* it's pretty tricky to find
      -- buried as a switch called "smart error
      -- messages"  That means, of course, that many of
      -- Resin's error messages are censored by default.
      -- And, of course, you'll be shocked to learn that
      -- IIS always returns error messages that are long
      -- enough to make Internet Explorer happy.  The
      -- workaround is pretty simple: pad the error
      -- message with a big comment to push it over the
      -- five hundred and twelve byte minimum.  Of course,
      -- that's exactly what you're reading right now.
      -->

    這就叫以牙還牙:凡是用Resin服務器的網站,都不會出現M$的惱人友好信息了。

    posted @ 2006-02-13 18:27 羅明 閱讀(1025) | 評論 (0)編輯 收藏
     
    以前一直沒找到這個選項,以為不可以呢。終于發現工具菜單-->選項里的“播放機設置”欄的第一個復選框就是設置將播放器置于最前端。寫出來怕大家有需要的^_^
    posted @ 2006-02-12 16:35 羅明 閱讀(801) | 評論 (1)編輯 收藏
     
    Bill Scott's AJAX Blog: Nine Tips for Designing Rich Internet Applications
    If you were going to provide some quick basic guidelines for designing rich applications what would they be?

    posted @ 2006-01-09 17:16 羅明 閱讀(460) | 評論 (0)編輯 收藏
     
    源多說明通過你的apt能安裝更多軟件,如果下列鏈接有效,就將它加到你的sources.list (注意順序,將速度最快的放在最前頭,apt會默認用前面的鏈接下載軟件)

    deb ftp://ftp.sjtu.edu.cn/sites/archive.ubuntu.com breezy main restricted universe multiverse
    deb ftp://ftp.sjtu.edu.cn/sites/archive.ubuntu.com breezy-updates main restricted universe multiverse
    deb ftp://ftp.sjtu.edu.cn/sites/archive.ubuntu.com breezy-security main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu breezy main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu breezy-updates main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu breezy-security main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu-cn breezy main universe multiverse restricted
    deb http://archive.ubuntu.org.cn/ubuntu hoary main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu hoary-security main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu hoary-updates main restricted universe multiverse
    deb http://archive.ubuntu.org.cn/ubuntu-cn ubuntu.org.cn main universe multiverse restricted
    deb http://archive.ubuntu.org.cn/ubuntu hoary-backports main universe multiverse restricted
    deb http://archive.ubuntu.org.cn/backports hoary-extras main universe multiverse restricted
    deb-src http://archive.ubuntu.org.cn/ubuntu hoary main restricted universe multiverse
    deb-src http://archive.ubuntu.org.cn/ubuntu hoary-security main restricted universe multiverse
    deb-src http://archive.ubuntu.org.cn/ubuntu hoary-updates main restricted universe multiverse
    deb http://helix.alioth.debian.org/deb sid main non-free
    deb-src http://helix.alioth.debian.org/deb sid main non-free
    deb http://ubuntu.cn99.com/ubuntu/ breezy main restricted universe multiverse
    deb http://ubuntu.cn99.com/ubuntu/ breezy-updates main restricted universe multiverse
    deb http://ubuntu.cn99.com/ubuntu/ breezy-security main restricted universe multiverse
    deb http://ubuntu.cn99.com/ubuntu-cn/ breezy main restricted universe multiverse
    deb http://ubuntu.cn99.com/backports/ breezy-extras main restricted universe multiverse
    posted @ 2006-01-07 17:02 羅明 閱讀(2165) | 評論 (0)編輯 收藏
     
    Source: http://openide.netbeans.org/tutorial/api-design.html#design.less.friend
    Allow access only from a friend code
    Another useful technique to not expose too much in API is to give access to certain functionality (e. g. ability to instantiate a class or to call a certain method) just to a friend code.

    Java by default restricts the friends of a class to those classes that are in the same package. If there is a functionality that you want share just among classes in the same package, use package-private modifier in definition of a constructor, a field or a method and then it will remain accessible only to friends.

    Sometimes however it is more useful to extend the set of friends to a wider range of classes - for example one wants to define a pure API package and put the implementation into separate one. In such cases following trick can be found useful. Imagine there is a class item:

    public final class api.Item {
        /** Friend only constructor */
        Item(int value) {
            this.value = value;
        }
    
        /** API method(s) */
        public int getValue() {
            return value;
        }
            
        /** Friend only method */
        final void addListener(Listener l) {
            // some impl
        }
    }
    
    that is part of the API, but cannot be instanitated nor listened on outside of the friend classes (but these classes are not only in api package). Then one can define an Accessor in the non-API package:
    public abstract class impl.Accessor {
        public static Accessor DEFAULT;
    
        static {
            // invokes static initializer of Item.class
            // that will assign value to the DEFAULT field above
            Class c = api.Item.class;
            try {
                Class.forName(c.getName(), true, c.getClassLoader());
            } catch (ClassNotFoundException ex) {
                assert false : ex;
            }
            assert DEFAULT != null : "The DEFAULT field must be initialized";
        }
    
        /** Accessor to constructor */
        public abstract Item newItem(int value);
        /** Accessor to listener */
        public abstract void addListener(Item item, Listener l);
    }
    
    with abstract methods to access all friend functionality of the Item class and with a static field to get the accessor's instance. The main trick is to implement the Accessor by a (non-public) class in the api package:
    final class api.AccessorImpl extends impl.Accessor {
        public Item newItem(int value) {
            return new Item(value);
        }
        public void addListener(Item item, Listener l) {
            return item.addListener(l);
        }
    }
    
    and register it as the default instance first time somebody touches api.Item by adding a static initializer to the Item class:
    public final class Item {
        static {
            impl.Accessor.DEFAULT = new api.AccessorImpl();
        }
    
        // the rest of the Item class as shown above
    }
    
    Then the friend code can use the accessor to invoke the hidden functionality from any package:
    api.Item item = impl.Accessor.DEFAULT.newItem(10);
    impl.Accessor.DEFAULT.addListener(item, this);
    posted @ 2006-01-05 21:01 羅明 閱讀(466) | 評論 (0)編輯 收藏
     
    [新華社]singlerly被雙規

        1月3日Man版消息。北京時間14點左右Man版傳出消息,來自紫丁香的singlerly日前在 
    Man版被雙規。 
        當地官員發言指出,該嫌疑犯是因為煽動灌水而于當天14點左右被捕的。目前正于押解 
    前往xiaoheiwu的途中。 
        據當地群眾稱,當地政府的權力混亂局面是singlerly同志遭到雙規的主要原因。很多群眾對singlerly的雙重不幸報以同情和羨慕。 
        另有一位不愿透露姓名的權威人士指出,造成這種混亂局面的原因是由于相親的處理問題,現在值班站務jimu小同學已基本控制了換亂的局面。 
        新華社駐Man版記者cc現場為您報道。 
    Re

    感謝前方記者為我們帶來的現場報道 

    現在是廣告時間 
    廣告過后請繼續關注
    Re

    下面繼續播報最新新聞: 

    丁香社哈爾濱1月3日電(記者八卦王子) 

    談天聊地實習片長jimu日前表示,目前8區關稅人員關系總體穩定,但斑竹和水友 
    和諧制度落實不到位、斑竹增長和調控機制不健全、侵害灌水者合法權益等問題 
    仍然比較突出。  

      

    jimu表明在第十一個五年規劃里借助改革深入攻堅戰,要基本解決斑竹缺額問題。 

    他進一步提出,要針對當前的突出矛盾,以建立和諧穩定的灌水關系為主線,以 
    維護最廣大的關稅者合法權益為重點,積極探索、創新校內BBS先進平臺條件下和 
    諧灌水關系和管理版面體制和機制。 
    Re

    本報訊  斑竹多id灌水是為了反恐 

    1月4日 紫丁香站長lanslot在聽證會上被問及:每個斑竹允許同時登陸3個帳號,免費獲取 
    上站時間和文章數,這是為了減輕紫丁香系統負擔么? 
    lanslot說:“眾所周知,目前國際恐怖勢力猖獗,bbs又是恐怖分子的重點襲擊對象,所 
    以必須加強bbs反恐力度,bbs斑竹義不容辭地擔負起bbs義務安全員的重要職責。”
    Re

    bbs 八卦報消息:關閉bbs是為了刷水箱 

    5月5日 紫丁香全面關閉,據紫丁香總管popstar稱:由于戰友灌水過多,導致紫丁香系統 
    水垢嚴重,暫時關閉紫丁香3天,清除水垢。具體放水時間另行通知。 

    另有消息說,本次關站與紫丁香上游水母廠爆炸有關。水母廠技術站長接受本報記者采訪 
    時稱:“爆炸只產生了二氧化碳和水”。 
    Re

    本報消息:freenxiaoyu稱有些斑竹的安全意識連普通用戶都不如 

    針對近期bbs斑竹jjason連續發生因為灌水,言語粗魯導致連續被封版面,直至 
    發生被封全站的惡性事故。紫丁香關稅安全部部長freexiaoyu怒斥jjason:“灌 
    水安全意識甚至連普通用戶都不如。”
    Re

    紫丁報消息:國際社會紛紛譴責派獨言論。 

    近日,紫丁香派獨分子公然宣稱“pielove版就是紫丁香的joke2”。針對這一言論 
    joke版斑竹迅速發表聲明稱:“joke版堅持一個joke原則”“紫丁香只有一個joke” 
    “joke版的主權和領土完整不容分割”。 

    國際社會也迅速做出反應紛紛表示譴責,pielove版斑竹theend,副斑竹dogcat也再 
    次重申了堅持“一個joke”政策。single, girl, man等版斑竹也紛紛表示“派獨 
    分子是國際社會的麻煩制造者”。 
    Re

    本報訊: single版不存在灌水行為。 

    single版斑竹rainbai在接受本報記者專訪時稱:“single版從本質上說是屬于紫丁香的, 
    屬于所有站友的。single上水多就是對紫丁香,對站友利益的體現。我任為single版不存 
    在灌水行為”
    Re

    另訊:黑土地是最自由民主的版面 

    黑土地版斑竹spacefight近日對媒體表示,黑土地是最自由民主的版面。針對pielove版 
    不斷攻擊黑土地版“封人過多,刪貼嚴重,壓制言論自由”,spacefight稱:“鵲橋版 
    版主在民主問題上雙重標準,除暴干涉別版內政;近日又爆出采用黑名單制度虐囚丑聞” 
    。“人權問題首先是生存權問題”。spacefight稱“黑土地的民主狀況是最好的,其他 
    版面都不怎么樣。”
    Re: popstar: 關閉bbs是為了刷水箱 

    《狗城晚報》的評論說,似乎沒有(紫丁香)網民愿意相信官方公布的關站原因。“如果 
    網民對站方的權威產生懷疑,無疑將對事件的后續處理帶來極大的隱患。”  

    《西方早報》的評論說:“我們的關注更在于對一套基本的公共危機應急機制的關注。但 
    現在看來,除了我們一再強調的信息公開、網民理性之外,在站方的基本應急協調機制方 
    面,我們的準備也還很不充分。”  

    《北方日報》的評論說:“毫無疑問,突發事件考驗著站方管理公共事務的能力。經歷了 
    前年的非典(薩斯)之后,網民對‘謠言止于公開’可謂完全達成了共識。”  
    posted @ 2006-01-05 20:45 羅明 閱讀(634) | 評論 (0)編輯 收藏
     
    轉自:http://blog.csdn.net/3cts/archive/2005/12/30/566079.aspx

      引言
      
      大家都知道可以通過post或者get獲得form表單的數據,那么我們如何實現不刷新的提交直接獲得頁面上的數據呢?這就要借助xmlhttp協議了。xmlhttp是xmldom技術的一部分。
      
      下面的代碼就是一個很簡單的例子,我們利用xmlhttp技術實現簡單的用戶登陸。
      
      開始
      
      1.簡單的登錄頁面
      
      login.jsp
      function toServer(){
      var xml = "<root>"+
      "<name>"+document.all('name').value+"</name>"+
      "<pwd>"+document.all('pwd').value+"</pwd>"+
      "</root>";
      
      var XMLSender = new ActiveXObject("Microsoft.XMLHTTP" );
      XMLSender.Open("POST",'do_login.jsp',false);
      XMLSender.send((xml));
      alert(XMLSender.responseText); //可處理后臺返回的結果
      }
      
      姓名:<input type="text" id="name" /><br>
      密碼:<input type="text" id="pwd" /><br>
      <input type="button" value="登錄" onclick="toServer()">
      
      2.后臺的登錄處理頁面
      do_login.jsp
      
      <%
      //讀取XMLHTTP流
      java.io.BufferedReader br = request.getReader();
      String str = "";
      while (str != null) {
      str = br.readLine();
      process (str); //可通過任何語言實現解析XML,進行業務處理
      }
      
      //返回信息
      javax.servlet.ServletOutputStream sos = response.getOutputStream();
      sos.print("login success" );
      sos.close();
      %>
      與傳統的“提交-回發-重繪”式的web系統基本運行結構不同,我們可以通過通過XMLHTTP實現無刷新的客戶端直接與服務器交互,極大的提高用戶的感受度。
      
      查考資料
      
      XMLHTTP方法:
      
      Open bstrMethod, bstrUrl, varAsync, bstrUser, bstrPassword
      bstrMethod:數據傳送方式,即GET或POST。
      bstrUrl:服務網頁的URL。
      varAsync:是否同步執行。缺省為True,即同步執行,但只能在DOM中實施同步執行。
      應用中一般將其置為False,即異步執行。
      bstrUser:用戶名,可省略。
      bstrPassword:用戶口令,可省略。
      
      Send varBody
      varBody:指令集。可以是XML格式數據,也可以是字符串,流,或者一個無符號整數數組。也可以省略,讓指令通過Open方法的URL參數代入。
      
      setRequestHeader bstrHeader, bstrValue
      bstrHeader:HTTP 頭(header)
      bstrValue:HTTP 頭(header)的值
      如果Open方法定義為POST,可以定義表單方式上傳:
      xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
      
      XMLHTTP屬性:
      
      onreadystatechange:在同步執行方式下獲得返回結果的事件句柄。只能在DOM中調用。
      responseBody:結果返回為無符號整數數組。
      responseStream:結果返回為IStream流。
      responseText :結果返回為字符串。
      responseXML:結果返回為XML格式數據。
    posted @ 2006-01-03 18:59 羅明 閱讀(518) | 評論 (0)編輯 收藏
     

    • Content with Style: Fixing the Back Button and Enabling Bookmarking for AJAX Apps - Mike Stenhouse explains how to fix two of the more distracting problems with Ajax. These can be particularly problematic for users new to Ajax applications.  Since Ajax apps typically load into a single web page, it makes pressing the Back button meaningless or actually harmful.  And this breaks the browser usage model annoyingly.  Also, individual views of data in an Ajax application cannot have a URL or permalinks unless precautions are taken.  Mike does a great job covering how to reduce these problems.
    • Saving Session Across Page Loads Without Cookies, On The Client Side - Ajax virtuoso Brad Neuberg strikes again with a detailed explanation of how to deal with saving session information across page loads without relying on cookies.  This is important in larger applications which typically want to store more information than a cookie can hold.  Brad also has some terrific tools to deal with this as well (see AMASS below)
    • Call SOAP Web services with AJAX - By design, Ajax is a voracious consumer of web services like XML/HTTP, REST, and SOAP.  A great article at IBM's DeveloperWorks describes how to easily call SOAP web services from Ajax.  This is important because SOAP is a complex protocol that requires some familiarity to use.  While Ajax development tools like Atlas, General Interface, and Bindows will solve this by providing a SOAP stack, for many, hand development of back-end SOAP request is the only option right now to achieve interoperability with WS-I Basic Profile web services.
    • Ajax using only an image - Browsers and networks continue to get more secure and many configurations will not allow an Ajax application to use web services, and almost none of them will allow you to access a server other than the one the Ajax app loaded from.  Enter an elegant technique to solve this by using image URLs.  Not for the faint of heart, and certainly a possible security hole but a compelling solution nonetheless.

    Ajax Tools and Libraries


    Note: The most complete Ajax framework listing I've seen available is here.

    Ajax News and Resources

    Ajax Developer's Journal

    • The Ajax Developer's Journal - Good sources of news for Ajax are still pretty scarce but that's starting to change in a big way.  SYS-CON has recently launched their Ajax Developer's Journal and has been working closely with Jesse James Garrett, who coined the term.  Expect lots of interesting and topical new articles and coverage on a regular basis.
    • Ajaxian - Dion Almaer and Ben Galbraith have been working on Ajaxian for a while now and it remains one of the very best sources for the latest Ajax news, tools, events, and general inspiration.

    Critiques and Analysis of Ajax


    • Ajax Mistakes - This is Alex Bosworth's terrific analysis of the early problems with Ajax.  He a big believer in the technology and his Ajax-powered LiveMarks site is one of my absolute favorites.  A good place to start to understand some of the challenges with Ajax.
    • Fixing Ajax: XmlHttpRequest Considered Harmful - Some good coverage of why Ajax doesn't really enable the use of the services of other web sites without a lot of work.  This is a big barrier to leveraging Web 2.0's global services landscape.  This can be solved a number of ways however and the options are explored here.  The image URL solution a few paragraphs above is missing but otherwise this is an excellent summary.

      Ajax Network Constraints


    • 10 Places You Must Use Ajax - Alex is back and carefully enumerates the good places to use Ajax.  He also covers when to avoid it.  Excellent material for those learning how to design with Ajax.
    • Top 10 Reasons Ajax Is Here To Stay - Andre Charland nails it.  Though some folks dislike Ajax for a variety of reasons, here are some terrific positive motivations for using it today.

    And don't forget to see what can be done with Ajax!  Check out these great new Ajax-enabled applications here.

    posted Friday, 30 December 2005

    posted @ 2006-01-03 11:42 羅明 閱讀(546) | 評論 (0)編輯 收藏
     
    這幾天一直在寫代碼,struts架構 + jsp + javascript,都抽不出時間寫Blog了。可能生活過得充實就很少會寫Blog吧。能做自己喜歡的事,還能填滿腰包,這估計就是最幸福的工作吧!要繼續調試我的javascript了,學習ing
    posted @ 2005-12-28 22:09 羅明 閱讀(127) | 評論 (0)編輯 收藏
     
    這幾天一直在寫代碼,struts架構 + jsp + javascript,都抽不出時間寫Blog了。可能生活過得充實就很少會寫Blog吧。能做自己喜歡的事,還能填滿腰包,這估計就是最幸福的工作吧!要繼續調試我的javascript了,學習ing
    posted @ 2005-12-28 14:10 羅明 閱讀(180) | 評論 (0)編輯 收藏
     
    第一個是XmallCharter, 何為Charter? 就是畫圖表的啦。Xmall嗎?是我畢業后要開的公司的名字啊(這家伙又在yy了^_^)。

    XmallCharter是一個基于JFreeChart庫的圖表軟件,仿照PowerPoint里的圖表功能,支持餅狀圖、域圖、線狀圖、條形圖、3D條形圖等圖表類型,100% Java Swing 代碼,綠色軟件,解壓縮即可在Linux、W$等系統上運行。

    項目現在“寄居”在SourceForge.net上,最新版本是0.2。

    去年學校的創新競賽(也是挑戰杯的校內選拔賽),每個俱樂部都要交作品,我順便把XmallCharter和文檔交了上去,還好,得了個三等獎,當時還比較興奮(這個項目本來是《界面設計》課程的大作業,那時候剛剛完成,才花了一個星期,意外之喜)

    項目網址:www.sourceforge.net/projects/xmallcharter

    xmall.jpg


    第二個是XBlogger,一個基于Eclipse RCP的Blog客戶端,是今年IBM校園科技創新競賽的參賽作品,但是由于某些原因,最終沒能提交(55~,早點回學校就好了)。本地數據庫使用HSqlDB,目前只支持Blogger.com(.Text類型的也能支持,但還沒加上,懶了)。本來應該有個Web Service中間層,以后可行的話可能會加上,基本架構和截屏如下(現在還沒開源,完善一下先):

    基本架構:

    xmall_arch.gif

    (用OpenOffice打開的Word文檔,有點變形)

    截圖:

    Xblogger.JPG
    posted @ 2005-12-16 21:06 羅明 閱讀(4938) | 評論 (4)編輯 收藏
     

    構建J2ME游戲:用TiledLayer構造背景

    在這一節中,我們要使用TiledLayer類為游戲添加一個背景。游戲界面分為三個區域:頂部表示天空,couple小精靈所在的中部是地面,底部是大海。每個區域分別使用一個32*32像素的不同顏色圖片進行填充,填充的工作由TiledLayer類完成。

    首先將屏幕分成32*32的小方格,行和列的索引都從0開始,如圖4。

    j2me3_figure4.gif

    ?????????? 圖 4. 均勻分割屏幕

    (0,0)到(1,4)的方格表示天空,(2,0)到(2,4)表示地面,(3,0)到(4,4)表示海面。我們用圖5中的圖片填充對應方格。

    tiledlayer1.gif

    圖 5. 背景圖片

    背景圖片的第一部分(32*32)表示地面,第二部分表示大海,第三部分表示天空。使用TiledLayer時,圖片的索引是從1開始的(不是0,所以地面圖像的位置是1,大海是2,天空是3)。TiledLayer類可以將圖5分割成三張圖片,然后用每張圖片填充對應的方格。在這里,我們用三個 32*32大小圖片填充5行5列的背景,部分代碼如下:

    //?加載圖片
    backgroundImg?=?Image.createImage("/tiledLayer1.gif");

    //?創建TiledLayer背景
    background?=?new?TiledLayer(5,?5,?backgroundImg,?32,?32);


    TiledLayer構造器的前兩個參數表示背景大小,第三個是圖像,最后兩個是每個格子的長和寬。TiledLayer類將根據格子的大小切割圖像,然后放到背景的對應方格中。

    最后剩下的就是設置每個方格里放置的圖像了。創建背景的所有代碼都在createBackground()方法里,如下所示。在MyGameCanvas 類的start()里調用這個方法,然后在buildGameScreen()方法的最后添加background.paint(g),這使得 TiledLayer實例將自己繪制到屏幕上。

    //?使用TiledLayer創建背景
    private?void?createBackground()?throws?IOException
    {
    ????
    //?加載圖片
    ????backgroundImg?=?Image.createImage("/tiledLayer1.gif");

    ????
    //?創建tiledLayer背景
    ????background?=?new?TiledLayer(5,?5,?backgroundImg,?32,?32);

    ????
    //?布置圖像的數組
    ????int[]?cells?=?{
    ????????
    3,?3,?3,?3,?3,??//?天空
    ????????3,?3,?3,?3,?3,??//?天空
    ????????1,?1,?1,?1,?1,??//?地面
    ????????2,?2,?2,?2,?2,??//?大海
    ????????2,?2,?2,?2,?2???//?大海
    ????};

    ????
    //?設置背景
    ????for(int?i?=?0;?i?<?cells.length;?i++)
    ????{
    ????????
    int?column?=?i?%?5;
    ????????
    int?row?=?(i?-?column)?/?5;
    ????????background.setCell(column,?row,?cells[i]);
    ????}

    ????
    //?設置背景位置
    ????background.setPosition(GAME_ORIGIN_X,?GAME_ORIGIN_Y);
    }


    最終效果如圖6。

    j2me3_figure6.gif

    ??? 圖 6. 添加了背景的游戲截屏

    原文見:http://today.java.net/pub/a/today/2005/07/07/j2me3.html?page=4
    posted @ 2005-12-16 19:58 羅明 閱讀(1179) | 評論 (0)編輯 收藏
     
    ...
    在奔波中我慕然回首 看看過去的年頭
    曾經努力得到的所有 轉眼之間不停留
    但你卻永遠在我的背後 承受壓力與憂愁
    縱然是汗在流 嚐盡苦頭 還是陪我往前走

    脆弱是令人容易跌倒 泛起失望的念頭
    有誰甘心向現實低頭 還是無奈的接受
    人總會有想哭的時候 你總會用你的雙手
    悄悄的撫平了我的傷口 不會讓別人知道

    你是我的溫柔 給我所有 代替了一切哀愁
    不管天有多長 地有多久 無悔的為我守候

    你是我的港口 讓我停留 停留在你的溫柔
    縱使天也會荒 地也會老 愛是沒有盡頭
    posted @ 2005-12-14 18:13 羅明 閱讀(87) | 評論 (0)編輯 收藏
     
    http://www.frappr.com/linux

    if you are using Linux, pls add yourself to this list on above site.

    Screenshot-4.gif
    posted @ 2005-12-14 11:07 羅明 閱讀(460) | 評論 (0)編輯 收藏
     
    沒想到這么容易,打開TSC, 默認選擇RDP方式(另外兩種RDPv5、VNC還沒試過呢,待會試試,看效果怎樣),填一些基本信息(我就填了ip地址、工作組名和計算機名),選擇“Connect”連接,就彈出了熟悉的Windows登錄框,下面是一個截屏:

    Screenshot-3.gif
    posted @ 2005-12-13 10:22 羅明 閱讀(3320) | 評論 (7)編輯 收藏
    僅列出標題
    共14頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 Last 
     
    主站蜘蛛池模板: 亚洲综合校园春色| 亚洲精品自产拍在线观看| 亚洲日本一区二区| AAA日本高清在线播放免费观看| 全亚洲最新黄色特级网站| 亚洲日本久久一区二区va| 免费看黄视频网站| 亚洲人成人77777在线播放| 37pao成人国产永久免费视频| 亚洲国产国产综合一区首页| a级黄色毛片免费播放视频| 亚洲精品国产美女久久久| 不卡视频免费在线观看| 久久99国产亚洲高清观看首页| 4hu四虎免费影院www| 亚洲综合国产一区二区三区| 久久久免费观成人影院| 亚洲成AV人片在线播放无码| 久久久99精品免费观看| 亚洲激情在线视频| 黄页网站免费观看| 久久亚洲精品无码网站| 亚洲国产精品成人久久蜜臀| 国产精品福利在线观看免费不卡| 国产亚洲精久久久久久无码AV| 精品成人免费自拍视频| 久久亚洲AV无码精品色午夜麻| 18观看免费永久视频| 亚洲中文精品久久久久久不卡| 国产猛烈高潮尖叫视频免费| 一区二区三区免费在线视频| 亚洲国产成人一区二区精品区| 亚洲免费中文字幕| 亚洲中文字幕乱码熟女在线| 亚洲?V无码成人精品区日韩 | 色播在线永久免费视频网站| 亚洲电影一区二区三区| 久久这里只有精品国产免费10| 免费人成又黄又爽的视频在线电影| 日本亚洲欧洲免费天堂午夜看片女人员 | 67pao强力打造67194在线午夜亚洲|