- 博客(20)
- 收藏
- 关注
原创 缓存淘汰算法 —— LFU-Aging(Java实现)
Java实现,用HashMap保存key值 : 命中次数与上次命中时间。import java.util.*;public class LFUAgingMap extends HashMap { private static final int DEFAULT_MAX_SIZE = 3; private int maxSize = DEFAULT_MAX_SIZE;
2015-05-14 00:52:13 5503
原创 网页中实时查看服务器日志(websocket + node.js实现)
每当我需要查看linux服务器的日志时,我都需要通过SSH客户端访问,如果想让其他人也能查看日志,首先需要安装一个SSH客户端,然后设置连接信息,如果安全性高一点的,还需要额外在linux服务器上配置【查看日志用户】,表示权限仅限于查看日志。每增加一个人想查看日志,都需要重复这个步骤,并且大大降低了密码的私密性。所以如果能通过网页形式提供【实时查看日志】功能,就可以很好地避免了这些问题。
2015-01-26 09:54:56 10684 1
原创 Spring AOP使用限制
基于代理的AOP只会作用于public的方法。Due to the proxy-based nature of Spring’s AOP framework, protected methods are by definition not intercepted, neither for JDK proxies (where this isn’t applicable) nor for CGL
2015-01-14 14:57:02 1978 2
原创 JQuery Mobile实现滑动屏幕切换页面
完整示例代码: Multipage example Page 1 Go To Page 2 Page 2 Go Back To Page 1 $(docu
2015-01-06 09:51:07 14345
原创 mysqldump备份与恢复数据库
-- export all tables structure and datamysqldump -uroot -p db-name > /path/to/dump.sql-- export all tables structure and data, reset AUTO_INCREMENTmysqldump -uroot -p db-name | sed 's/ AUTO_
2014-12-19 14:38:23 638
转载 mysql基于查询结果批量插入和更新
One possible way to do this is to create a temporary table, insert the data into that, and then do 1 query with a join to insert the records that don't exist followed by and update to the fields tha
2014-11-14 15:18:25 9442
原创 Web项目中使用XML配置加载Spring及Spring MVC的组件
Spring MVC集成了Spring对象管理、约定大于配置(CoC)、函数式编程的思想以及现有MVC框架的特点于一身,成为Java领域Web项目中最流行的MVC框架。
2014-10-29 10:07:55 18310 1
原创 HttpClient文件上传
HttpComponents是一个HTTP工具集,其中HttpClient是HTTP客户端,可以充当浏览器的角色。用HttpClient API 实现文件上传的代码,网上有很多,不过很多用到了deprecated的方法。以下代码的HttpClient版本是4.3.1: CloseableHttpClient httpclient = HttpClientBuilder.cr
2013-11-11 17:31:55 3794
原创 软件开发素质列表
1、需求分析。经验问题,与客户接触的多了,分析需求多了,改需求多了,痛苦多次以后,需求分析的能力就提高了。参考阅读:软件是这样做出来的
2012-12-16 00:33:12 399
翻译 Exercise 3: Numbers And Math
python天然支持数字和数学运算。在Exercise 0启动python时,它已经提供了一个计算器环境>>> 25 + 3055>>> 55 / 69>>> 100 - 2575>>> 75 * 3 % 41在这一章,列出了所有的数字操作符:+ (plus) does addition- (minus) does subtraction/ (s
2012-04-08 17:46:33 403
转载 Exercise 2: Comments And Pound Characters
Comments is used to tell people what something does, and can also disable the parts of program which you need to remove temporarily.There are two ways to comment program:# first commentprint "f
2012-04-07 17:55:41 431
转载 Exercise 1: A Good First Program
The first program among programming language for beginner is Hello World program. You can print a string such as Hello World in this programming language.Hello World in python is very simple.All
2012-04-07 15:00:00 401
转载 Exercise 0: The Setup
This chapter teach us how to setup your python development environment varied platforms.My os is linux, python 2.7 and gedit are pre-installed and configured, so all i should do is just setup the pr
2012-04-07 10:25:55 329
原创 开始学习python
最近发现挺多想学的东西,c,php,lisp,python,之前也想学的,不过总是三天打鱼,两天晒网。我对我的这种状态已经极度厌恶,忍无可忍了,一定要改!好,就以python为起点,两个月内看完Learn Python The Hard Way这本书,它每一章就是围绕一个知识点做练习,所以要每天学一个知识点并做完练习。如果还能收获一点自己的心得或启发,那就更好了。OK,从今天开始,
2012-04-06 14:44:36 373
原创 日期类型比较
表:User ( id, createdOn ) ——(id,创建时间)situation #1查出所有创建时间在2011年9月1日之后的记录。# mysql (最简单了)select * from user where createdOn>'2011-09-01'# mysql的日期处理能力很强大,可以精确到年、月、日、时、分、秒、毫秒。# 例如:select
2011-10-27 14:00:45 507
原创 SimpleDateFormat语言环境
对于一个日期格式的字符串,比如"4 Sep 2011",怎么把它解析为一个日期类呢?很简单,用java.text.SimpleDateFormat对象的parse方法啊。String str = "4 Seq 2011";SimpleDateFormat sdf =
2011-09-26 13:35:27 2460 1
eclipse explorer
在myeclipse中有一个explorer的插件,可是eclipse却没有。在网上搜索了一下,有一些结果:类似于这样:用EasyExplorer插件,有了这个插件就可以很方便地打开资源文件所在的文件夹了.EasyExplorer 从 http://sourceforge.net/projects/easystruts 但是这个网址打不开,估计sourceforge没...
2011-03-17 17:46:56 73
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人