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

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

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

    隨筆 - 17, 文章 - 1, 評論 - 0, 引用 - 0
    數據加載中……

    2015年6月7日

    Keystore 相關的一些概念

    把一些常見的 Key 相關的內容列在這,便于之后理解。

    1. JKS (Java KeyStore) 和 PFX (pkcs12) 都是常見的密鑰庫的格式,用于保存完整的證書密鑰對,證書鏈和信任證書信息,前者是 Sun 制定的,適用于 Java 世界,比如 Tomcat,Geronimo,Websphere 等,后者"據說"常用于 IIS (沒配置過) 等。JKS 相關的工具是 JDK 帶的 keytool,PFX 可以使用 openssl。

    2. JKS 中有存放的內容常見有兩類,一個是 PrivateKeyEntry, 包含了完整的證書密鑰對,證書鏈等信息,另外一個是 trustedCertEntry, 包含受信公鑰信息。可以使用 keytool -list -keystore 顯示。

    3. 一般使用工具生成 RSA 非對稱密鑰對之后,還會由第三方機構 (CA) 生成簽名,用于標識密鑰所有者的身份,所以通常我們會說,我們將證書下發給客戶端,此時的證書包括如下信息,公鑰,簽名信息等。

    4. 使用 JKS 存儲信息時,由于 Keystore 中可以存放多個密鑰信息,所以通過會使用 alias 標識,需要使用時,需要指定別名。另外,Keystore 本身可以使用 storepassword 保護,而針對每一個 key,也可以是使用 keypassword 保護。

    5. keytool 支持導入公鑰和其他 keystore,暫不支持導入 PrivateKeyEntry,此時若手中有私鑰和證書兩個信息,只能先倒入到 PFX 中,再導入到 JKS 中。

    openssl pkcs12 -export -in [my_certificate.crt] -inkey [my_key.key]
    -out [keystore.p12] -name [new_alias] -CAfile [my_ca_bundle.crt] -caname
     root

    keytool -importkeystore -deststorepass [new_keystore_pass]
    -destkeypass [new_key_pass] -destkeystore [keystore.jks] -srckeystore
    [keystore.p12] -srcstoretype PKCS12 -srcstorepass
    [pass_used_in_p12_keystore] -alias [alias_used_in_p12_keystore]

    6. JAR 簽名,主要是在 META-INF 目錄下,除了 MANIFEST.MF 之外,還有 *.SF 和 *.RSA 文件 (后綴隨簽名使用的算法會略有不同), MF 保存了 JAR 中每個文件的散列信息,一般使用 MD5 或者 SHA-1
    Name: AndroidManifest.xml
    SHA-256-Digest: vn9XTNvoXBMgbaxUqDoc4WUsWseMfRCQQRSR87+F/Hc=

    SF 文件使用 RSAwithSHA1, 針對 MF 中的每條信息再次生成簽名信息,另外針對整個 MF 也會生成簽名信息。
    Name: AndroidManifest.xml
    SHA-256-Digest: Pa/g6cA3KpnfBvCD/mgnyczjfLCSkAv2l9A+EVxaJlg=

    RSA 中是前述簽名所用證書等相關信息

    通常我們在讀取 Jar 文件的每個 Entry 時,如果 META-INF 目錄下有如上文件,會做簽名驗證,因為散列信息計算需要讀取文件內容,所用在調用 getCertifcate 方法時,需要讀一下流里面的內容,如果只是驗證的目的,讀取直接忽略即可,考慮讀取性能,可以指定 byte[] buffer 的大小,使用流的 skip 方法時,內部 ZipInputStream 中使用的是
    private byte[] tmpbuf = new byte[512];

    7. 一般而言,證書有兩種常見用途,一是用于傳輸加密,主要是 SSL,另外一個對文件進行簽名,比如 JarFile 相關,而 CA 頒發證書時,會在證書中指定其用途,從目前看,以上兩種不會同時生效,即若此證書聲明為用于 SSL,則無法用于對 JarFile 進行簽名,實際使用會發現 JarSign 時未顯示錯誤,但通過 JarEntry 獲取證書時一直為空。

    posted @ 2015-06-07 14:16 一直在努力 ! 閱讀(682) | 評論 (0)編輯 收藏

    2014年4月8日

    OAuth 2.0 Notes

    最近研究 CloudFoudry 需要了解 UAA 相關東西, 并學習了 OAuth 的相關知識. 在網上找到兩篇文章寫得比較好

    [1] http://blog.gopivotal.com/cloud-foundry-pivotal/products/open-standards-in-cloud-foundry-identity-services
    [2] http://tutorials.jenkov.com/oauth2/index.html

    Summary
    Authorization Code 方式是最完整的, Client Application 會被重定向到 OAuth Server 登錄并同意授權, 之后再返回業務系統, 業務系統通過 Authorization Code 在 OAuth Server 處獲取訪問最終 Resource Server 的 Access Token
    Implicit 與 Authorization Code 大體類似, 只是少了用 Auhtorization Code 獲取 AccessToken 的步驟
    Resource Owner 方式是客戶程序知道用戶名和密碼, 認證時連同自身的 Client ID 和密碼一起發送到 OAuth Server, 比如 CF Java 客戶端就是使用這種方式
    Client Credentials 是 Client Application 本身就類似于 Resource Owner


    1. OAuth Client 首先需要在 OAuth Server 注冊, 需要提供一個 Redirect URL, 并從 OAuth Server 獲取 Client ID 和 Client 密碼
    2. 基本流程
        a. 用戶訪問客戶端應用程序
        b. 客戶端應用重定向到 OAuth Server
        c. 用戶輸入用戶名和密碼登錄, OAuth Server 執行完 Authentication 后, 會提示用戶是否允許訪問數據
        d. OAuth Server 使用注冊的重定向 URL, 用戶再次被定向到客戶端應用程序, 此時 URL 會包含 Authentication Code
        e. 客戶端應用程序接收到請求后, 使用 Authentication Code/Client ID/Client Password 訪問 OAuth Server 獲取 Access Token
        
    3. OAuth 中四個角色
        a. Resource Owner : One person or one application
        b. Resource Server
        c. Client Application
        d. Authorization Server
        * b 和 d 可以在一起, OAuth 規范未作詳細規定, 其之間如何交互也無規定
        
    4. OAuth Client 類型
        a. Confidential
        b. Public
        OAuth 客戶端需要持用 Client ID 和 Client Password, 兩種類型的區別在于, 第三方是否可以通過某種方式獲取該信息.

    5. Client Profile
        a. Web Application 指運行在 Web 服務器上的 Web 應用, 實際場景中, 還可能包含客戶端瀏覽器       
        b. User Agent 比如運行在瀏覽器中的 JavaScript 應用
        c. Native 比如桌面應用或者移動手機應用
        
    6. OAuth 2.0 Authorization
        a. 注冊到 OAuth 服務器, 一般執行一次, Client Application 會獲取分配的 Client ID 和 Client Password. 注冊過程中, Client Application 需要提供 Redirect URI
        This redirect URI is used when a resource owner grants authorization to the client application. When a resource owner has successfully authorized the client application via the authorization server, the resource owner is redirected back to the client application, to the redirect URI.
        b. 無論何時 Client Application 請求 Resource Server 上的資源時, Client Application 都需要到 OAuth Server 處使用 ID 和 密碼執行認證
        
    7. Authorization Grant 指 Resource Owner 授予 Client Application. OAuth 2.0 定義了如何類型 :
        a. Authorization Code
        b. Implicit
        c. Resource Owner Password Credentials
        d. Client Credentials
        
    8. Authorization Code
        a. 當 Client Application 重定向到 OAuth Server 時, Client ID 也會被傳遞過去, 這樣 Authorization Server 可以知道哪個應用 (Client Application) 試圖訪問受保護資源
        b. 當用戶成功登錄并授權訪問后, OAuth Server 會使用 Client Application 注冊時提供的 Redirect URI, 同時包含 Authentication Code.
        c. Client Application 使用 Authentication Code, Client ID 和 Client Password 直接訪問 Authorization Server, 并過去 Access Token. Access Token 代表 Client Application 通過認證和授權訪問保護資源. (The access token serves as both authentication of the client, and authorization to access the resources. )
        
    9. Implicit 與 Authentication Code 工作方式類似, 區別在于重定向時, Access Token 被包含在內.
        a. An implicit authorization grant is similar to an authorization code grant, except the access token is returned to the client application already after the user has finished the authorization. The access token is thus returned when the user agent is redirected to the redirect URI.
        b. This of course means that the access token is accessible in the user agent, or native application participating in the implicit authorization grant. The access token is not stored securely on a web server.
        c. Furthermore, the client application can only send its client ID to the authorization server. If the client were to send its client secret too, the client secret would have to be stored in the user agent or native application too. That would make it vulnerable to hacking.
        d. Implicit authorization grant is mostly used in a user agent or native client application. The user agent or native application would receive the access token from the authorization server.
        
    10. Resource Owner Password Credentials 等價于, 用戶 (Resource Owner) 把用戶名密碼告訴 Client Application, 然后 Client Application 直接使用用戶名和密碼訪問 Resource Server
         a. The resource owner password credentials authorization grant method works by giving the client application access to the resource owners credentials. For instance, a user could type his Twitter user name and password (credentials) into the client application. The client application could then use the user name and password to access resources in Twitter.
         b. Using the resource owner password credentials requires a lot of trust in the client application. You do not want to type your credentials into an application you suspect might abuse it.
         c. The resource owner password credentials would normally be used by user agent client applications, or native client applications.

    11. Client Credentials 使用 Client Application 需要調用 Resource Server 提供的一些功能, 但這些功能不和任何 Resource Owner 相關
          Client credential authorization is for the situations where the client application needs to access resources or call functions in the resource server, which are not related to a specific resource owner (e.g. user). For instance, obtaining a list of venues from Foursquare. This does not necessary have anything to do with a specific Foursquare user.
          
    12. OAuth 2.0 Endpoints
        a. Authorization Endpoint
            The authorization endpoint is the endpoint on the authorization server where the resource owner logs in, and grants authorization to the client application.
        b. Token Endpoint
            The token endpoint is the endpoint on the authorization server where the client application exchanges the authorization code, client ID and client secret, for an access token.
        c. Redirection Endpoint
             The redirect endpoint is the endpoint in the client application where the resource owner is redirected to, after having granted authorization at the authorization endpoint.
        
        a 和 b 位于 Authorization Server 上, c 位于客戶端應用程序上
        
    13. Authorization Code Grant Requests/Responses
        a. Authorization Request
            a1. response_type     Required. Must be set to code
            a2. client_id     Required. The client identifier as assigned by the authorization server, when the client was registered.
            a3. redirect_uri     Optional. The redirect URI registered by the client.
            a4. scope     Optional. The possible scope of the request.
            a5. state     Optional (recommended). Any client state that needs to be passed on to the client request URI.
        b. Authorization Response
             The authorization response contains the authorization code needed to obtain an access token. Here are the parameters included in the response:
             b1. code     Required. The authorization code.
             b2. state     Required, if present in request. The same value as sent by the client in the state parameter, if any.
        c. Authorization Error Response
              If an error occurs during authorization, two situations can occur.
              The first is, that the client is not authenticated or recognized. For instance, a wrong redirect URI was sent in the request. In that case the authorization server must not redirect the resource owner to the redirect URI. Instead it should inform the resource owner of the error.
              The second situation is that client is authenticated correctly, but that something else failed. In that case the following error response is sent to the client, included in the redirect URI:
              c1. error     Required. Must be one of a set of predefined error codes. See the specification for the codes and their meaning.
              c2. error_description     Optional. A human-readable UTF-8 encoded text describing the error. Intended for a developer, not an end user.
              c3. error_uri     Optional. A URI pointing to a human-readable web page with information about the error.
              c4. state     Required, if present in authorization request. The same value as sent in the state parameter in the request.         
        d. Token Request
             Once an authorization code is obtained, the client can use that code to obtain an access token. Here is the access token request parameters:
             d1. grant_type     Required. Must be set to authorization_code .
             d2. code     Required. The authorization code received by the authorization server.
             d3. redirect_uri     Required, if the request URI was included in the authorization request. Must be identical then.        
        e. Token Response
              The response to the access token request is a JSON string containing the access token plus some more information:

                { "access_token"  : "...",
                  "token_type"    : "...",
                  "expires_in"    : "...",
                  "refresh_token" : "...",
                }

            e1. The access_token property is the access token as assigned by the authorization server.
            e2. The token_type property is a type of token assigned by the authorization server.
            e3. The expires_in property is a number of seconds after which the access token expires, and is no longer valid. Expiration of access tokens is optional.
            e4. The refresh_token property contains a refresh token in case the access token can expire. The refresh token is used to obtain a new access token once the one returned in this response is no longer valid.  
            
    14. Implicit Grant Request
         a. The implicit grant request contains the following parameters:
            a1. response_type     Required. Must be set to token .
            a2. client_id     Required. The client identifier as assigned by the authorization server, when the client was registered.
            a3. redirect_uri     Optional. The redirect URI registered by the client.
            a4. scope     Optional. The possible scope of the request.
            a5. state     Optional (recommended). Any client state that needs to be passed on to the client request URI.

         b.Implicit Grant Response
            The implicit grant response contains the following parameters. Note, that the implicit grant response is not JSON.
            b1. access_token     Required. The access token assigned by the authorization server.
            b2. token_type     Required. The type of the token
            b3. expires_in     Recommended. A number of seconds after which the access token expires.
            b4. scope     Optional. The scope of the access token.
            b5. state     Required, if present in the autorization request. Must be same value as state parameter in request.

        c. Implicit Grant Error Response

            If an error occurs during authorization, two situations can occur.
            
            The first is, that the client is not authenticated or recognized. For instance, a wrong redirect URI was sent in the request. In that case the authorization server must not redirect the resource owner to the redirect URI. Instead it should inform the resource owner of the error.

            The second situation is that client is okay, but that something else happened. In that case the following error response is sent to the client, included in the redirect URI:
            c1. error     Required. Must be one of a set of predefined error codes. See the specification for the codes and their meaning.
            c2. error_description     Optional. A human-readable UTF-8 encoded text describing the error. Intended for a developer, not an end user.
            c3. error_uri     Optional. A URI pointing to a human-readable web page with information about the error.
            c4. state     Required, if present in authorization request. The same value as sent in the state parameter in the request.

    15. Credentials Grant - Requests and Response
        a. Resource Owner Password Credentials Grant Request
            The request contains the following parameters:
            a1. grant_type     Required. Must be set to password
            a2. username     Required. The username of the resource owner, UTF-8 encoded.
            a3. password     Required. The password of the resource owner, UTF-8 encoded.
            a4. scope     Optional. The scope of the authorization.

        b. Resource Owner Password Credentials Grant Response
            The response is a JSON structure containing the access token. The JSON structure looks like this:

            { "access_token"  : "...",
              "token_type"    : "...",
              "expires_in"    : "...",
              "refresh_token" : "...",
            }

            b1. The access_token property is the access token as assigned by the authorization server.
            b2. The token_type property is a type of token assigned by the authorization server.
            b3. The expires_in property is a number of seconds after which the access token expires, and is no longer valid. Expiration of access tokens is optional.
            b4. The refresh_token property contains a refresh token in case the access token can expire. The refresh token is used to obtain a new access token once the one returned in this response is no longer valid.

    16. Client Credentials Grant - Requests and Response
         a. The client credentials grant request contains the following parameters:
            a1. grant_type     Required. Must be set to client_credentials .
            a2. scope     Optional. The scope of the authorization.
            
        b. Client Credentials Grant Response
            The client credentials response contains the following parameters:

            { "access_token"  : "...",
              "token_type"    : "...",
              "expires_in"    : "...",
            }

            b1. The access_token property is the access token as assigned by the authorization server.
            b2. The token_type property is a type of token assigned by the authorization server.
            b3. The expires_in property is a number of seconds after which the access token expires, and is no longer valid. Expiration of access tokens is optional.

            A refresh token should not be included for this type of authorization request.        

    posted @ 2014-04-08 23:43 一直在努力 ! 閱讀(269) | 評論 (0)編輯 收藏

    2010年10月14日

    Apache Geronimo 3.0 - JSF Integration

        在 Geronimo 的所有歷史版本中, 對 MyFaces 整合的內容比較少, 只是檢查了以下是否有 FacesServlet 在 web.xml 文件中, 如果有則將 MyFaces 的 StartUpListener 添加到 web.xml 中.
         在 JSF 2.0 中, 添加了以下幾個特性, 促使需要對整合的代碼做些許修改
         a. ManagedBean annotation, 不得不說, 這個標識有些雞肋, 事實上 JSF 規范也并不要求對其提供支持. 尤其是 JavaEE 6 中, 有了 WebBeans 之后. 后在在社區里面提了以下, 似乎也沒什么人關心.
         b. 多個 faces-config 文件的排序功能
         由于以上兩個功能, 使得在部署市需要做一些工作, 一是必須掃描出所有的使用 ManagedBean annotation 的 Java 類, 并為其構建本地 JNDI 目錄, 否則那些 @EJB 什么的標簽根本沒法工作. 其次是速度問題, 默認情況下, MyFaces 會在啟動時執行以上的兩個功能, 對應用程序的影響比較大.
         當前的解決方法時, 參照在 Web 容器的處理方式, 使用一些可序列化的 Info 類, 將所有信息在部署時都生成好, 啟動時直接反序列化, 再通過 MyFaces 的一些 SPI 傳遞過去, 避免每次啟動時重復那些工作.

    posted @ 2010-10-14 21:30 一直在努力 ! 閱讀(216) | 評論 (0)編輯 收藏

    Apache Geronimo 3.0 (一)

        以下都是剛開始 Geronimo 3.0 時寫在開心網上的一些筆記, 現移到此處權作備份.

        Geronimo 3.0 框架重構的工作已進行大半,  說來慚愧, 我除了感嘆大師們的思想和設計之外, 剩下的只有學習了, 不知何時才能與大師們煮酒論 Geronimo.
        本周末, 讀了一些代碼, 列了一些要點, 以備以后查詢所需, 并與大家共享.
        1. 內核的創建.
            在 OSGI 環境中, 所有的組件都已 Bundle 的形式存在, Geronimo 所有的內核類和插件也不例外, 都是在 OSGI 的框架啟動后被載入的, 再無原來的 BootStrap 之類的東西了. 如今的內核的初始化, 基本 Geronimo GBean 的載入和 Geronimo 插件的加載都放到 BootActivator 中, 會在第一個 Geronimo 的 Bundle 中處理, 并將 Kernel 通過 OSGI 的 Service 對外發布.
       2. 插件的讀取
            原來的 RepositoryConfigurationStore 想來不會再用了, 如今 config.ser 文件的讀取放在 ConfigurationActivator 之中,  在 Bundle 啟動時會被讀取. 同時通過 ConfigurationManager 的 loadConfiguration 方法加載, 如此做目的, 一來將插件的生命周期與 Bundle 的生命周期作了映射, 二來也有機會記錄了 BundleContext 引用.
       3. 調用順序
            BootActivator -> PersistentConfigurationListener -> loadConfiguration( Artifact ) -> ConfigurationActivator -> loadConfiguration (ConfigurationData)
            整個調用邏輯略顯冗雜, 皆因 Bundle 的生命周期與 Configuration 的生命周期交合一起所致. 前幾天, 我在論壇了回了貼, 竊以為, 既然 Kernel 依舊存在, 何不區分對待, 各管各得, 省得互相映射而導致這樣那樣的問題, 不好之處只是 Geronimo 沒有與 OSGI 像現在一樣結合在一起. 結果被大師們無視了, 想來有什么問題, 抑或大師們覺得俺們都弄得差不多了, 你再提個想法, 讓俺們白干了 ! 以以往的經驗, 前者居多, 記錄在此, 今后弄明白了再添加說明, 印象會深刻一點.
        下周有機會, 要看一下類載入結構和插件依賴關系的變動, 這個應該是從 OSGI 之最大獲益了.

        回憶了一下 Geronimo 進行 OSGI 整合之處的討論, 當時有些還不怎么明白, 現在明朗多了.
    總體上, 當時有這么些整合方案 :
        一種是將 OSGI 容器以插件的形式部署于 Geronimo 中, 形式和 Web 容器, EJB 容器等一樣, 部署應用時, 通過檢索應用的部署信息, 若與 OSGI 相關, 則部署到 OSGI 容器中, 其他類型的還是各回各家, 各找各媽. 顯而易見, 這種方式是種無痛整合, 工作量只是開發一個新的插件.
        第二種方式, 就是 Geronimo 部署到 OSGI 環境中, 所有的 Geronimo 的 JAR 文件和插件均是以 Bundle 的形式存在于 OSGI 環境中, 好處自然是享受到 OSGI 的那些動態載入, 細粒度類載入器關聯等. 依據 Geronimo 的 Kernel 是否存在, 這種方式又可以再做細分. Kernel 存在的情況下, 事實上也就是現在使用的方式, 首先啟動內核, 之后由 ConfigurationManager 啟動各個插件, 再將其加載到內核中去. 這種方式下, Geroniom Is Part Of OSGI, 整合依舊不是很徹底. 最好的自然是 Geronimo IS OSGI, 此時, 再無 Kernel, 再無 GBean, 天下大同, 皆為 Bundle. GBean 之流可以通過 blueprint 的服務來代替, 如此, Geronimo 則完全脫胎換骨了. 革命革命, 先革己命, 在此得到印證.
        另外, 我在想, 現在看, OSGI 幾乎成了香饃饃, 感覺你的產品要是沒使用 OSGI 架構, 都不好意思和別人打招呼. 我得承認, OSGI 確實有很多吸引人的地方, 但是應用于 Java EE 的環境下, 還有許多待改進的地方, 這估計也是出了那么多 RFC 的原因, 畢竟 OSGI 之處并不是想應用于企業應用的環境中, 正如 JAVA 之處是想用來做機頂盒的開發一樣, 后來在 Web 環境下確大放異彩. 在整合的過程中, 出現了很多問題, 例如之前討論的, RMI 類載入器的問題, 擴展類路徑的問題, 均未在 OSGI 中得到完美解決. 如此整合 OSGI, 想來也是配合公司新推的EBA 的編程模型, 并為 WAS 先踩踩雷.
        以上內容, 均是隨手而寫, 是從我自己的理解和對大師的言論中推斷而來, 大家看的時候自個注意.

        OSGI 中 Bundle 之間的依賴關系的處理比較直白, 在一個 Bunlde 安裝之后的某個時機, 對其標注依賴關系進行解析, 如果萬事俱備, 設置其為 Resolved 狀態, 如果不滿足, 則處于 INSTALLED 狀態。 這種處理方式, 與 OSGI 是一個靈活易插拔的環境有關。
        而在 Geronimo 中, 可不能任其如此, 所有的 Geronimo 插件都在 geronimo-plugin.xml/config.ser 中標注了依賴關系。在啟動插件時, 必需首先啟動其所依賴的所有其他組件。
        在之前版本中, 這些都是由 ConfigurationManager 來處理的, 插件所以依賴的無非是其他插件或者類庫文件, 對于前者, ConfigurationManager 會首先啟動之, 而后者, 則之間將其加入當前類載入器路徑中即可。
        當切換到 OSGI之后, 一切都變了 。 首當其沖的是那些類庫文件, 即 JAR 文件, 它們成為了一個個 Bundle, 都有了鮮活的生命, 不可只將其放到類載入器路徑中就一了百了, 需要俺們安裝和啟動之。  其次, 誰負責按順啟動這些插件, 之前是由 ConfigurationManager, 現在則在 DependencyManager (Bundle Extender)來處理。 究其原因, 個人感覺, 技術上不存在限制, 但從設計上而言, ConfigurationManager 管理的是 Geronimo 插件在 Geronimo 內核中的生命周期, 而在 OSGI 環境中,有 OSGI 環境中的組件處理依賴關系, 顯得更自然些。(個人意見, 僅供參考)
        最后記錄一下 DependencyManager 的處理邏輯, 它監聽了每個 Bundle 的啟動, 接收到安裝事件之后, 會讀取 geronimo-plugin.xml 文件中的依賴關系, 并嘗試啟動這些依賴組件。

    posted @ 2010-10-14 21:18 一直在努力 ! 閱讀(606) | 評論 (0)編輯 收藏

    博客重新開張了 !

    博客重新開張了 !

    posted @ 2010-10-14 21:11 一直在努力 ! 閱讀(132) | 評論 (0)編輯 收藏

    2006年6月7日

    移動夢網提供信息或增值服務

    每一個通過移動夢網提供信息或增值服務的公司,移動都會給它們一個服務號碼,如QQ的服務號碼是 1700,如果你想終止這個公司的服務,只需要向該公司的號碼發送內容為“00000”的短信即可,例如終止移動QQ,只需要將"00000"發往 1700即可。所有的公司的服務代碼,可以通過 http://www.bmcc.com.cn 點擊 "夢網合作" 再點擊 "SP客服熱線" ,就可查到。

    reference from:http://hedong.3322.org/archives/000615.html

    posted @ 2006-06-07 16:06 一直在努力 ! 閱讀(242) | 評論 (0)編輯 收藏

    2006年4月27日

    水務局信息系統FAQs!

    1.Question:當初t_highlowtide這張表為什么要建?高低潮為什么不是直接放到sdh那張表里面
    ???Answer:原來的表時間記錄只記錄了小時分,在有些對高低潮的數據處理是會不方便


    2.Question:sdh中的潮位時間記錄只記錄了小時分什么意思?
    ?? Answer:時間的數據類型是char(4)


    3.Question:那用t_highlowtide表就沒問題了是吧,測試過嗎?
    ?? Answer:是的


    4.Question:為什么寫一些DAO
    ?? Answer:因為原來的表有一些設計不合理,直接使用o/r?mapping 會有問題


    5.Question:對原來的表使用pupa o/r mapping時,沒有主鍵怎么辦?
    ???Answer:原來的表都是使用復合主鍵,在pupa中使用必須添加一主鍵,為避免與其他系統沖突,需設置默認值


    6.Question:如何對報文元素進行劃分
    ?? Answer:將那些放在一起處理的才會有意義的元素歸為一組,如TM(時間)單獨處理是沒有意義的,必須和其他元素放在一起才可以;保存在一張表的數據也可以歸為一組


    7.Question:為甚么分大類和小類
    ?? Answer:主要是和報文中的大類進行對應,同時避免同名的報文元素在不同大類里面處理方式會不一樣


    8.Question:如何從handler中獲取報文元素的值
    ?? Answer:調用IMessageTextElement的get方法,傳入的參數是報文元素名


    9.Question:高低潮中含有多個TM元素如何處理
    ?? Answer:設置正則表達式使每個潮位和時間就觸發一次handler的處理,更新到t_highlowtide中,觸發器會同步到sdh


    10.Question:“有些對高低潮的數據處理是會不方便”有那些處理,是我們的系統中的處理嗎?
    ???? Answer:是的,比如說想知道潮位是哪一天的

    11.Question:你在做刪除八時水位時:
    ??????????????????calendar.setTimeInMillis(deleteTime);
    ??????????????????calendar.set(Calendar.HOUR_OF_DAY, 0);
    ??????????????????calendar.set(Calendar.MINUTE, 0);
    ??????????????????calendar.set(Calendar.SECOND, 0);
    ??????????????????calendar.set(Calendar.MILLISECOND, 0);?
    ??????????????????是不是刪除了一天的所有記包括非八點的??
    ??? Answer:這么做的目的只是取到當天0時0分0秒的long值,請仔細閱讀后面的代碼,謝謝!?

    ?

    posted @ 2006-04-27 11:07 一直在努力 ! 閱讀(218) | 評論 (0)編輯 收藏

    2005年11月11日

    Some oracle detail...

    1.一個Oracle 的 Connection 最多可以創建 300 個statement
    2.oracle綁定中文時一個中文字符按照3個字節計算,而且字符串最大綁定量為2000字節,串長度小于666的是安全的
          if( str.length() > 2000 || str.getBytes("utf8").length > 2000 )
           mst.setCharacterStream(i+1,new CharArrayReader(str.toCharArray()),str.length());
          else
           mst.setString(i+1,str);
    3.修改oracle blob時可以先用 for update 對修改對象加鎖再修改,使用時需強制轉換為 oracle.sql.BLOB

    posted @ 2005-11-11 15:46 一直在努力 ! 閱讀(166) | 評論 (0)編輯 收藏

    2005年10月27日

    由(http://blog.csdn.net/treaturebeauty/archive/2005/03/18/323121.aspx)想到的

    (1)在java中所有類都是object的子類,數組也不例外

    (2)測試程序:

                      Object[] oObjArray = {"a","b"};

                      Object oObj = oObjArray;    //這句執行沒有問題

                       String[] oStrArray = (String[] )oObj;  //不行

    (3)測試程序:

                       Object o = new String[]{"a","b","c"};

                       String[] oStrArray = (String[])o; ///Ok

    posted @ 2005-10-27 19:17 一直在努力 ! 閱讀(186) | 評論 (0)編輯 收藏

    (你的燈還亮著么)這個問題是什么?

    故事講的是四家公司參與政府資產投標,每家都想通過投標之前進行計算預測出投標時可能出現的情況,結果---
        問題定義方面學到的:
           a.不要把他們的解決方法誤認為是問題的定義
           b.如果你太輕易地解決了他們的問題,他們永遠都不會相信你真的解決了他們的問題
           c.你永遠都不能肯定你已經有了一個正確的定義,即使在問題已經解決之后。
           d.你永遠也不能肯定你有了一個正確的定義,但是永遠不要放棄尋求它的努力

    posted @ 2005-10-27 19:16 一直在努力 ! 閱讀(268) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 在线日本高清免费不卡| 男女啪啪免费体验区| 8x8×在线永久免费视频| 亚洲成人动漫在线| 免费看少妇高潮成人片| 亚洲国产精品一区二区第一页| 国产成人无码精品久久久久免费| 久久综合亚洲色HEZYO国产| 国产精品内射视频免费| 亚洲永久无码3D动漫一区| 精品免费视在线观看| 亚洲国产精品久久| 精品久久8x国产免费观看| 亚洲伊人色一综合网| 无码av免费毛片一区二区| 亚洲中文字幕久在线| 日本免费人成黄页网观看视频 | 亚洲欧洲日产国码www| 免费v片在线观看视频网站| 在线观看亚洲AV每日更新无码 | 亚洲国产区男人本色| 国产精品无码一二区免费| 一级毛片免费播放视频| 国产亚洲精品va在线| 一级毛片免费观看不收费| 亚洲AV无码久久精品狠狠爱浪潮| 99re6在线视频精品免费下载| 色在线亚洲视频www| 亚洲美日韩Av中文字幕无码久久久妻妇| 国产在线观看xxxx免费| 亚洲日本在线观看网址| 国产在线播放免费| 中文无码成人免费视频在线观看| 亚洲一区免费在线观看| 亚洲AV无码一区二区三区在线观看| 免费无码又爽又刺激网站| 亚洲宅男精品一区在线观看| 亚洲精品成人区在线观看| 久久综合给合久久国产免费 | 精品国产麻豆免费人成网站| 亚洲色丰满少妇高潮18p|