ITeye博客

尘封的记忆

fenglingxuewqk · 共 46 篇文章

Listener中获取HttpServletRequest

要在Listener中获取HttpServletRequest,方法其实很简单: ServletRequestAttributes rervletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.currentRequestAttributes(); HttpServletRequest request = rervletRequestAttributes.getRequest(); 但是有一种情况要特别注意, 就是请求不是来自于DispatcherServlet/DispatcherPortlet,例如fi…

2015-03-27 15:24 · 评论(0)

Lucene 评分机制

1. tf(t in d) correlates to the term's frequency , defined as the number of times term t appears in the currently scored document d . Documents that have more occurrences of a given term receive a higher score. 2. idf(t) stands for Inverse Document Frequency. This value correlates to the inverse of…

2014-08-05 14:11 · 评论(0)

Spring BeanUtils.copyProperties使用心得

Spring的这个Util还是很好用的,它会自动过滤null的field而只copy有值的field。 不过有一点需要注意的是当我们处理Object中含有nested Object时,它对于nested Object只copy reference。所以我们对于这些nested Object做改动时就会影响到source object。

2014-07-29 16:48 · 评论(2)

ubuntu设置java环境变量

设置系统环境 Java代码 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-7u7/bin/javac 1 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-7u7/bin/java 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-7u7/bin/javaws 1 选择默认java Java代码 su…

2013-08-02 19:36 · Linux · 评论(0)

CAS +LDAP实现

1.编辑CAS下的deployerConfigContext.xml,注释其中的SimpleTestUsernamePasswordAuthenticationHandler验证Handler,添加以下代码: <property name="authenticationHandlers"> <list> <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" p:httpClient-ref="httpClient" /> <bean…

2013-07-24 19:26 · SSO · 评论(0)

CAS server搭建

1.用JDK自带的keytool工具生成证书: keytool -genkey -alias tomcat-server -keyalg RSA -keystore .keystore (其中:tomcat-server是证书别称,.keystore是证书名称,由部署人员自行配置) 然后根据提示输入相应的信息,包括keystore密码、first name/last name等等,对于first name/last name,需用域名或者主机名,不建议使用IP地址或者localhost。完成之后,会在当前目录路下生成一个名为.keystore的证书。 2.将证书与tomcat进行集成 编辑t…

2013-07-24 19:19 · SSO · 评论(0)

Matlab修改JVM heap size

1.在$MATLAB\bin\$ARCH路径下新建java.opts文件。 其中$MATLAB是根路径。$ARCH是系统架构。 或者执行文件的目录。 2.编辑java.opts文件。输入-Xmx1g 3.重启matlab,敲入java.lang.Runtime.getRuntime.maxMemory。显示最大内存改变,设置成功。

2013-06-27 16:32 · matlab · 评论(0)

JVM内存学习

1.freeMemory(),totalMemory(),maxMemory() java.lang.Runtime类中的 freeMemory(), totalMemory(), maxMemory()这几个方法的反映的都是 java这个进程的内存情况,跟操作系统的内存根本没有关系。 maxMemory()这个方法返回的是java虚拟机(这个进程)能构从操作系统那里挖到的最大的内存,以字节为单位,如果在运行java程序的 时 候,没有添加-Xmx参数,那么就是jvm默认的可以使用内存大小,client为64M,server为1G。如果添加了-Xmx参数,将以这个参数后 面的值为准。 tot…

2013-01-31 11:35 · java基础 · 评论(0)

matlab bug收集

Summary Redirecting a MATLAB file into matlab -nodisplay can cause "Type-ahead Buffer Overflow" errors Description One way to have MATLAB execute a MATLAB file on a UNIX system is to redirect that file into MATLAB with the command matlab -nodisplay < myMfile.m at the shell prompt. Depending on the …

2012-11-05 16:34 · 其他 · 评论(0)

Oracle Number 取值范围

1.0E-130 <= number <1.0E126. -1.0E126 < number <= -1.0E-130

2012-10-17 15:33 · 数据库 · 评论(0)

SimpleDateFormat的线程安全问题

SimpleDateFormat有线程安全问题。 在多线程的环境下,不使用SimpleDateFormat,或者不使用成员变量/静态成员变量的SimpleDateFormat。 Date formats are not synchronized. * It is recommended to create separate format instances for each thread. * If multiple threads access a format concurrently, it must be synchronized 在Sun自己的网站上。在sun的bug databa…

2012-06-07 11:00 · java基础 · 评论(0)

BeanUtils.describe() deal with collection

用BeanUtils.describe()时,发现Object的List变量没有正确的转化到Map中去,而是只取了List中的第一个成员。 不过只需要加入以下代码就可以了: BeanUtilsBean.setInstance(new BeanUtilsBean2()); ArrayConverter converter = new ArrayConverter(String[].class, new StringConverter(), 0); converter.setOnlyFirstToString(false); ConvertUtils.register(converter, St…

2012-05-10 14:55 · java基础 · 评论(0)

Quartz job 整理

1. 可以用web.xml初始化SchedulerFactory。 <servlet> <servlet-name>QuartzDBJobInitializer</servlet-name> <servlet-class>org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class> <init-param> <param-name>servlet-context-factory-key</param-name> <param-value>DBJobSchedulerFactory</param-value> </init-par…

2012-04-28 11:06 · 其他 · 评论(0)

[AWK] Issue of "record too long"

use gawk or /usr/xpg4/bin/awk to replace of /usr/bin/awk

2011-12-02 09:45 · Linux · 评论(0)

通过ApplicationContextAware获取bean

加载Spring配置文件时,如果Spring配置文件中所定义的Bean类实现了ApplicationContextAware 接口,那么在加载Spring配置文件时,会自动调用ApplicationContextAware 接口中的 public void setApplicationContext(ApplicationContext context) throws BeansException 方法,获得ApplicationContext 对象。 前提必须在Spring配置文件中指定该类。 public class SpringContextHolder implements Appl…

2011-11-11 11:12 · Spring · 评论(0)