solr搜索组件的配置

web.xml的配置: <!-- solr core的配置,也可使用jndi配置 --> <env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-value>/opt/solr/multicore</env-entry-value> <env-entry-type>java.lang.String</env-entry-type> </env-entry> ... <!-- 管理页面就会为/solr/admin/* --> <filter> <filter-name>SolrRequestFilter</filter-name> <filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class> <init-param> <param-name>path-prefix</param-name> <param-value>/solr</param-value> </init-param> <!-- If you are wiring ...  more

优化博客的访问速度

########################################### # @auth guoguo,tianjiaguo#tianjiaguo.com 2011-03-27 20:18 # 添加浏览器缓存及压缩文件传输 ########################################### 添加如下模块(mod_deflate ,mod_expires) /usr/local/apache2/bin/apxs -i -a -c ~/software/httpd-2.2.17/modules/metadata/mod_expires.c /usr/local/apache2/bin/apxs -i -a -c ~/software/httpd-2.2.17/modules/filters/mod_deflate.c 检查配置: LoadModule deflate_module modules/mod_deflate.so LoadModule expires_module modules/mod_expires.so 添加如下配置: <IfModule mod_expires.c> ExpiresActive On #ExpiresDefau...  more

给wordpress配置apache的ssl安全登录

查看系统安装openssl版本及支持的加密 openssl version -a openssl ciphers -v 生成证书 openssl genrsa -des3 1024 > server.key openssl rsa -in server.key -out server.key openssl req -new -key server.key -out server.csr openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 740 chmod 400 server.key # 查看 openssl x509 -noout -text -in server.crt 修改httpd-ssl.conf ... DocumentRoot "/home/wordpress/" ServerName www.tianjiaguo.com:443 ServerAdmin admin@tianjiaguo.com .... #SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLProtocol all -SSLv2...  more

freemark处理文本模板的方法

Java的Freemark处理文本模板的方法,此应该可用于发送邮件程序。 /** * project: guoguo * CryptoUtil.java 2011-2-18 上午10:02:39 * guoguo, tianjiaguo#tianjiaguo.com All right reserved. */ .... private static final Configuration configuration = new Configuration(); static { configuration.setEncoding(Locale.getDefault(), "UTF-8"); } /** * 2011-3-11 下午06:08:04 guoguo * @param data * @param templateStr * @return */ public static String processStringTemplate(Map<String, Object> data, String templateStr) { StringReader reader = new StringReader(templateStr); try { Template tem...  more

apache带查询参数转发设置

举个例子: RewriteCond %{QUERY_STRING} ^(.+)$ RewriteRule ^/guogou/(.+)/?$ /guogou/view-guogou.do?permalink=$1&$2 [QSA,PT] RewriteRule ^/guogou/(.+)/?$ /guogou/view-guogou.do?permalink=$1[L,PT] $("document").ready(function(){ prettyPrint(); $("pre.prettyprint").each(function(){ $(this).find("span").first().prepend(""+1+""); $(this).find("span br").each(function(i){ $(this).after(""+(i+2)+""); }); }); });   more

更改指定目录下所有的java文件的编码为UTF-8

修改指定目录下的所有java文件的编码,由GBK修改为UTF-8 @update 读文件时使用自定义的编码格式GBK /** * @author guoguo Email:tianjiaguo@tianjiaguo.com 2010-8-25上午09:15:32 * */ public class FileChange { public static void main(String[] args) { getListFiles("D:/java/com/tianjiaguo"); } public static void getListFiles(String path) { File file = new File(path); FileChange.listFile(file); } public static void listFile(File f) { if (f.isDirectory()) { if (f.getName().startsWith(".")) { return; } File[] t = f.listFiles(); for (int i = 0; i < t.length; i++) { ...  more

NoClassDefFoundError: antlr/ANTLRException报错问题的修改

使用subclass配置hibernate的时候,使用父类的service操作数据库时会报如下的错误,其原因是缺少一个jar包,引入antlr-2.7.6rc1.jar就没有问题了。 java.lang.NoClassDefFoundError: antlr/ANTLRException at org.hibernate.hql.ast. ASTQueryTranslatorFactory .createQueryTranslator( ASTQueryTranslatorFactory.java:35) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:72) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71) at org.hibernate.impl.AbstractSessionImpl.getHQLQuery...  more

jsp页面变态的问题

用这种方式引入jsp文件,可以使用父页面的属性,如request属性 <jsp:directive.include file="/commons/related-products.html" /> taglib有的时候不识别,这时可用jsp-config包括着它,下面代码同样设置了html文件为jsp文件,这样可避免html文件中汉字的乱码。 <jsp-config> <jsp-property-group> <url-pattern>*.html</url-pattern> <el-ignored>true</el-ignored> <page-encoding>UTF-8</page-encoding> </jsp-property-group> <taglib> <taglib-uri>http://www.tianjiaguo.com/tags</taglib-uri> <taglib-location>/WEB-INF/tld/guoguo.tld</taglib-location> </taglib...  more

Web app root system property already set to different value的处理

配置多个项目在同一个tomcat下的时候报如下错误 2010-5-26 16:54:42 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [web1/./] instead of [web2/./] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files! at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:132) at org.springfr...  more

SyntaxHighlighter的bug

如下代码在SyntaxHighlighter下有问题,会在代码后面增加一行“</grantedauthority></grantedauthority>”。还会改变代码内容,如下面的代码”</sec:authentication-manager>” CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT /admina/**=ROLE_SUPERVISOR,ROLE_ADMIN /** * guoguo-cas * GuoUserDetailsService.java * 2009-12-6 下午03:28:35 * @author guoguo, All right reserved. */ package com.guoguo.security.us...  more

eclipse配置Red5服务器

1:用eclipse的svn插件从http://red5.googlecode.com/svn/java/server/trunkcheck out项目。 2:配置目录test和src为source folder,用eclipse的ant插件执行all这个task,此时ant插件会从网上下载相关的项目构建需要的包,等待所有ant过程结束。 3:修改项目的library添加一个user library,在其中添加上根目录下lib中的所有jar文件(另:可能需要自己找一个spring test的jar文件,我配置的时候没有自动从网上下载这个包,可自己找一个添加进来,red5的test用到它了。) 4:修改根目录下的.bat文件(linux环境要修改的不是这个),比如:在red5.bat文件,我在这两个文件的SETLOCAL后面添加了两项,其文件开始就变成了: @echo off SETLOCAL s...  more

eclipse中跑tomcat的out of memory的处理办法

修改Open launch configuration中的VM arguments增加了红色字的配置 -Dcatalina.base="...\.metadata\.plugins\org.eclipse.wst.server.core\tmp1" -Dcatalina.home="E:\dev\apache-tomcat-5.5.25" -Dwtp.deploy="...\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps" -Djava.endorsed.dirs="E:\dev\apache-tomcat-5.5.25\common\endorsed" -server -XX:PermSize=500M -XX:MaxPermSize=800m 运行intellij出现内存错误时可配置vm参数:-Xms64m -Xmx512m SyntaxHighlighter.all();   more