2006年12月12日

          Haddop 配置引起的
          WARN org.mortbay.log: /getimage: java.io.IOException: GetImage failed. java.io.IOException: Content-Length header is not provided by  the namenode when trying to fetch http://127.0.1.1:50090/getimage?getimage=1

          最近在翻看NameNode的log時(shí)發(fā)現(xiàn)經(jīng)常有這一段信息出現(xiàn):



          看來(lái)是SecondNameNode在向NameNode獲取Image時(shí)出的問(wèn)題。雖然不影響hdfs使用,但是SecondName
          備份功能失效,任其下去萬(wàn)一NameNode掛了那可就無(wú)處申冤了。
          經(jīng)過(guò)Google大神幫助,得知需要在hdfs-site.xml中手動(dòng)配置dfs.secondary.http.address,這個(gè)配置項(xiàng)的默認(rèn)值如下
          <property>
            
          <name>dfs.namenode.secondary.http-address</name>
            
          <value>0.0.0.0:50090</value>
            
          <description>
              The secondary namenode http server address and port.
              If the port is 
          0 then the server will start on a free port.
            
          </description>
          </property>
          需要明確指明SecondName,與conf/master里面的名稱一樣
          <property>
            
          <name>dfs.namenode.secondary.http-address</name>
            
          <value>test-dn2:50090</value>
            
          <description>
              The secondary namenode http server address and port.
              If the port is 
          0 then the server will start on a free port.
            
          </description>
          </property>
          posted @ 2011-09-13 11:44 Juliashine 閱讀(886) | 評(píng)論 (1)編輯 收藏
           
          1、IE有全局event對(duì)象window.event,F(xiàn)F沒(méi)有,F(xiàn)F中的?event?只能在事件發(fā)生的現(xiàn)場(chǎng)使用,即必須通過(guò)事件綁定函數(shù)的參數(shù)來(lái)使用。
          <input?type="text"?name="input_content"?onkeydown="exeCode(event)"/>

          <script?language="javascript">
          function?exeCode()?{
          ??
          //取得事件對(duì)象
          ??var?event?=?arguments[0]?||?window.event;
          ??
          //取得事件的發(fā)生源對(duì)象
          ??var?element?=?event.srcElement?||?event.target;
          }

          </script>


          2、FireFox下沒(méi)有preserveWhiteSpace這個(gè)屬性,即:把空白也當(dāng)作一個(gè)節(jié)點(diǎn)。而IE則默認(rèn)為false,即把空白不看成一個(gè)節(jié)點(diǎn)。所以在FireFox下previousSibling可能是空白節(jié)點(diǎn),除非兩個(gè)HTML標(biāo)簽之間沒(méi)有任何形式的空格。

          3、IE下可以用document.frames("name").document的方式取得frame中所嵌頁(yè)面的document對(duì)象,F(xiàn)F下卻會(huì)得到null,解決的的辦法是document.getElementById(framename).contentWindow.document,也可以使用
          window.frames[frameName].document 直接獲取frame里的document對(duì)象


          最后推薦一篇文章:Javascript的IE和Firefox兼容性匯編
          posted @ 2007-03-29 15:06 Juliashine 閱讀(752) | 評(píng)論 (0)編輯 收藏
           
          在Hibernate中配置Proxool連接池
          1:在applicationContext.xml中配置SessionFactory
          <bean?id="sessionfactory"?class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
          ????<property?name="hibernateProperties">
          ????????<props>
          ????????????<prop?key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
          ????????????<prop?key="hibernate.show_sql">true</prop>
          ????????????<!--指定Proxool配置文件-->
          ????????????<prop?key="hibernate.proxool.properties">conf/proxool.properties</prop>
          ????????????<!--<prop?key="hibernate.proxool.xml">conf/proxool.xml</prop>-->
          ????????????<!--指定Proxool的alias,必須與Proxool的配置文件中的alias一致-->
          ????????????<prop?key="hibernate.proxool.pool_alias">hibernate-oracle</prop>
          ????????</props>
          ????</property>
          </bean>
          2:配置Proxool(conf/proxool.properties)
          #jdbc-0.proxool.alias=mysql
          #jdbc-0.proxool.driver-class=org.gjt.mm.mysql.Driver
          #jdbc-0.proxool.driver-url=jdbc:mysql://localhost:3306/contestdb?user=root&password=1234&useUnicode=true&characterEncoding=utf8
          #jdbc-0.user=root
          #jdbc-0.password=1234

          jdbc-0.proxool.alias=hibernatea-oracle
          jdbc-0.proxool.driver-class=oracle.jdbc.driver.OracleDriver
          jdbc-0.proxool.driver-url=jdbc:oracle:thin:@172.16.2.6:1521:dbname
          jdbc-0.user=username
          jdbc-0.password=username
          jdbc-0.proxool.maximum-connection-count=20
          jdbc-0.proxool.house-keeping-test-sql=SELECT?SYSDATE?FROM?DUAL;
          #DEBUG,?INFO,?WARN,?ERROR,?FATAL.
          jdbc-0.proxool.statistics-log-level=ERROR
          posted @ 2006-12-21 15:13 Juliashine 閱讀(430) | 評(píng)論 (0)編輯 收藏
           
          ???????? The?URL?extension?to?use?to?determine?if?the?request?is?meant?for?a?Struts?action?
          ???????????用URL擴(kuò)展名來(lái)確定是否這個(gè)請(qǐng)求是被用作Struts?action,其實(shí)也就是設(shè)置?action的后綴,例如login.do的'do'字。

          struts.configuration
          ??????????The?org.apache.struts2.config.Configuration?implementation?class
          ????????????org.apache.struts2.config.Configuration接口名

          struts.configuration.files
          ??????????A?list?of?configuration?files?automatically?loaded?by?Struts?
          ???????????struts自動(dòng)加載的一個(gè)配置文件列表

          struts.configuration.xml.reload
          ??????????Whether?to?reload?the?XML?configuration?or?not
          ???????????是否加載xml配置(true,false)

          struts.continuations.package
          ???????????The?package?containing?actions?that?use?Rife?continuations
          ???????????含有actions的完整連續(xù)的package名稱

          struts.custom.i18n.resources
          ??????????Location?of?additional?localization?properties?files?to?load?
          ???????????加載附加的國(guó)際化屬性文件(不包含.properties后綴)

          struts.custom.properties
          ??????????Location?of?additional?configuration?properties?files?to?load
          ???????????加載附加的配置文件的位置


          struts.devMode
          ??????????Whether?Struts?is?in?development?mode?or?not
          ???????????是否為struts開(kāi)發(fā)模式

          struts.dispatcher.parametersWorkaround
          ??????????Whether?to?use?a?Servlet?request?parameter?workaround?necessary?for?some?versions?of?WebLogic
          ????????????(某些版本的weblogic專用)是否使用一個(gè)servlet請(qǐng)求參數(shù)工作區(qū)(PARAMETERSWORKAROUND)

          struts.enable.DynamicMethodInvocation
          ??????????Allows?one?to?disable?dynamic?method?invocation?from?the?URL
          ????????????允許動(dòng)態(tài)方法調(diào)用

          struts.freemarker.manager.classname
          ??????????The?org.apache.struts2.views.freemarker.FreemarkerManager?implementation?class?
          ???????????org.apache.struts2.views.freemarker.FreemarkerManager接口名

          struts.i18n.encoding
          ??????????The?encoding?to?use?for?localization?messages
          ???????????國(guó)際化信息內(nèi)碼

          struts.i18n.reload
          ??????????Whether?the?localization?messages?should?automatically?be?reloaded
          ???????????是否國(guó)際化信息自動(dòng)加載?

          struts.locale
          ??????????The?default?locale?for?the?Struts?application
          ???????????默認(rèn)的國(guó)際化地區(qū)信息

          struts.mapper.class
          ??????????The?org.apache.struts2.dispatcher.mapper.ActionMapper?implementation?class
          ????????????org.apache.struts2.dispatcher.mapper.ActionMapper接口

          struts.multipart.maxSize
          ??????????The?maximize?size?of?a?multipart?request?(file?upload)
          ???????????multipart請(qǐng)求信息的最大尺寸(文件上傳用)?

          struts.multipart.parser
          ??????????The?org.apache.struts2.dispatcher.multipart.
          ??????????MultiPartRequest?parser?implementation?for?a?multipart?request?(file?upload)?
          ??????????專為multipart請(qǐng)求信息使用的org.apache.struts2.dispatcher.multipart.MultiPartRequest解析器接口(文件上傳用)


          struts.multipart.saveDir
          ??????????The?directory?to?use?for?storing?uploaded?files?
          ???????????設(shè)置存儲(chǔ)上傳文件的目錄夾

          struts.objectFactory
          ??????????The?com.opensymphony.xwork2.ObjectFactory?implementation?class
          ???????????com.opensymphony.xwork2.ObjectFactory接口(spring)

          struts.objectFactory.spring.autoWire
          ??????????Whether?Spring?should?autoWire?or?not
          ???????????是否自動(dòng)綁定Spring

          struts.objectFactory.spring.useClassCache
          ??????????Whether?Spring?should?use?its?class?cache?or?not
          ???????????是否spring應(yīng)該使用自身的cache?

          struts.objectTypeDeterminer
          ??????????The?com.opensymphony.xwork2.util.ObjectTypeDeterminer?implementation?class
          ????????????com.opensymphony.xwork2.util.ObjectTypeDeterminer接口

          struts.serve.static.browserCache
          ??If?static?content?served?by?the?Struts?filter?should?set?browser?caching?header?properties?or?not?
          ???????????是否struts過(guò)濾器中提供的靜態(tài)內(nèi)容應(yīng)該被瀏覽器緩存在頭部屬性中

          struts.serve.static
          ??????????Whether?the?Struts?filter?should?serve?static?content?or?not?
          ???????????是否struts過(guò)濾器應(yīng)該提供靜態(tài)內(nèi)容

          struts.tag.altSyntax
          ??????????Whether?to?use?the?alterative?syntax?for?the?tags?or?not?
          ???????????是否可以用替代的語(yǔ)法替代tags

          struts.ui.templateDir
          ??????????The?directory?containing?UI?templates
          ???????????UI?templates的目錄夾?

          struts.ui.theme
          ??????????The?default?UI?template?theme
          ???????????默認(rèn)的UI?template主題

          struts.url.http.port
          ??????????The?HTTP?port?used?by?Struts?URLs
          ???????????設(shè)置http端口

          struts.url.https.port
          ??????????The?HTTPS?port?used?by?Struts?URLs?
          ???????????設(shè)置https端口

          struts.url.includeParams
          ??????????The?default?includeParams?method?to?generate?Struts?URLs?
          ??????????在url中產(chǎn)生?默認(rèn)的includeParams


          struts.velocity.configfile
          ??????????The?Velocity?configuration?file?path
          ???????????velocity配置文件路徑

          struts.velocity.contexts
          ??????????List?of?Velocity?context?names
          ???????????velocity的context列表


          struts.velocity.manager.classname
          ??????????org.apache.struts2.views.velocity.VelocityManager?implementation?class
          ???????????org.apache.struts2.views.velocity.VelocityManager接口名

          struts.velocity.toolboxlocation
          ??????????The?location?of?the?Velocity?toolbox
          ???????????velocity工具盒的位置?
          struts.xslt.nocache
          ??????????Whether?or?not?XSLT?templates?should?not?be?cached
          ???????????是否XSLT模版應(yīng)該被緩存
          posted @ 2006-12-21 15:11 Juliashine 閱讀(552) | 評(píng)論 (0)編輯 收藏
           
          Struts2 發(fā)布已經(jīng)很長(zhǎng)時(shí)間了,一直沒(méi)有顧得上學(xué)習(xí),本周工作比較輕松,花點(diǎn)時(shí)間照著例子做了一下,但是在與Spring 集成的時(shí)候出現(xiàn)問(wèn)題,action找不到Spring中定義的bean,折騰了兩個(gè)多小時(shí)才最終搞定,決定把心得記錄下來(lái)。

          Struts2 集成 Spring 的 Web.xml 最簡(jiǎn)配置

          <? xml?version="1.0"?encoding="UTF-8" ?>
          < web-app? id ="WebApp_9" ?version ="2.4" ?xmlns ="http://java.sun.com/xml/ns/j2ee" ?
          ????xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
          ?
          ????xsi:schemaLocation
          ="http://java.sun.com/xml/ns/j2ee?http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >


          ????
          < display-name > Struts?2.0 </ display-name >
          ????
          ????
          < filter >
          ????????
          < filter-name > struts </ filter-name > ????????
          ????????
          < filter-class > org.apache.struts2.dispatcher.FilterDispatcher </ filter-class >

          ????
          </ filter >
          ????
          < filter-mapping >
          ????????
          < filter-name > struts </ filter-name >
          ????????
          < url-pattern > /* </ url-pattern >
          ????
          </ filter-mapping >
          ????
          ????
          < listener >
          ????????
          < listener-class >
          ????????????org.springframework.web.context.ContextLoaderListener
          ????????
          </ listener-class >
          ????
          </ listener >
          ????
          ????
          < welcome-file-list >
          ????????
          < welcome-file > index.html </ welcome-file >
          ????
          </ welcome-file-list >
          </ web-app >

          此配置適用于將Spring 的配置文件放在與Web.xml同一目錄,即WEB-INF目錄下,且配置文件采用默認(rèn)命名applicationContext.xml,如果Spring配置文件沒(méi)有放在WEB-INF下或者采用了自定義名稱,則Web.xml應(yīng)該如下定義:

          <? xml?version="1.0"?encoding="UTF-8" ?>
          < web-app? id ="WebApp_9" ?version ="2.4" ?xmlns ="http://java.sun.com/xml/ns/j2ee" ?
          ????xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
          ?
          ????xsi:schemaLocation
          ="http://java.sun.com/xml/ns/j2ee?http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >


          ????
          < context-param >
          ????????
          < param-name > contextConfigLocation </ param-name >
          ????????
          < param-value > classpath*:applicationContext*.xml </ param-value >
          ????
          </ context-param >
          ????
          < filter >
          ????????
          < filter-name > struts </ filter-name > ????????
          ????????
          < filter-class > org.apache.struts2.dispatcher.FilterDispatcher </ filter-class >

          ????
          </ filter >
          ????
          < filter-mapping >
          ????????
          < filter-name > struts </ filter-name >
          ????????
          < url-pattern > /* </ url-pattern >
          ????
          </ filter-mapping >
          ????
          ????
          < listener >
          ????????
          < listener-class >
          ????????????org.springframework.web.context.ContextLoaderListener
          ????????
          </ listener-class >
          ????
          </ listener >
          ????
          ????
          < welcome-file-list >
          ????????
          < welcome-file > index.html </ welcome-file >
          ????
          </ welcome-file-list >
          </ web-app >

          注意這里比上個(gè)配置多出的項(xiàng)

          ???< context-param >
          ??????< param-name > contextConfigLocation </ param-name >
          ??????< param-value > classpath*:applicationContext*.xml </ param-value >
          ???</ context-param >

          表示Spring配置文件放在CLASSPATH目錄下,即WEB-INF/classes目錄下,名稱為applicationContext*.xml,其中“*”為任意字符

          注意,這還沒(méi)完,CLASSPATH下有個(gè)struts.property文件,必須在里面添加一行內(nèi)容:
          (我就是缺了這個(gè)導(dǎo)致action找不到bean)

          struts.objectFactory?=?spring??

          給Spring配置文件的<beans>元素加上如下屬性

          <beans?default-autowire="autodetect">???

          ??……?……

          OK,配置完畢!可以使用了

          posted @ 2006-12-15 17:04 Juliashine 閱讀(432) | 評(píng)論 (0)編輯 收藏
           
          ROC曲線(Receiver Operating Characteeristic Curve)是顯示Classification模型真正率和假正率之間折中的一種圖形化方法。

          解讀ROC圖的一些概念定義::

          真正(True Positive , TP)被模型預(yù)測(cè)為正的正樣本
          假負(fù)(False Negative , FN)被模型預(yù)測(cè)為負(fù)的正樣本
          假正(False Positive , FP)被模型預(yù)測(cè)為正的負(fù)樣本
          真負(fù)(True Negative , TN)被模型預(yù)測(cè)為負(fù)的負(fù)樣本

          真正率(True Positive Rate , TPR)或靈敏度(sensitivity)?
          ???TPR = TP /(TP + FN)?
          ???正樣本預(yù)測(cè)結(jié)果數(shù) / 正樣本實(shí)際數(shù)
          假負(fù)率(False Negative Rate , FNR)?
          ???FNR = FN /(TP + FN)?
          ???被預(yù)測(cè)為負(fù)的正樣本結(jié)果數(shù) / 正樣本實(shí)際數(shù)
          假正率(False Positive Rate , FPR)?
          ???FPR = FP /(FP + TN)?
          ???被預(yù)測(cè)為正的負(fù)樣本結(jié)果數(shù) /負(fù)樣本實(shí)際數(shù)
          真負(fù)率(True Negative Rate , TNR)或特指度(specificity)?
          ???TNR = TN /(TN + FP)?
          ???負(fù)樣本預(yù)測(cè)結(jié)果數(shù) / 負(fù)樣本實(shí)際數(shù)

          目標(biāo)屬性的被選中的那個(gè)期望值稱作是“正”(positive)

          ROC曲線上幾個(gè)關(guān)鍵點(diǎn)的解釋:

          ( TPR=0,FPR=0 ) 把每個(gè)實(shí)例都預(yù)測(cè)為負(fù)類的模型
          ( TPR=1,FPR=1 ) 把每個(gè)實(shí)例都預(yù)測(cè)為正類的模型
          ( TPR=1,FPR=0 ) 理想模型

          此處圖像以后再補(bǔ)

          一個(gè)好的分類模型應(yīng)該盡可能靠近圖形的左上角,而一個(gè)隨機(jī)猜測(cè)模型應(yīng)位于連接點(diǎn)(TPR=0,FPR=0)和(TPR=1,FPR=1)的主對(duì)角線上。

          ROC曲線下方的面積(AUC)提供了評(píng)價(jià)模型平均性能的另一種方法。如果模型是完美的,那么它的AUG = 1,如果模型是個(gè)簡(jiǎn)單的隨機(jī)猜測(cè)模型,那么它的AUG = 0.5,如果一個(gè)模型好于另一個(gè),則它的曲線下方面積相對(duì)較大。

          Oracle 論壇上對(duì)ROC 的解釋
          http://forums.oracle.com/forums/thread.jspa?threadID=415870&tstart=15
          posted @ 2006-12-12 14:25 Juliashine 閱讀(1842) | 評(píng)論 (0)編輯 收藏
           
          主站蜘蛛池模板: 卢湾区| 肥乡县| 江山市| 赣榆县| 海南省| 沙坪坝区| 临西县| 宁安市| 平果县| 资中县| 渭南市| 五原县| 长乐市| 呼伦贝尔市| 炎陵县| 莲花县| 霍林郭勒市| 孟州市| 五台县| 昌黎县| 长阳| 马山县| 松阳县| 灯塔市| 石屏县| 渑池县| 克拉玛依市| 河北区| 湖北省| 读书| 苍梧县| 满城县| 肥东县| 白玉县| 泾源县| 乌拉特中旗| 永顺县| 遂宁市| 尼玛县| 兴海县| 保德县|