http协议1.0 1.1区别.
1,http1.0: tcp短连接,一个http每次请求完全分离
http1.1 持久连接,多个请求可在一个tcp连接中并行处理。
既是:http头Connection: keep-alive参数的作用
2,http头版本号不同。略过;
3,http1.1 在http头添加host参数,支持一台WEB服务器上可以在同一个IP地址和端口号上使用不同的主机名来创建多个虚拟WEB站点。
具体看rfc1945/rfc2616文档。唉。
tcp通讯过程
这张图,每次都问,问了不懂,看你一遍就明白,哎。
编程题目:JAVA遍历一个文件夹中的所有文件
在eclipse下面没问题,让我手写代码,那还是算了。
file dir = new file();
files[] files = dir.listFile();//这些方法怎么能手写
public void showFiles(File dir)
{
for(int i=0;i<files.length;i++)
{
System.out.pln(files[i].getAbsolutePath());
if(files[i].isDirectory())
{
showFile(file[i]);
}
}
}
设计模式:懒汉单例模式
private static Object o = new Object();
public static getO()
{
return o;
}
java多线程:
runnable,thread.
start(),run().
user表,id,name,city删除数据库中重复用户名数据
两个思路;
1, delete from user where id not in (select min(id) from user group by name)
2,找到重复次数大于1的b.id, 删除和b.id.name同名,id不同的数据
delete user as a from user as a , (select id,count(*) from user group by name where count(*)>1 ) as b
where a.name = b.name and a.id!=b.id;
查找重复的
select * from user group by name having count(*) >1
4,sleep和wait的区别有:
1,这两个方法来自不同的类分别是Thread和Object 2,最主要是sleep方法没有释放锁,而wait方法释放了锁,使得其他线程可以使用同步控制块或者方法。
5,ThreadLocal:https://my.oschina.net/huangyong/blog/159489
6,:http://www.cnblogs.com/xwdreamer/archive/2011/01/18/2297042.html
7,内存雪崩,内存穿透:http://www.cnblogs.com/jinjiangongzuoshi/archive/2016/03/03/5240280.html
http://www.infoq.com/cn/articles/distributed-storage-system-avalanche-effect/