Linux输入输出重定向
小技巧,备记
JDK7集合框架源码学习-ArrayDeque
参考:http://www.jianshu.com/p/ca06a33f143chttp://brokendreams.iteye.com/blog/1918475先看allocateElements函数
三向切分的快速排序和优化
public class Sort{ public static void main(String[] args){ Integer[] data={100,20,21,28,22,26,80,33,3,2,9,8,7,10,77,66,99,96,91,94}; BaseSort...
二叉堆优先队列
public class MaxPQ <Key extends Comparable<Key>> { private Key[] pq; private int N=0; public MaxPQ(int maxN){ pq=(Key[])new Comparabl...
快速排序
public class Sort{ public static void main(String[] args){ Integer[] data={100,20,21,28,22,26,80,33,3,2,9,8,7,10,77,66,99,96,91,94}; BaseSort...
查看主机串号
dmidecode | grep -A 5 "System Information"
归并排序
MySQL内存使用
转载自:http://dev.mysql.com/doc/refman/5.6/en/memory-use.html#!/bin/shmysql -e "show variables; show status" | awk '{VAR[$1]=$2}END {MAX_CONN = VAR["max_connections"]MAX_USED_CONN = VAR["Max_used_connections"]...
希尔排序
public class Sort{ public static void main(String[] args){ Integer[] data={3,2,9,8,7,10}; BaseSort s=new Shell(); &n...
选择排序和插入排序
publicclass main(String[] args){ 3298710 BaseSort s= Insertion(); s.sort(data); &nb...
MySQL大量使用swap文件
现象: 一台高配的MySQL数据库服务器,双CPU48线程. CentOS 7 本机磁盘是一万五千转的Raid 0.系统文件,Swap都分配在了本机磁盘. 服务器挂载了一个SSD的磁盘阵列.数据库文件都存放在磁盘阵列中. 系统运行之后,发现系统Swap大...
理解Java线程的中断
线程中断三方法public void Thread.interrupt()public boolean Thread.isInterrupted()public static boolean Thread.interrupted()转载自:http://blog.csdn.net/sunxing007/article/details/9123363一个线程在未正常结束之前, 被强制终止是很危险的事情. 因为它可能带来完全预料不到的严重后果. 所以你看到Thread...
JDK7集合框架源码学习-ArrayList(4)SubList
源码镇楼public List<E> subList(int toIndex) { return this, } static int fromIndex, int size) { 0) n...
内部类总结
Out { privateint12 //内部类 In { publicvoid System.out.println(ag...
JDK7集合框架源码学习-ArrayList(3)迭代器
ArrayList实现了ListIterator接口public extends Iterator<E> { E next(); E previous(); int previo...
JDK7集合框架源码学习-ArrayList(2)迭代器
classimplements <> cursor// index of next element to returnint= 1// index of last element returned; -1 if no suchint=;public hasNext) &n...
MySQL JDBC row_count()数字不准确的问题
实验环境.create bigint null comment bigint null comment smallint '关注状态.1表示有效,0表示取关', CreateTime not default '创建时间', UpdateTime not def...
JDK7集合框架源码学习-ArrayList(1)
整个ArrayList用的最多的就是System类提供的本地方法.public static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)和JDK6不一样,JDK7的ArrayList构造函数,创建的是一个没有任何元素的数组.而JDK6默认创建1...
ZooKeeper服务发现客户端--重连认证
前文:http://blog.itpub.net/29254281/viewspace-2108223/挖坑小王子这里面有大坑.由于线上都配置了ACL控制前文的代码,在Reconnection的时候,会有如下异常.2016-06-23 22:13:01 [ main-EventThread:23807640 ] - [ INFO ] State change: RECONNECTED2016-06-23 22:13:01 [ ConnectionStateManager-0:23807641 ] -...
向量时钟算法简介
先说一下需要用到的场景。我们在写数据时候,经常希望数据不要存储在单点。如,都可以同时提供写服务,并且都存有全量数据。而不管是写哪一个都不用担心数据写乱问题。但是现实场景中往往会碰到并行同时修改。导致和数据不一致。于是乎就有人想出一些解决策略。向量时钟算是其中一种。简单易懂。但是并没有彻底解决冲突...