2011年9月13日

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时发现经常有这一段信息出现:



看来是SecondNameNode在向NameNode获取Image时出的问题。虽然不影响hdfs使用,但是SecondName
备份功能失效,任其下去万一NameNode挂了那可就无处申冤了。
经过Google大神帮助,得知需要在hdfs-site.xml中手动配置dfs.secondary.http.address,这个配置项的默认值如下
<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 阅读(867) | 评论 (1)编辑 收藏

2007年3月29日

1、IE有全局event对象window.event,FF没有,FF中的 event 只能在事件发生的现场使用,即必须通过事件绑定函数的参数来使用。
<input type="text" name="input_content" onkeydown="exeCode(event)"/>

<script language="javascript">
function exeCode() {
  
//取得事件对象
  var event = arguments[0|| window.event;
  
//取得事件的发生源对象
  var element = event.srcElement || event.target;
}

</script>


2、FireFox下没有preserveWhiteSpace这个属性,即:把空白也当作一个节点。而IE则默认为false,即把空白不看成一个节点。所以在FireFox下previousSibling可能是空白节点,除非两个HTML标签之间没有任何形式的空格。

3、IE下可以用document.frames("name").document的方式取得frame中所嵌页面的document对象,FF下却会得到null,解决的的办法是document.getElementById(framename).contentWindow.document,也可以使用
window.frames[frameName].document 直接获取frame里的document对象


最后推荐一篇文章:Javascript的IE和Firefox兼容性汇编
posted @ 2007-03-29 15:06 Juliashine 阅读(732) | 评论 (0)编辑 收藏

2006年12月21日

在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 阅读(416) | 评论 (0)编辑 收藏
 
         The URL extension to use to determine if the request is meant for a Struts action 
           用URL扩展名来确定是否这个请求是被用作Struts action,其实也就是设置 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自动加载的一个配置文件列表

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的完整连续的package名称

struts.custom.i18n.resources
          Location of additional localization properties files to load 
           加载附加的国际化属性文件(不包含.properties后缀)

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


struts.devMode
          Whether Struts is in development mode or not
           是否为struts开发模式

struts.dispatcher.parametersWorkaround
          Whether to use a Servlet request parameter workaround necessary for some versions of WebLogic
            (某些版本的weblogic专用)是否使用一个servlet请求参数工作区(PARAMETERSWORKAROUND)

struts.enable.DynamicMethodInvocation
          Allows one to disable dynamic method invocation from the URL
            允许动态方法调用

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
           国际化信息内码

struts.i18n.reload
          Whether the localization messages should automatically be reloaded
           是否国际化信息自动加载 

struts.locale
          The default locale for the Struts application
           默认的国际化地区信息

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请求信息的最大尺寸(文件上传用) 

struts.multipart.parser
          The org.apache.struts2.dispatcher.multipart.
          MultiPartRequest parser implementation for a multipart request (file upload) 
          专为multipart请求信息使用的org.apache.struts2.dispatcher.multipart.MultiPartRequest解析器接口(文件上传用)


struts.multipart.saveDir
          The directory to use for storing uploaded files 
           设置存储上传文件的目录夹

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

struts.objectFactory.spring.autoWire
          Whether Spring should autoWire or not
           是否自动绑定Spring

struts.objectFactory.spring.useClassCache
          Whether Spring should use its class cache or not
           是否spring应该使用自身的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过滤器中提供的静态内容应该被浏览器缓存在头部属性中

struts.serve.static
          Whether the Struts filter should serve static content or not 
           是否struts过滤器应该提供静态内容

struts.tag.altSyntax
          Whether to use the alterative syntax for the tags or not 
           是否可以用替代的语法替代tags

struts.ui.templateDir
          The directory containing UI templates
           UI templates的目录夹 

struts.ui.theme
          The default UI template theme
           默认的UI template主题

struts.url.http.port
          The HTTP port used by Struts URLs
           设置http端口

struts.url.https.port
          The HTTPS port used by Struts URLs 
           设置https端口

struts.url.includeParams
          The default includeParams method to generate Struts URLs 
          在url中产生 默认的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模版应该被缓存
posted @ 2006-12-21 15:11 Juliashine 阅读(534) | 评论 (0)编辑 收藏

2006年12月15日

Struts2 发布已经很长时间了,一直没有顾得上学习,本周工作比较轻松,花点时间照着例子做了一下,但是在与Spring 集成的时候出现问题,action找不到Spring中定义的bean,折腾了两个多小时才最终搞定,决定把心得记录下来。

Struts2 集成 Spring 的 Web.xml 最简配置

<? 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目录下,且配置文件采用默认命名applicationContext.xml,如果Spring配置文件没有放在WEB-INF下或者采用了自定义名称,则Web.xml应该如下定义:

<? 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 >

注意这里比上个配置多出的项

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

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

注意,这还没完,CLASSPATH下有个struts.property文件,必须在里面添加一行内容:
(我就是缺了这个导致action找不到bean)

struts.objectFactory = spring  

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

<beans default-autowire="autodetect">   

  …… ……

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

posted @ 2006-12-15 17:04 Juliashine 阅读(417) | 评论 (0)编辑 收藏

2006年12月12日

ROC曲线(Receiver Operating Characteeristic Curve)是显示Classification模型真正率和假正率之间折中的一种图形化方法。

解读ROC图的一些概念定义::

真正(True Positive , TP)被模型预测为正的正样本
假负(False Negative , FN)被模型预测为负的正样本
假正(False Positive , FP)被模型预测为正的负样本
真负(True Negative , TN)被模型预测为负的负样本

真正率(True Positive Rate , TPR)或灵敏度(sensitivity) 
   TPR = TP /(TP + FN) 
   正样本预测结果数 / 正样本实际数
假负率(False Negative Rate , FNR) 
   FNR = FN /(TP + FN) 
   被预测为负的正样本结果数 / 正样本实际数
假正率(False Positive Rate , FPR) 
   FPR = FP /(FP + TN) 
   被预测为正的负样本结果数 /负样本实际数
真负率(True Negative Rate , TNR)或特指度(specificity) 
   TNR = TN /(TN + FP) 
   负样本预测结果数 / 负样本实际数

目标属性的被选中的那个期望值称作是“正”(positive)

ROC曲线上几个关键点的解释:

( TPR=0,FPR=0 ) 把每个实例都预测为负类的模型
( TPR=1,FPR=1 ) 把每个实例都预测为正类的模型
( TPR=1,FPR=0 ) 理想模型

此处图像以后再补

一个好的分类模型应该尽可能靠近图形的左上角,而一个随机猜测模型应位于连接点(TPR=0,FPR=0)和(TPR=1,FPR=1)的主对角线上。

ROC曲线下方的面积(AUC)提供了评价模型平均性能的另一种方法。如果模型是完美的,那么它的AUG = 1,如果模型是个简单的随机猜测模型,那么它的AUG = 0.5,如果一个模型好于另一个,则它的曲线下方面积相对较大。

Oracle 论坛上对ROC 的解释
http://forums.oracle.com/forums/thread.jspa?threadID=415870&tstart=15
posted @ 2006-12-12 14:25 Juliashine 阅读(1820) | 评论 (0)编辑 收藏
仅列出标题