The NoteBook of EricKong

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            611 Posts :: 1 Stories :: 190 Comments :: 0 Trackbacks

          #

          Materials from industry :
          How to fix memory leaks in java : http://olex.openlogic.com/wazi/2009/how-to-fix-memory-leaks-in-java/
          GC Tuning : http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html
          GC and Memory Leak Tips : http://chaoticjava.com/posts/gc-tips-and-memory-leaks/
          Tools
          IBM Support Assistant : http://www-01.ibm.com/software/support/isa/download.html
          Memory Analyzer : http://www.ibm.com/developerworks/java/jdk/tools/memoryanalyzer/
          Garbage Collection and Memory Visualizer : http://www.ibm.com/developerworks/java/jdk/tools/gcmv/
          Eclipse Tools:
          Memory Analyzer (MAT) :  http://www.eclipse.org/mat/
          Guideline: http://wiki.eclipse.org/MemoryAnalyzer#Getting_a_Heap_Dump
          Testing and Performance Tools Platform (TPTP): http://www.eclipse.org/tptp/
          Guideline: http://www.eclipse.org/tptp/platform/documents/tutorials/jvmti/Java_Application_Profiling_using_TPTP-r4-3.html
          Java Tools:
          HPROF: http://java.sun.com/developer/technicalArticles/Programming/HPROF.html
          posted @ 2013-09-20 15:56 Eric_jiang 閱讀(601) | 評論 (1)編輯 收藏

          其基本邏輯為先取得配置的IP列表,然后通過request.getRemoteAddr()取得客戶端的IP地址,做鑒權和校驗,邏輯沒問題,那么肯定是request.getRemoteAddr()出了問題,google下,發現有人遇到類似的問題。
          最終定位為request.getRemoteAddr()這種方法在大部分情況下都是有效的。但是在通過了Apache,Squid等反向代理軟件就不能獲取到客戶端的真實IP地址了。
          如果使用了反向代理軟件,將http://192.168.1.110:2046/ 的URL反向代理為http://www.xxx.com/ 的URL時,用request.getRemoteAddr()方法獲取的IP地址是:127.0.0.1 或 192.168.1.110,而并不是客戶端的真實IP。
          經過代理以后,由于在客戶端和服務之間增加了中間層,因此服務器無法直接拿到客戶端的IP,服務器端應用也無法直接通過轉發請求的地址返回給客戶端。但是在轉發請求的HTTP頭信息中,增加了X-FORWARDED-FOR信息用以跟蹤原有的客戶端IP地址和原來客戶端請求的服務器地址。
          原來如此,我們的項目中正好是有前置apache,將一些請求轉發給后端的weblogic,看來就是這樣導致的咯。
          給出一份還算靠譜的代碼,如下:
          Java代碼
          public String getIpAddr(HttpServletRequest request) {
                  String ip 
          = request.getHeader("x-forwarded-for");
                  
          if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                      ip 
          = request.getHeader("Proxy-Client-IP");
                  }
                  
          if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                      ip 
          = request.getHeader("WL-Proxy-Client-IP");
                  }
                  
          if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
                      ip 
          = request.getRemoteAddr();
                  }
                  
          return ip;
              }
          如果有人遇到類似問題,請多加留意,呵呵。
          PS:可是,如果通過了多級反向代理的話,X-Forwarded-For的值并不止一個,而是一串ip值,究竟哪個才是真正的用戶端的真實IP呢?
          答案是取X-Forwarded-For中第一個非unknown的有效IP字符串。如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130, 192.168.1.100,用戶真實IP為: 192.168.1.110
          posted @ 2013-09-11 18:21 Eric_jiang 閱讀(347) | 評論 (0)編輯 收藏

               摘要: Selenium是一個很好用的Web界面測試框架。但它的功能也有不足之處,比如: 在Selenium IDE中不支持程序控制語句。下面介紹如何在Selenium IDE中添加程序控制功能。1)下載Selenium插件 (sideflow.js): 如果不想下載,直接把下面的代碼保存到本機也可。?var gotoLabels= {};var whileLabels = {};&n...  閱讀全文
          posted @ 2013-09-06 16:54 Eric_jiang 閱讀(505) | 評論 (0)編輯 收藏

               摘要: 1、把.cer的SSL證書轉換為.pem文件,執行命令:openssl x509 -in aps_development.cer -inform der -out PushChatCert.pem 在桌面上會生成一個PushChatCert.pem文件 2、把私鑰Push.p12文件轉化為.pem文件:openssl pkcs12 -nocerts -out PushChatK...  閱讀全文
          posted @ 2013-09-06 12:43 Eric_jiang 閱讀(548) | 評論 (0)編輯 收藏

          Create a Physical File with or without a key field 
          創建一個物理文件(有或者沒有Key字段)

          The AS/400 database, DB2/400 is part of the AS/400 operating system. It is a relational database and has features similar to other databases you may have used such as Microsoft Access, Oracle or Dbase. The standard method of creating files is to define the specifications of the file using DDS. Of course DDS is used for other things on the AS/400 like defining display files and print files. 
          AS/400數據庫,DB2/400是AS/400操作系統的一部分,它是一個關系性數據庫.和其他的數據庫相比,例如Microsoft Access, Oracle or Dbase有著相似的特性.用DSS文件編寫說明語句是創建數據庫文件的標準方法.當然,也可以使用DSS在AS400做其他東西,例如創建顯示文件或者打印文件

          To create a physical database file, enter your source statements in a DDS source file member. For example, name the member "CUS" for customer file. Make sure the member type is "PF". This tells the compiler that this is for a physical file. Notice that the first record has an "R" in position 17. This means that this line is specifying the record name, in this case "CUREC". The "TEXT" is optional but helps to document the file. 
          創建一個物理文件數據庫,你需要在DSS文件中輸入你的數據描述代碼.例如,以一個Customer文件為例,命名為CUS的Member,要確保這個member的類型是"PF",這是為了告訴編譯器,這是一個物理文件.注意到在第一行中,位置17的地方有個"R"的標記,這一行指明了記錄的名字,這里記錄名字就是CUREC.而Text不是一定要,但是也對文檔化比較有用.

          After the line naming the record, each line describes a field. The field name is followed by the field length and its data type.
          這一行命名了記錄之后,下面的每一行描述了一個字段,字段名稱后面是字段的長度和數據類型

          The three most used data types are "A" for alpha or character, "S" for numeric and "P" for packed decimal. For numeric fields, you must also specify the number of decimal positions. So here, the company number field is a three digit number with no decimal places. The customer number and zip code are also numeric fields with no decimal places. The credit limit is a numeric, packed decimal field with 9 digits, of which two are after the decimal point. The rest of the fields are character fields. 
          最常用的數據類型是下面的三種, "A"代表字符,"S"代表數值, "P"代表packed decimal,對于數值字段,你必須指明小數點的位置,這里,公司號碼字段就是一個3個數字的號碼,沒有小數點,客戶號碼和郵政編碼同樣是數字,也是沒有小數,而信用額度是一個數值,它一個有9個數字,其中兩位數值位于小數點后面,其他的都是字符的定義

          Once you have entered the DDS source code, you must compile it. You do this by keying option 14 next to your member name on the PDM screen. If you pay attention you will see that the AS/400 is actually executing the CRTPF (Create Physical File) command. It knows to use this command because the member type of the source code is "PF". 
          一旦你輸入完DDS代碼,你必須編譯它,在PDM界面中,在你要編譯Member名字的后面輸入14.假如你細心一點,你會發現AS400實際執行了CRTPF (Create Physical File)命令,這是因為這個Member的類型是"PF"

          You now have a database physical file, see Figure 1. This file has built into it the fields and their attributes. Let's modify this file definition to add key fields. If a physical file has key fields, programs can randomly access the records or read them sequentially in the order of the key fields.
          現在你已經有了數據庫物理文件,如圖1,這個文件包含了字段和他們的屬性,現在我們就為文件增加key字段,假如這個物理文件包含了key字段,那么程序就可以通過Key隨即的訪問或者順許的訪問記錄

          You can see in Figure 2 that it is simple to add key fields. 
          看圖2,建立key字段是非常簡單的

          The "UNIQUE" record at the beginning of the source is used if you want the AS/400 to insist on having no records with duplicate keys. This is optional. At the end of the source code, there are two lines with "K" in position 17. These lines define the key fields. So, this file will build a key using the company number and then the customer number. Further, it will not allow a duplicate company number / customer number record to be written. 
          開頭的那個"UNIQUE"表明了你要AS400不能含有重復key的Record,這是可選的. 代碼的末尾最后兩行,在位置17的有兩個"K",這兩個"K"就是定義key字段了,那么,這個文件就會用公司號碼和客戶號碼來建立key,進一步來說,文件不允許含有公司號碼和客戶號碼都相同的recored.

          The records are written to the file in arrival sequence. If you read the data by specifying keyed access, the records will read as though they have been sorted by company number and customer number. Also, your programs can randomly retrieve records. For example, a "CHAIN" instruction in RPG can now randomly read the record for a specific company number / customer number. 
          Record是按順序寫入文件的,而假如你讀取數據的時候指明key,讀取的數據是已經按照公司號碼和客戶號碼排好順序,同時,你也可以隨即讀取Record,例如,RPG的"CHAIN"說明符就可以用公司號碼和客戶號碼隨即讀取文件

          Figure 1 - DDS for Physical File Without Key 
               A          R CUREC                    TEXT('CUSTOMER FILE')   
               A            CUCO           3S 0      TEXT('COMPANY #')       
               A            CUSTS          1A        TEXT('STATUS CODE')     
               A            CUNUM          5S 0      TEXT('CUSTOMER #')      
               A            CUNAME        30A        TEXT('CUSTOMER NAME')   
               A            CUADR         30A        TEXT('CUSTOMER ADDRESS') 
               A            CUCITY        18A        TEXT('CUSTOMER CITY')   
               A            CUSTAT         2A        TEXT('CUSTOMER STATE')  
               A            CUZIP          9S 0      TEXT('CUSTOMER ZIP')        
               A            CUCRLM         9P 2      TEXT('CUST CREDIT LIMIT')         
                                
          Figure 2 - DDS for Physical File With Key Fields
               A                                     UNIQUE                  
               A          R CUREC                    TEXT('CUSTOMER FILE')   
               A            CUCO           3S 0      TEXT('COMPANY #')       
               A            CUSTS          1A        TEXT('STATUS CODE')     
               A            CUNUM          5S 0      TEXT('CUSTOMER #')      
               A            CUNAME        30A        TEXT('CUSTOMER NAME')   
               A            CUADR         30A        TEXT('CUSTOMER ADDRESS') 
               A            CUCITY        18A        TEXT('CUSTOMER CITY')   
               A            CUSTAT         2A        TEXT('CUSTOMER STATE')  
               A            CUZIP          9S 0      TEXT('CUSTOMER ZIP')    
               A            CUCRLM         9P 2      TEXT('CUST CREDIT LIMIT')              
                *                                                             
               A          K CUCO                                              
               A          K CUNUM 
          posted @ 2013-09-04 16:59 Eric_jiang 閱讀(454) | 評論 (0)編輯 收藏

          Nouns of either gender
          陽性或者陰性皆可的名詞

           
          A few nouns can be either masculine or feminine. Relatively common among these are:
          diabetes (also diabete) ‘diabetes’, suéter ‘sweater’ (more often encountered as masculine) and hélice ‘propeller’ (which is more commonly feminine, though can be masculine when
          referring to the propeller of a ship or boat).
           
          有一些名詞,它們是陽性或者陰性皆可的,其中比較常見的是diabetes (also diabete) ‘diabetes’ 糖尿病, suéter ‘sweater’ 羊毛衫(通常都是陽性的)和 hélice ‘propeller’ 螺旋槳,推進器(通常都是陰性的,但是它也可以是陽性的,當涉及的是輪船或者是小艇。
          posted @ 2013-09-03 16:47 Eric_jiang 閱讀(280) | 評論 (2)編輯 收藏

          The gender of a hyphenated compound noun is usually determined by the gender of the first noun in the compound, e.g. posto-chave ‘key post’, which is masculine like posto,and meia-noite, which is feminine like noite. Compounds that begin with a verb stem are masculine, e.g. guarda-chuva ‘umbrella’, para-brisa ‘windscreen’.
           
          復合名詞的性一般取決于第一個名詞的性,例如,posto-chave ‘key post’,關鍵崗位,它們都是陽性的,正如posto郵遞,和meia-noite午夜,而noite是陰性的,那些由動詞開頭的復合名詞是陽性的,例如,guarda-chuva ‘umbrella‘傘,para-brisa ‘windscreen’.擋風玻璃
           
          However, compounds referring to people can be masculine or feminine, depending on the sex of the person referred to, regardless of the original gender of the component noun, e.g.sem-teto ‘homeless person’, cabeça-dura ‘pigheaded person’, porta-voz ‘spokesperson’,relações-públicas ‘PR manager’.
           
          但是,那些涉及到人復合名詞,即可以是陽性的也可以是女性的,這決定于所提及的人的性別,
          不管這個復合名詞原本的性,例如,sem-teto ‘homeless person’無家可歸的人, cabeça-dura ‘pigheaded person’固執的人, porta-voz ‘spokesperson’代言人,relações-públicas ‘PR manager’公共關系經理
          posted @ 2013-09-03 16:29 Eric_jiang 閱讀(241) | 評論 (0)編輯 收藏

          Words that are masculine by implication
          隱含為陽性的名詞

           
          The following nouns are masculine by implication, i.e. there is an unexpressed noun
          (shown below in parentheses) which determines their gender:
          下面這些名詞隱含地為陽性的,
           
          (i) months of the year (mês): abril próximo ‘next April’; 月份,下一個四月
          (ii) rivers, seas, mountains (rio, mar/oceano, monte): o Amazonas ‘the Amazon’, o Pacífico ‘the Pacific’;河流,海洋,山,阿馬遜河,太平洋

          (iii) cardinal points (ponto cardeal): ao norte ‘to the north’; 基本方位,在北方
          (iv) cars, planes, ships (carro, avião, navio): um Fiat ‘a Fiat’, o Titanic ‘the Titanic’;車,飛機,輪船,一臺菲亞特,泰坦尼克號
          (v) bars, restaurants, hotels (bar, restaurante, hotel): o Hilton ‘the Hilton’;吧,飯館,酒店,希爾頓酒店
          (vi) newspapers (jornal): o New York Times ‘the New York Times’;報紙雜志,紐約時代雜志
          (vii) sports teams (time): o Corinthians ‘Corinthians’;運動,業余運動員
          (viii) letters of the alphabet: dois fs ‘two fs’.字母表的字符,兩個fs
           
          Words that are feminine by implication
          下面這些名詞隱含地為陰性的,
           
          (i) cities (cidade): toda Paris ‘all of Paris’, except when the city name contains the masculine definite article, e.g. o Rio de Janeiro (masc.); 城市,巴黎,除了那些城市名詞包含了陽性的冠詞,例如,里約熱內盧
          (ii) streets (rua): na esquina da Visconde ‘on the corner of Visconde’;街道,
          (iii) TV networks (rede): na CNN ‘on CNN’;電視網絡,例如CNN
          (iv) companies, shops, airlines (empresa, loja, companhia): a Microsoft ‘Microsoft’. 公司,商店,航班,微軟
           
          posted @ 2013-09-03 15:49 Eric_jiang 閱讀(299) | 評論 (0)編輯 收藏

          Nouns that are masculine or feminine depending on meaning,

          根據意思決定陽性或者是陰性的名詞

           
          Some words can be masculine or feminine depending on the meaning. Here are some common examples:
           
          某些名詞的陽性或者是陰性,取決于這個詞的在情景中的意思,下面是一些常用的例子
                             作為陽性名詞                                        作為陰性名詞
          As masculine noun                                                 As feminine noun
          Capital     capital (= money) 資金                            capital (= city) 城市
          Cara         guy          家伙                                       face 名字
          grama     gram (= measure) 尺寸                            grass 玻璃
          guia         guide (= man or book) 男人或者書            guide (= woman); form, slip   失誤,口誤;   事故
          moral   morale morality; 道德觀                             moral (of a story) 寓意,教訓
          rádio       radio;       無線電                                    radium radio station. 無線電電臺
          posted @ 2013-09-03 15:20 Eric_jiang 閱讀(301) | 評論 (0)編輯 收藏

          The following nouns are grammatically masculine only, but can refer to females as well
          as males: cônjuge ‘spouse’, indivíduo ‘individual’, ser ‘being’.The following nouns are grammatically feminine only, but can refer to males as well as females: criança ‘child’, pessoa ‘person’, testemunha ‘witness’, vítima ‘victim’.
           
          下面這些名詞,在語法上只能用于男性,但是也可以用于女性。cônjuge ‘spouse’,配偶, indivíduo ‘individual’個人, ser ‘being’是.下面這些名詞在語法上只能用于女性,但是也可以用于男性。criança ‘child’ 孩子, pessoa ‘person’ 人, testemunha ‘witness’ 目擊證人, vítima ‘victim’受害者.
          posted @ 2013-09-03 14:55 Eric_jiang 閱讀(214) | 評論 (0)編輯 收藏

          僅列出標題
          共57頁: First 上一頁 16 17 18 19 20 21 22 23 24 下一頁 Last 
          主站蜘蛛池模板: 榆树市| 确山县| 洪泽县| 长阳| 牙克石市| 辽阳县| 达孜县| 三原县| 青川县| 德阳市| 繁峙县| 大渡口区| 肥乡县| 保康县| 南川市| 阿坝县| 汕尾市| 志丹县| 迭部县| 两当县| 金山区| 浮山县| 姚安县| 自治县| 祥云县| 宝清县| 大丰市| 岳池县| 寿宁县| 乌兰察布市| 微山县| 扶风县| 邛崃市| 巴东县| 龙泉市| 禄劝| 富裕县| 湖北省| 白朗县| 宜黄县| 嘉禾县|