- 浏览: 70983 次
- 性别:
- 来自: 北京
最新评论
文章列表
26. Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
For example,Given input array nums = [1,1, ...
27. Remove Element
Given an array and a value, remove all instances of that value in place and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
The order of elements can be changed. It doesn't matter what you leave beyond the ne ...
203. Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.
ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5
java实现
/**
* Definition for singly-linked list.
* public ...
Redis和Memcache对比及选择
- 博客分类:
- 缓存
没有必要过多的关注性能。由于Redis只使用单核,而Memcached可以使用多核,所以在比较上,平均每一个核上Redis在存储小数据时比Memcached性能更高。而在100k以上的数据中,Memcached性能要高于Redis,虽然Redis最近也在存储大数据的性能上进行优化,但是比起Memcached,还是稍有逊色。说了这么多,结论是,无论你使用哪一个,每秒处理请求的次数都不会成为瓶颈。
你需要关注内存使用率。对于key-value这样简单的数据储存,memcache的内存使用率更高。如果采用hash结构,redis的内存使用率会更高。当然,这些都依赖于具体的应用场景。
...
1. jstat -gc pid
可以显示gc的信息,查看gc的次数,及时间。
其中最后五项,分别是young gc的次数,young gc的时间,full gc的次数,full gc的时间,gc的总时间。
2.jstat -gccapacity pid
可以显示,VM内存中三代(young,old,perm)对象的使用和占用大小,
如:PGCMN显示的是最小perm的内存使用量,PGCMX显示的是perm的内存最大使用量,
PGC是当前新生成的perm内存占用量,PC是但前perm内存占用量。
其他的可以根据这个类推 ...
上传时后台获取图片大小方法
- 博客分类:
- http上传
MultipartFile multipartFile = request.getFile("files[]");
BufferedImage bi =ImageIO.read(multipartFile.getInputStream()); if((bi.getWidth()>1080||bi.getHeight()>1920)){ throw new Exception("像素太大"); }
mysql list 遍历
- 博客分类:
- mysql list 遍历
在xml 直接遍历
and h.hotel_id in
<foreach collection="hotelNoList" item="hotelNoList" open="(" separator="," close=")">
#{hotelNoList}
</foreach>
url传递json对象
- 博客分类:
- json
url :ticketSystem + "/order/cancelMainOrderFromBackend?info={'mainRef':' + mainRef+ '','terminalSn':''+terminalSn+'','cinemaId':''+cinemaId'}",
拼写url的时候一直出错,故记录一下,以后可以参考,其调用是采用ajax实现,url拼写不正确时,整个方法是调用不到的
var flag=$.ajax({
dataType: 'jsonp',
type : 'get',
url : ctx + '/ord/rebackOrder/backOrder?mainRef=' + mainRef,
jsonp: "callback",//传递给请求处理程序或页面的,用以获得jsonp回调函数名的参数名(默认为:callback)
jsonpCallback:"success_jsonpCallback",
success : function(data){
...
Ajax跨域(jsonp) 调用JAVA后台
- 博客分类:
- jsonp
1. JSONP定义 JSONP是英文JSON with Padding的缩写,是一个非官方的协议。它允许在服务器端生成script tags返回至客户端,通过javascript callback的形式来实现站点访问。 JSONP是一种script tag的注入,将server返回的response添加到页面实现特定功能。2.JSONP由来
要解释JSONP的来由,先要说一下浏览器的“同源策略(SOP:Same Origin Policy)”。 简而言之,就是浏览器限制脚本程序只能和同协议、同域名、同端口的脚本进行交互,这包括共享和传递变量等。cookie的传递也是遵从同样策 ...
My97DatePicker控件显示时分秒
- 博客分类:
- 前段控件
1,直接在input中实现
<input type="text" id="d241" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" class="Wdate" style="width:150px"/>
2,在WdatePicker.js中修改
dateFmt:"yyyy-MM-dd",
realDateFmt:"yyyy-MM-dd",
real ...
mysql怎么终止当前正在执行的sql语句
- 博客分类:
- mysql
show processlist;
找出你要停止的语句
然后找出你要终止的语句的id
在系统下mysqladmin -uroot -ppassword kill 要杀的ID
java 邮件 main方法实现
- 博客分类:
- java mail
public static String username="z63as"; 发送者的用户名
public static String password="%"; 发送者的密码
public static String FromAddress = "z63as@126.com"; 发送地址(从rs中得到)
public static String toAddress = "z63as@qq.com"; 发送地址(从rs中得到)
public stati ...
前段采用bootstrap框架,后台采用jeesite框架
下拉框级联问题,城市当选择北京市,影城出现北京下影城,选择北京下某个影城
当城市改为天津时,影城选中的仍然是北京某个影城具体如图1111和2222所示
$('#cinemaSelect').trigger("liszt:updated");
// $('#cinemaSelect').chosen();
采用jquery这些方法都不行,甚至采用jquery chosen框架也不行
问题解决方案:
$(".chzn-select") ...
1,服务器配置
server.xml配置 在Host中配置
<Context path="/Upload" docBase="/home/dadi-uat/apache-tomcat-7.0.67-backend/Upload/" debug="0" reloadable="true"></Context>
web.xml配置 默认false 改为true
<init-param>
<param-name>listings< ...