HttpServletRequestWrapper模拟实现分布式Session
HttpSession的内容都放在一个单独的Map中,模拟远程分布式Session。1.使用HttpServletRequestWrapper创建自定义Request2.使用动态代理包装自定义Request返回的HttpSession对象3.创建过滤器,使用自定义Request替换原有的Request对象。4.在Servlet中得到的HttpSession对象,写入和读取内容都假设通过远程Session服务器...
JSONP的例子
JSONP技术可以解决AJAX跨域请求的问题。 主要是使用script标签,请求一段JS脚本执行。
单例模式
单例模式,线程安全的三种方式1.JVM保证线程安全public class Singleton { public Singleton() { System.out.println("Singleton init.."); } ...
在两个数据库之间进行数据同步
OLAP的第一步就是从业务系统中抽取数据到数据仓库系统。除了ETL工具Kettle,也可以使用PL/SQL创建Source表,模拟业务系统的数据表。create table source as select sys_guid() id ,o.* from dba_objects o where rownum<1000;alter table source add constraint PK_source primary key (id);创建Target表,模拟数据...
维护树状数据
给定一个树,要求查询所有状态为"异常"的叶子节点的所有上级节点create table t as select employee_id id,manager_id pid ,'正常' status from hr.employees;update t set status='异常' where id in ('109','107');查询表数据如下.因为节点109,107状态为异常,所以需要查他们的所有上级节点...
给非空记录增加行号
create table t(a varchar2(10));insert into t values('b');insert into t values(null);insert into t values(null);insert into t values('a');insert into t values('e');insert into t values(null);insert into t value...
程序在Tomcat中的启动顺序
众所周知Tomcat有三种方式加载程序, 1.配置在Tomcat/conf/server.xml中 2.配置在Tomcat/conf/Catalina/localhost/下 3.将程序放置在Tomcat/webapps下 为了进行测试,新建一个War包,并创建一个监听器,这个监听器打印Con...
滑动订单问题
MySQL技术内幕148页订单表有两个字段,订单日期(按月)和订单数量,需要求每个月到一年以后间隔的订单总数。create table MonthlyOrders( ordermonth date, ordernum int, primary key (orde...
Bad Habits
You know, Frank looks terrible, but he won't do anything to get healthy. He is always smoking. He spends no time exercising. I see him eating unhealthy food everyday, and drinking beer after beer while he's doing it! Hmm, sounds bad. That's for sure. A...
Oracle闪回删除恢复误删数据
单位把程序做成了exe的安装包。安装包在初始化数据库的时候,会先drop所有的表,然后建表,最后插入数据。在开发用的数据库,一个同事加了一天班,给所有的表和字段都加了注释,估计是用于PD反向工程。但是不凑巧,第二天另外一个同事运行安装包直接把他的表覆盖了...大致过程如下,同事A:create table a(...
About Daily Routines(频率副词)
My days are very busy. I usually get up at six o'clock, but on the weekend I occasionally get up later, at seven o'clock. I leave for work at 7:30. I often make dinner when I get home from work at five o'clock. After dinner, I always do the dishes. I h...
SQL生成日历
http://jackywood.itpub.net/post/1369/127565一条SQL语句生成年历。select case when (new_yweek = min(new_yweek)over(partition by mon order by new_yweek)) then ...
使用Windows脚本进行逻辑备份
开发、测试和演示的数据库可以使用逻辑备份。首先,得到所有非系统用户,然后进行逻辑备份,最后删除过期的数据。backup.batrem 设置备份路径set backupdir=c:\tmp\rem 获取所有用户的列表@echo off@echo set echo off &nbs...
解决memory_target设置过小导致不能启动数据库的问题
我们的项目比较特殊,经常需要外出演示,领导觉得Oracle企业版过于庞大,让我们尝试一下OracleXE对资源的最低要求。看看我们古董级的电脑(512M 内存)能否运行我们的演示程序。但是我设置的memory_target过低,导致数据库不能启动了。解决过程如下,创建pfile,修改参数,然后使用pfile启动数据库。SQL> alter system s...
清除用户下所有的数据(清库)
我们的项目出于测试、演示或者研发自己觉得清爽的原因,经常需要清除数据库中的数据。但是表间定义了大量的外键关联,删除数据还需要遵从一定的业务关系,非常麻烦。我们的小伙伴通常都是Drop user xxx cascade;然后找到初始化脚本重新来过。其实可以在删除表数据之前,先禁用外键约束,删除之后,再启动约束。首先,...
使用数据泵导出DDL语句
数据泵可以导出dump文件的DDL语句。C:\\Users\\lihuilin>impdp lihuilin/xxxxxx directory=tmp dumpfile=test.dmp sqlfile=test.sqlImport: Release 11.2.0.1.0 - Production on 星期日 11月 10 23:29:50 2013Copyright (c) 1982, 2009, Oracle and/or its affiliates....
About "would rather"
Rob, What do you feel like doing tonight? Would you rather play on your PSP, or come with me to a video arcade?If it's OK with you Harry, I would rather stay in and play on my PSP.I was afraid you would say that. Why don't you want to go out?Video arcades are so noisy. And every time I go to one ...
About Prefer
I'm not lazy, but in my free time I don't like playing sports like football because they are so tiring, and I want to relax!I also don't like being with too many people. It's very stressful to go shopping with hundreds of people - and sometimes they can be a bit stupid!I prefer to do something rea...
About Personality
My best friend really needs a boyfriend - do you know anybody?OK, Tina - let me see....mmmmh....There's John.What's he like?Well, he's very kind and patient.Oh good - she's a really patient person, as well.And he's hardworking...Oh, She isn't so hardworking. Maybe not John, then.OK - Julian i...
Oracle Exp误导入系统帐号的补救方法
单位一个同事误把Exp导入了system帐号,但是系统已经运行了一段时间,数据需要保留,所以不能用源dmp文件重新初始化..解决过程如下1.确定误导入对象的范围2.表的处理3.其他对象的处理4.删除system帐号下误导入的对象初始化对象,并导入system帐号create table t1 as select rownum n from dual connect b...