ITeye博客

eyesmore's tech life

eyesmore · 共 120 篇文章

数据库中文显示不了,怎么办

数据库中文显示必须每个环节的字符集都支持中文,且一致。从本地SecureCRT到数据库总共经历了多少环节呢? 1、本机到虚拟window开发机 (由于windows都没问题); 2、虚拟window开发机到Linux虚拟机,走的是SecureCRT 设置: 选项->会话选项->外观->字符集编码->UTF-8 3、从Linux虚拟机到DB的跳板机,走的是SSH 设置:Linux机的locale得支持中文,比如zh-CN.UTF-8;但是由于机器的全局配置是en_US.UTF-8的。我们只能修改user级别的profile,因此编辑: #vi ~/.bash_profile (隐藏文件) 添加…

2014-08-15 16:22 · 评论(0)

mysql query cache

query_cache 读者摘要: http://blog.csdn.net/qiuyepiaoling/article/details/6004611 1、query_cache是server的查询缓存,跟存储引擎无关。当然存储引擎层也有查询缓存。 2、query_cache缓存的VALUE是“结果集”,而不是“页”。KEY是SQL语句,取HASH,如果SQL中含有子查询,也是作为整体Cache,而不会按子查询分别Cache。 3、内存与磁盘的读写速度差异是千倍级。直观的说:宁愿在内存中执行1000次,不要在磁盘上执行一次。 4、query_cache提高查询效率的2个原因:(1)内存读写…

2013-07-19 18:20 · 评论(0)

Java中double类型的数据精确到小数点后两位

转载: http://blog.sina.com.cn/s/blog_69bd73800100yaej.html 多余位四舍五入,四种方法 一: double f = 111231.5585; BigDecimal b = new BigDecimal(f); double f1 = b.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue(); 二: new java.text.DecimalFormat("#.00").format(3.1415926) 三: C风格,最方便 double d = 3.1415926;String result…

2013-01-24 10:36 · 评论(0)

Resin system-property tag works fine in Resin 4.X

The following issue has been CLOSED ====================================================================== http://bugs.caucho.com/view.php?id=5294 ====================================================================== Reported By: chinaliwee Assigned To: ferg =======================================…

2013-01-20 13:43 · 评论(0)

Firefox和Struts2在Date上干架

import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Map; import org.apache.struts2.util.StrutsTypeConverter; public class DateConverter extends StrutsTypeConverter { /* * http://blog.163.com/ztxz_179/blog/static/10520599520122575940933/ * 在cla…

2012-12-29 19:51 · 评论(0)

在 Servlet中获取Spring Bean

在 Servlet中获取Spring Bean,备忘 不解释 import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; public class HeartBeatServlet extends HttpServlet { private static final long serialVersionUID = 6165817221166007344L; private stat…

2012-12-29 16:13 · 评论(0)

备忘不解释:删除若干天前的文件

备忘不解释 #!/bin/bash export LANG="en_US.UTF-8" export SUPPORTED="zh_CN.UTF-8:zh_CN:zh:en_US.UTF-8:en_US:en" export SYSFONT="latarcyrheb-sun16" #delete files modified min 20 ago /usr/bin/find /opt/rsync/liveimg/eden/ -maxdepth 1 -type f -regex '/opt/rsync/liveimg/eden/.*\.jpg' -mmin +20 -delete;

2012-12-25 18:49 · 评论(0)

HTTP Basic Auth 备忘

http://wiki.nginx.org/HttpAuthBasicModule http://wiki.nginx.org/Faq#How_do_I_generate_an_htpasswd_file_without_having_Apache_tools_installed.3F location / { auth_basic "Restricted"; auth_basic_user_file htpasswd; } 命令1:auth_basic 表示使用HTTP Basic Auth,不是其他的Auth形式。 auth_basic "Restricted" 字符串仅仅是提示,作为H…

2012-12-14 15:41 · 评论(0)

Struts2/XWork < 2.2.0 Remote Command Execution Vulnerability

备忘下,TMD delicious现在都搞定老不爽了 。。。 riday, July 9, 2010 CVE-2010-1870: Struts2/XWork remote command execution Update Tue Jul 13 2010: Added proof of concept Apache Struts team has announced uploaded but has not released, due to an unreasonably prolonged voting process, the 2.2.0 release of the Struts2 w…

2012-11-07 18:07 · 评论(0)

Memcached内存管理的局限性导致尽量不能让KEY永远不过期

Memcached内存管理的局限性导致尽量不能让KEY永远不过期 http://blog.csdn.net/tenebaul/article/details/8141673

2012-11-02 17:41 · 评论(0)

Nginx的location if 太奇怪了

需要请求的图片,其中$station_id是变量 http://host/thumb/200x/$station_id.jpg http://host/thumb/160x/$station_id.jpg 为了容错,提供了两张默认图片,当$station_id对应的图片找不到的时候,用默认图片替代 http://host/thumb/notfound_160x.jpg http://host/thumb/notfound_200x.jpg 为此在Nginx里面配置: location ^~ /thumb/ { set $notfound "/thumb/notfound_160x.jpg";…

2012-10-23 18:55 · nginx&varnish · 评论(0)

Bash把一个时间戳转化成日期

继续备忘,老忘记,记忆不行了 比如:给定一个毫秒数 1350014340795 Bash 看日期 date -d @1350014340 [root@zw_79_195 ~]# date +'%F %T' -d @1350014340 2012-10-12 11:59:00 [root@zw_79_195 ~]#

2012-10-12 15:48 · 评论(0)

Hex Bytes

好些年前写的,偶然找出来,临时用下,顺便分享下~~ 性能好像不咋地 import java.io.ByteArrayOutputStream; public class UltraEdit { public static void main(String[] args) { System.out.println(UltraEdit.getInstance().getHexUpperCase(" 测试 & 数据 Test Data".getBytes())); System.out.println(UltraEdit.getInstance().b2HEX(" 测试 & 数据 Test Dat…

2012-09-19 11:41 · 评论(0)

分布式并发计数器:播放数统计MongoDB实现

分布式并发计数,以视频站点播放数统计为例(本质是{vid->count}映射关系),内容提要: Upsert+$INC解决并发计数 findAndModify解决写时返回结果 JAVA实现:findAndModify+upsert+$INC三剑客 谢绝ObjectId,用vid直接做_id (1)Upsert+$INC解决并发计数 第一点:第一次update的时候,提示“ok”;但是查询的时候,发现提示“ok”其实依然失败了。这点表现了MongoDB的fire-and-forget特性,默认情况下MongoDB不执行getLastError(),只管发送写请求,不等待写请求的响应,也就是不管…

2012-08-14 13:31 · 架构(scalability&availability) · 原创设计 · 评论(0)

iptables实现代理功能(不解释,备忘用)

cat forward.sh #! /bin/sh target_host=10.11.132.12 target_port=10086 forward_host=10.10.83.83 forward_port=8080 echo 1 > /proc/sys/net/ipv4/ip_forward /sbin/iptables -t nat -A PREROUTING -d ${target_host} -p tcp -m tcp --dport ${target_port} -j DNAT --to-destination ${forward_host}:${forward_port} …

2012-05-31 19:21 · 评论(2)