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

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

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

    隨筆-124  評論-194  文章-0  trackbacks-0
     

     

    完整文章在這里

     

    文章寫得比較易懂清晰,最后傾向于用HTTP Invoker,是輕量級的易于安裝而靈活的方案,但它只在通信兩邊都是SPRING時適用。

     

    要點如下:

    每一種遠程技術都有其優點與不足,表格1對它們進行了簡單的對比。

    按框架 優點 缺點分述如下:

    RMI

    全面支持Java對象串行化。因此,你能夠通過網絡發送復雜數據類型。

    RMI僅是一種Java到Java型遠程方案。如果你擁有任何非Java客戶端的話,那么你無法使用它。另外,你還無法通過HTTP協議存取對象,除非你有專門的“通道”實現RMI通訊。注意,它需要一個RMI編譯器(為了生成代理和框架)和一個外部注冊表(用于查詢服務)。

    Hessian/Burlap

    跨防火墻工作良好

    它們使用一種專利對象串行化機制。其中,Burlap僅支持Java客戶端。它們能夠串行化Hibernate對象,但是對集合對象執行“惰式”加載。

    HTTP Invoker

    基于HTTP的Java到Java Remoting;通過HTTP實現Java串行化;容易建立。

    服務器和客戶端應用程序都需要使用Spring。

    僅是一種Java方案。

    EJB

    支持Remoting J2EE服務,應用程序安全以及事務處理

    EJB是一種重量級技術。它要求使用一個J2EE容器。

    Web服務

    平臺和語言獨立

    要付出SOAP操作所帶來的開銷,并且要求使用一個Web服務引擎。

    表格1:各種Spring Remoting技術優缺點比較

    如你所見,每一種Spring Remoting技術都有各自的優缺點,但是大多數實際的應用程序都會要求使用一種輕量級Remoting技術。當實現遠程服務時,使用例如EJB這樣的重量級遠程組件模型需要其它額外的開銷。通常情況下,使用一種支持對象串行化能力的HTTP服務就足夠了。

    posted @ 2007-06-08 18:53 我愛佳娃 閱讀(848) | 評論 (0)編輯 收藏

    被強制更新了ie7,英文字體非常不心慣,可以通過以下方法恢復:

     

    關閉cleartype的效果:
    工具-internat選項-高級-多媒體-總是將cleartype應用于html,把鉤去掉。

    posted @ 2007-06-05 17:27 我愛佳娃 閱讀(579) | 評論 (0)編輯 收藏

    最近通過搜索發現建立TreeV3時候,方便的加載圖標方法:在這里

     

    但是有個問題,想在程序里動態修改它卻沒有函數,經過研究代碼發現可以用如下簡單方法實現:

    取得之前定義的TreeDocIconExtension的引用:

    var treeicons = dojo.widget.manager.getWidgetById("phyTreedocIcons");

     

    改變TreeNodeV3的TYPE值為CSS文件定義過的項目:

    node.nodeDocType = 3;

     

    最關鍵是要去刷新iconNode的innerHTML,調用如下:

    treeicons.setnodeDocTypeClass (node);

     

    已經實驗通過。這樣就可以方便的根據后臺數據刷新節點狀態,而不必重建樹節點。

    posted @ 2007-06-02 12:06 我愛佳娃 閱讀(1308) | 評論 (0)編輯 收藏

    轉錄自:這里

    并實驗通過。

     

    TreeV3支持節點圖標, 因為和老版本的使用方式大相徑庭, 而且沒有文檔, 所以給升級到V3的developer造成一定的困擾. 我利用google, 并分析了源代碼后找到了方法.
    在TreeV3中加入圖標的方法如下:

    首先定義一個widget:
    <div dojoType="TreeDocIconExtension" widgetId="docIcons"></div>

    并給tree加入一個名為"docIcons"的listener:
    <div dojoType="TreeV3" listeners="link;selector;docIcons;treeController;menu">

    在定義節點時需要加入一個屬性"nodeDocType", 如:
    <div dojoType="TreeNodeV3" title="nodetitle" nodeDocType="nodetype1" ></div>

    最后給每一個nodedoctype定義一個名為".TreeIconXXXX"的style, 這里的XXXX就是給節點定義的nodeDoctype的名字:
    <style>
    .TreeIconnodetype1{
    background-image: url('icon.gif');
    }
    </style>

    posted @ 2007-06-01 17:37 我愛佳娃 閱讀(1723) | 評論 (1)編輯 收藏

    $self->{net_server}就是Multiplex,為了能夠實現多態調用(在父類中調用實現子類的方法,PERL中使用SUPER實現),又定義了:

    Net::Server::Multiplex::MUX

    每有一個新連接,會NEW一個這樣的對象進行管理。

     

    而封裝的IO::Multiplex對象是存在:$self->{net_server}->{mux}中。

    posted @ 2007-05-29 11:11 我愛佳娃 閱讀(339) | 評論 (0)編輯 收藏

    Jetty啟動后,如果修改javascript文件,將不能保存,使調試很麻煩。這是因為使用了CACHE,JETTY說是WINDOWS下的一個限制。可以通過如下方法修正:

     

    解壓出jetty.jar中的org/mortbay/jetty/webapp/webdefault.xml文件,將這一選項由true改為false,另存到src/main/resources目錄,或者其它自選目錄。

    <init-param> <param-name>useFileMappedBuffer</param-name> <param-value>true</param-value> <!-- change to false --> </init-param>

     

    在pom.xml中加入對這個文件的指向:

    <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <configuration>
    <webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
    </configuration>
    </plugin>

     

    本人已經驗證通過。

     

    問題描述,點這里

    posted @ 2007-05-27 16:50 我愛佳娃 閱讀(5625) | 評論 (0)編輯 收藏
    隨著AJAX的普遍應用,客戶端的開發也要走向面向對象,面向模式的開發范疇。
    看到一篇文章(附文鏈接見后),著重歸納一種開發模式:

    一頁就是一個“應用程序”,一個系統可能有好幾個這樣的應用程序;
    用JSF或者STRUTS形成各“應用程序”的第一頁;
    其中,每一頁含有:
    controller.js負責:(這是CONTROLLER)
          接來自頁面的調用,通過AJAX封裝包(如JSON-RPC或者DWR)調用系統服務;
          因為要異步響應,需要安排CALLBACK;
          在CALLBACK中,調用VIEW及MODEL的維護

    datacopy.js負責:(這是MODEL)
          保存數據模型,并由CONTROLLER來更新

    render.js負責:(這是VIEW)
          聽從CONTROLLER調用,通過取MODEL的數據,建立widgets,刷新頁面

    原文來自,這里
          
    另外,有關JS的面向對象編程<<javascript權威指南>>一書講的相當不錯,我簡單的與C++比較了一下,請點這里。
    posted @ 2007-05-26 10:56 我愛佳娃 閱讀(1368) | 評論 (0)編輯 收藏

    多行注釋:
    perl沒有多行注釋,可以用下面代替:
    =pod
    代碼行;
    .
    .
    .
    代碼行;
    =cut


    關于ref函數:
     ref EXPR
     ref     Returns a non-empty string if EXPR is a reference, the empty
             string otherwise. If EXPR is not specified, $_ will be used. The
             value returned depends on the type of thing the reference is a
             reference to. Builtin types include:

                 SCALAR
                 ARRAY
                 HASH
                 CODE
                 REF
                 GLOB
                 LVALUE

             If the referenced object has been blessed into a package, then
             that package name is returned instead. You can think of "ref" as
             a "typeof" operator.



    講類的段落,比較明了:
    Object Construction
    All objects are references, but not all references are objects. A reference won't work as an object unless its referent is specially marked to tell Perl what package it belongs to. The act of marking a referent with a package name--and therefore, its class, since a class is just a package--is known as blessing. You can think of the blessing as turning a reference into an object, although it's more accurate to say that it turns the reference into an object reference.

    The bless function takes either one or two arguments. The first argument is a reference and the second is the package to bless the referent into. If the second argument is omitted, the current package is used.

    $obj = { };                 # Get reference to anonymous hash.
    bless($obj);                # Bless hash into current package.
    bless($obj, "Critter");     # Bless hash into class Critter.
    Here we've used a reference to an anonymous hash, which is what people usually use as the data structure for their objects. Hashes are extremely flexible, after all. But allow us to emphasize that you can bless a reference to anything you can make a reference to in Perl, including scalars, arrays, subroutines, and typeglobs. You can even bless a reference to a package's symbol table hash if you can think of a good reason to. (Or even if you can't.) Object orientation in Perl is completely orthogonal to data structure.

    Once the referent has been blessed, calling the built-in ref function on its reference returns the name of the blessed class instead of the built-in type, such as HASH. If you want the built-in type, use the reftype function from the attributes module. See use attributes in Chapter 31, "Pragmatic Modules".

    And that's how to make an object. Just take a reference to something, give it a class by blessing it into a package, and you're done. That's all there is to it if you're designing a minimal class. If you're using a class, there's even less to it, because the author of a class will have hidden the bless inside a method called a constructor, which creates and returns instances of the class. Because bless returns its first argument, a typical constructor can be as simple as this:

    package Critter;
    sub spawn { bless {}; }
    Or, spelled out slightly more explicitly:
    package Critter;
    sub spawn {
        my     $self = {};       # Reference to an empty anonymous hash
        bless  $self, "Critter"; # Make that hash a Critter object
        return $self;            # Return the freshly generated Critter
    }
    With that definition in hand, here's how one might create a Critter object:
    $pet = Critter->spawn;

    12.4.1. Inheritable Constructors
    Like all methods, a constructor is just a subroutine, but we don't call it as a subroutine. We always invoke it as a method--a class method, in this particular case, because the invocant is a package name. Method invocations differ from regular subroutine calls in two ways. First, they get the extra argument we discussed earlier. Second, they obey inheritance, allowing one class to use another's methods.

    We'll describe the underlying mechanics of inheritance more rigorously in the next section, but for now, some simple examples of its effects should help you design your constructors. For instance, suppose we have a Spider class that inherits methods from the Critter class. In particular, suppose the Spider class doesn't have its own spawn method. The following correspondences apply:

    Method Call Resulting Subroutine Call
    Critter->spawn() Critter::spawn("Critter")
    Spider->spawn() Critter::spawn("Spider")

    The subroutine called is the same in both cases, but the argument differs. Note that our spawn constructor above completely ignored its argument, which means our Spider object was incorrectly blessed into class Critter. A better constructor would provide the package name (passed in as the first argument) to bless:

    sub spawn {
        my $class =  shift;       # Store the package name
        my $self  =  { };
        bless($self, $class);     # Bless the reference into that package
        return $self;
    }
    Now you could use the same subroutine for both these cases:
    $vermin = Critter->spawn;
    $shelob = Spider->spawn;
    And each object would be of the proper class. This even works indirectly, as in:
    $type  = "Spider";
    $shelob = $type->spawn;         # same as "Spider"->spawn
    That's still a class method, not an instance method, because its invocant holds a string and not a reference.

    If $type were an object instead of a class name, the previous constructor definition wouldn't have worked, because bless needs a class name. But for many classes, it makes sense to use an existing object as the template from which to create another. In these cases, you can design your constructors so that they work with either objects or class names:

    sub spawn {
        my $invocant = shift;
        my $class    = ref($invocant) || $invocant;  # Object or class name
        my $self     = { };
        bless($self, $class);
        return $self;
    }

    12.4.2. Initializers
    Most objects maintain internal information that is indirectly manipulated by the object's methods. All our constructors so far have created empty hashes, but there's no reason to leave them empty. For instance, we could have the constructor accept extra arguments to store into the hash as key/value pairs. The OO literature often refers to such data as properties, attributes, accessors, member data, instance data, or instance variables. The section "Instance Variables" later in this chapter discusses attributes in more detail.

    Imagine a Horse class with instance attributes like "name" and "color":

    $steed = Horse->new(name => "Shadowfax", color => "white");
    If the object is implemented as a hash reference, the key/value pairs can be interpolated directly into the hash once the invocant is removed from the argument list:
    sub new {
        my $invocant = shift;
        my $class = ref($invocant) || $invocant;
        my $self = { @_ };          # Remaining args become attributes
        bless($self, $class);       # Bestow objecthood
        return $self;
    }
    This time we used a method named new for the class's constructor, which just might lull C++ programmers into thinking they know what's going on. But Perl doesn't consider "new" to be anything special; you may name your constructors whatever you like. Any method that happens to create and return an object is a de facto constructor. In general, we recommend that you name your constructors whatever makes sense in the context of the problem you're solving. For example, constructors in the Tk module are named after the widgets they create. In the DBI module, a constructor named connect returns a database handle object, and another constructor named prepare is invoked as an instance method and returns a statement handle object. But if there is no suitable context-specific constructor name, new is perhaps not a terrible choice. Then again, maybe it's not such a bad thing to pick a random name to force people to read the interface contract (meaning the class documentation) before they use its constructors.

    Elaborating further, you can set up your constructor with default key/value pairs, which the user could later override by supplying them as arguments:

    sub new {
        my $invocant = shift;
        my $class   = ref($invocant) || $invocant;
        my $self = {
            color  => "bay",
            legs   => 4,
            owner  => undef,
            @_,                 # Override previous attributes
        };
        return bless $self, $class;
    }

    $ed       = Horse->new;                    # A 4-legged bay horse
    $stallion = Horse->new(color => "black");  # A 4-legged black horse
    This Horse constructor ignores its invocant's existing attributes when used as an instance method. You could create a second constructor designed to be called as an instance method, and if designed properly, you could use the values from the invoking object as defaults for the new one:
    $steed  = Horse->new(color => "dun");
    $foal   = $steed->clone(owner => "EquuGen Guild, Ltd.");

    sub clone {
        my $model = shift;
        my $self  = $model->new(%$model, @_);
        return $self;     # Previously blessed by ->new
    }

    posted @ 2007-05-24 15:31 我愛佳娃 閱讀(8325) | 評論 (2)編輯 收藏

    Maven2代比1代改進很多,其中主要強調的是--它不僅僅是個依賴包管理器!
    開始先要推薦一個專講Maven2的電子書給大家,對MAVEN學習相當有助益:Better Builds with Maven  


    下面就專門介紹下Maven2對WEBAPP在管理和調試方面的支持。

    1.創建項目

    mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp

    也可參看這里

    創建要注意遵循MAVEN的目錄結構,尤其要注意源文件要放在main/java下:



    2. POM文件的配置

    這里要特別注意對resource一節的配置,因為我的SPRING以及WEB相關的XML是放在WEB-INF目錄,為了在unit test的時候也能用,加入了對這些配置文件的引用。相當于加了一個classpath。

    這里還有個插曲:不知為何MAVEN2里沒有JTA的包,自動下載時會有提示教你如何手工通過命令加入,非常簡單。

    JETTY的plugin是為后面用它來調試做準備。

    DWR也是目前WEB開發一個熱選。

    另外,為使用JAVA5代來編譯,加入了maven-compiler-plugin一節。

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation
    ="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      
    <modelVersion>4.0.0</modelVersion>
      
    <groupId>com.exchangebit.nms</groupId>
      
    <artifactId>ebnms</artifactId>
      
    <packaging>war</packaging>
      
    <version>1.0-SNAPSHOT</version>
      
    <name>ebnms Maven Webapp</name>
      
    <url>http://maven.apache.org</url>
          
      
    <build>
        
    <finalName>ebnms</finalName>
        
          
    <resources>
            
    <resource>
              
    <directory>src/main/java</directory>
              
    <includes>
                
    <include>**/*.xml</include>
              
    </includes>
            
    </resource>
            
    <resource>
              
    <directory>src/main/webapp/WEB-INF</directory>
              
    <includes>
                
    <include>**/*.xml</include>
                
    <include>**/log4j.properties</include>
              
    </includes>
            
    </resource>
          
    </resources>
          
          
    <plugins>
            
    <plugin>
              
    <groupId>org.apache.maven.plugins</groupId>
              
    <artifactId>maven-compiler-plugin</artifactId>
              
    <configuration>
                
    <source>1.5</source>
                
    <target>1.5</target>
              
    </configuration>
            
    </plugin>
            
          
    <plugin>
            
    <groupId>org.mortbay.jetty</groupId>
            
    <artifactId>maven-jetty-plugin</artifactId>
          
    </plugin>        
      
          
    </plugins>
        
    </build>    
          
      
    <dependencies>
        
    <dependency>
          
    <groupId>junit</groupId>
          
    <artifactId>junit</artifactId>
          
    <version>3.8.1</version>
          
    <scope>test</scope>
        
    </dependency>
            
        
    <dependency>
          
    <groupId>org.hibernate</groupId>
          
    <artifactId>hibernate</artifactId>
          
    <version>3.1</version>
        
    </dependency>
        
        
    <dependency>
          
    <groupId>log4j</groupId>
          
    <artifactId>log4j</artifactId>
          
    <version>1.2.11</version>
        
    </dependency>
        
    <dependency>
          
    <groupId>mysql</groupId>
          
    <artifactId>mysql-connector-java</artifactId>
          
    <version>3.1.11</version>
          
    <scope>runtime</scope>
        
    </dependency>
        
    <dependency>
          
    <groupId>javax.servlet</groupId>
          
    <artifactId>servlet-api</artifactId>
          
    <version>2.4</version>
          
    <scope>provided</scope>
        
    </dependency>
        
    <dependency>
          
    <groupId>javax.servlet</groupId>
          
    <artifactId>jstl</artifactId>
          
    <version>1.1.2</version>
          
    <scope>runtime</scope>
        
    </dependency>
        
    <dependency>
          
    <groupId>taglibs</groupId>
          
    <artifactId>standard</artifactId>
          
    <version>1.1.2</version>
          
    <scope>runtime</scope>
        
    </dependency>
        
    <dependency>
          
    <groupId>org.springframework</groupId>
          
    <artifactId>spring</artifactId>
          
    <version>1.2.6</version>
        
    </dependency>
            
        
    <dependency>
          
    <groupId>dwr</groupId>
          
    <artifactId>dwr</artifactId>
          
    <version>1.1.3</version>
        
    </dependency>        
      
    </dependencies>
      
    </project>


    代碼放入/main/java后,可以在項目目錄下執行:
    mvn compile來做編譯嘗試,
    也可以用mvn war直接生成打包文件,
    當然最后可以用 mvn jetty:run來運行你的WEBAPP!


    3.  在Eclipse中配置jetty進行調試
    要把之前的項目導入Eclipse首先讓maven為我們生成Eclipse工程文件,執行:
    mvn eclipse:eclipse
    再把M2_REPO加入到Eclipse的classpath中,有兩種方法,其中的b)方法是有效的:
    a) mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
    b) Window > Preferences. Select the Java > Build Path > Classpath Variables page


    之后,就可以通過Eclipse的File->Import功能將工程導入。


    有人為了使用WEBAPP開發功能,而裝象MYECLIPSE這樣的巨物。有了JETTY,通過輕松配置就可以實現比TOMCAT更快更便捷的容器,所以在調試時強力推薦這個東東。下面就來看下如何配置。

    先下配置一個外部工具,來運行JETTY:
    選擇菜單Run->External Tools->External Tools ...在左邊選擇Program,再點New:
    配置Location為mvn完整命令行。

    選擇Working Directory為本項目。

    Arguments填寫:jetty:run

    再點選Enviroment頁:加入MAVEN_OPTS變量,值為:
    -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y
    其中,如果suspend=n 表示不調試,直接運行。

    然后,點APPLY,再關閉本對話框。
    另外注意一點,好像external tool菜單項在java browering的perspective下才會出現。如果在java下看不見,可以切換下試試。



    下面新建運行配置:
    點選run->debug...
    選中左樹中的Remote Java Application,再點New。
    選擇你的項目,關鍵是要填和之前設置外部工具時相同的端口號。





    配置就完成了,正面開始調試運行:
    首先要把JETTY運行起來(有點象TOMCAT里的運行APPSERVER),從Run->External Tools中選擇之前配置的外部工具運行,這時LOG里會顯示:
    listening at port 4000字樣,
    再選擇Run->Debug選擇我們剛建的運行配置,這時程序就RUN起來了,可以通過WEB進行訪問,設置斷點調試了。



    后記:
    在ECLIPSE中,有更方便高效的調試方式,點這里
    posted @ 2007-05-19 23:08 我愛佳娃 閱讀(25819) | 評論 (4)編輯 收藏

    STEP 3:配置
    打開/conf/目錄,打開svnserve.conf找到一下兩句:


    # [general]
    # password-db = passwd

    去之每行開頭的#,其中第二行是指定身份驗證的文件名,即passwd文件
    同樣打開passwd文件,將

    # [users]
    # harry = harryssecret
    # sally = sallyssecret

    這幾行的開頭#字符去掉,這是設置用戶,一行一個,存儲格式為“用戶名 = 密碼”,如可插入一行:admin = admin888,即為系統添加一個用戶名為admin,密碼為admin888的用戶

     

    create it:
    sc create svnservice binpath= "\"c:\program files\Subversion\bin\svnserve.exe\" --service -r D:\svn" displayname= "SVNService" depend= Tcpip

    delete it:
    sc delete svnservice



    mysql:
     C:\> mysqld-nt --install
       C:\> NET START MySql

      C:\> NET STOP MySql
       C:\> mysqld-nt --remove


    posted @ 2007-05-16 22:38 我愛佳娃 閱讀(618) | 評論 (0)編輯 收藏
    僅列出標題
    共13頁: First 上一頁 5 6 7 8 9 10 11 12 13 下一頁 
    主站蜘蛛池模板: 久久久久亚洲av毛片大| 女人18一级毛片免费观看| 色噜噜亚洲精品中文字幕| 又硬又粗又长又爽免费看 | 亚洲综合av永久无码精品一区二区| 国产亚洲精品第一综合| 国产福利免费在线观看| 男女啪啪免费体验区| 亚洲精品一级无码中文字幕| 国产精品1024在线永久免费| 亚洲亚洲人成综合网络| 鲁大师在线影院免费观看| 亚洲欧洲精品国产区| 四虎www成人影院免费观看| 亚洲av永久无码一区二区三区| 国产成人啪精品视频免费网| 在线播放免费人成视频网站| 亚洲精品成人无限看| 2022久久国产精品免费热麻豆| 亚洲女人影院想要爱| 在线免费观看国产视频| 污污污视频在线免费观看| 亚洲精品成人无限看| 亚洲免费在线视频观看| 亚洲sm另类一区二区三区| 亚洲欧洲自拍拍偷精品 美利坚| 国产无遮挡裸体免费视频在线观看| 亚洲一区二区中文| 国产美女无遮挡免费视频网站 | 日韩免费电影网址| 亚洲一区中文字幕在线观看| 国产福利免费在线观看| 久久久精品午夜免费不卡| 亚洲不卡中文字幕| 久久久久亚洲?V成人无码| 18未年禁止免费观看| 国产亚洲漂亮白嫩美女在线| 亚洲精品免费视频| 国产三级免费电影| 最近中文字幕mv免费高清在线 | 99无码人妻一区二区三区免费|