10月16日面试总结

---恢复内容开始---

1 编程:   给出两个文件的绝对路径: A:   /home/a/b/c     B:   /home/a/x/y/z/d  

求B相对于A的相对路径:    ../../a/x/y/z/d

def getRelativePath(p1,p2):
	p1list=p1.split('/')[1:]
	p2list=p2.split('/')[1:]
	print p1list,p2list
	n1=len(p1list)
	n2=len(p2list)
	
	comindex=0
	minn=min(n1,n2)
	while(comindex<minn and p1list[comindex]==p2list[comindex]):
		comindex+=1
	
	if comindex==n1:
		return '/'.join(p2list[comindex:])
	else:
		return '../'*(n1-comindex)+'/'.join(p2list[comindex-1:])
p1='/a/b.php'
p2='/a/b/d/x/c.php'
#p2='/home/a/b/c'
print getRelativePath(p1,p2)

2 linux命令:

  查看进程:

ps -ef | grep java

查看进程中所有java的进程信息

ps -aux | grep java 显示所有状态

kill -9 PID   强迫进程立即停止

查看端口占用:

一: lsof -i:80

二: netstat -tunlp|grep:80

查看日志命令

tail -n 50 -f error.log

显示 日志最后50条,有新的时更新。

head -50 eorrorl.txt 显示日志前50条

查找关键字日志

grep 'INFO' demo.log

在demo中查找所有包含INFO的行。

 3  get 和post的区别

1  get提交的数据 用?分隔url和数据,用&分隔不同参数,如果是数字或字母原样发送,空格用+替换,是中文用base64编译,中16进制 ascII表示,

post提交数据 在http包内

2 get提交数据大小有限制 ,限制 为url的长度,post 没有限制 

3由于get提交数据在url中,所以不安全,post相对安全

4get能被缓存 ,post不能被缓存, 

5 get只允许 ascII字符,posts没有限制 ,允许二进制数据 

6 get 产生一个TCP数据 包,POST产生两个TCP数据 包

http://www.oschina.net/news/77354/http-get-post-different

---恢复内容结束---

原文地址:https://www.cnblogs.com/xqnq2007/p/7683315.html