- 博客(45)
- 资源 (4)
- 收藏
- 关注
原创 浅谈Git与SVN的使用感受
作为版本控制工作,两者的做大的区别应该在于:Git属于分布式版本控制工具,而SVN属于集中式的版本控制工具。分布式的好处是什么呢?举个例子来说,当你在火车上离线状态下编程工作,在某个阶段会需要先保存正确的代码状态(以便后续出问题时可以回滚),再开始后续的编码,这个时候Git就会发挥它的优势。因为它的分布式特性,可以同时拥有远程仓库和本地仓库,在火车上,即使不联网,也可以将程序的修改commit至本地
2015-08-10 22:54:16
1630
原创 Java Exception和Error的区别
Java中异常的抽象类是Throwable,在此基础上,派生出两大类:Error和Exception。Error是程序中的严重错误,不应该用try…catch包括。Javadoc的说明如下: An Error is a subclass of Throwable that indicates serious problems that a reasonable application shoul
2015-07-19 16:47:56
1089
原创 Fail Fast与Fail Safe的区别
Fail FastFail Fast Iterator在遍历集合时,若该集合发生了结构性的改变,则将抛出 ConcurrentModification 异常。例如: Map<String, String> premiumPhone = new HashMap<String, String>(); premiumPhone.put("Apple", "iPhone");
2015-07-12 13:57:32
2677
原创 Iterator与Enumeration的区别
Iterator是一个接口,包含三个方法:hasNext()next()remove()Enumeration也是一个接口,它是一个遗留类,集合类中只有Vector和HashTable实现了该接口。它包含了两个方法: 1. hasMoreElements() 2. nextElement()由接口定义可知,Iterator在遍历时可以对元素进行删除操作,当遍历过程中,有其他线程对集合类的
2015-07-12 12:35:20
2823
原创 HashMap与HashTable的区别
同步与线程安全HashMap是不同步,是非线程安全的;而HashTable是同步,是线程安全的。该区别决定了他们的使用场景。HashMap适合在单线程模式下使用,而HashTable适合在多线程模式下使用。
2015-07-12 10:57:43
679
原创 Spring事务管理学习笔记
1. 主要接口介绍在Spring中,与事务相关的类或接口有以下三个:Ø TransactionDefinitionTransactionDefinition的作用是定义一个事务的属性,比如传播属性、隔离属性、超时属性等。Ø TransactionStatusTransactionStatus记录一个运行时的事务。Ø Platfor
2015-05-01 16:10:48
1350
原创 垃圾回收算法简介——JVM读书笔记<二>
垃圾回收的过程主要包括两部分:找出已死去的对象、移除已死去的对象。确定哪些对象存活有两种方式:引用计数算法、可达性分析算法。方案一:引用计数算法给对象中添加一个引用计数器,每当有一个地方引用它时,计数器值加1;当引用失效时,计数器值减1;计数器的值为0时即表明对象已经死去(可被回收)。优点:实现简单,判定效率高。缺点:难解决对象之间互相引用的问题。如:对象objA和
2015-03-14 22:36:45
981
原创 Java内存区域——JVM读书笔记<一>
Java虚拟机运行时数据区运行时数据区主要包括:方法区、堆、虚拟机栈、本地方法栈、程序计数器。其中方法区和栈是线程共享的区域,另外三块区域是每个线程私有的区域。各个数据区的功能简单说明如下:程序计数器:当前线程所执行的字节码的行号指示器。虚拟机栈:描述Java方法执行的内存模型——每个方法在执行的同时都会创建一个栈帧用于存储局部变量表、操作数栈、动态链接、方法出口等信息。每一个方法
2015-03-13 21:15:33
1065
原创 数据结构 二叉堆 & 堆排序
二叉堆,是一个满二叉树,满足堆的性质。即父节点大于等于子节点(max heap)或者是父节点小于等于子节点(min heap)。二叉堆的如上性质常用于优先队列(priority queue)或是用于堆排序。由于max heap 与min heap类似,下文只针对min heap进行讨论和实现。如上图,是根据字母的ASCII码建立的最小堆。我们用数组对满二叉树采用宽度优先遍历存储
2015-03-07 15:14:55
1282
翻译 Java垃圾回收
Java垃圾回收的步骤:标记(Marking)垃圾回收器标记堆中的对象,哪些依然被引用,哪些不再被引用。2. 删除(Deleting)删除不再被引用的对象3. 压缩(Compacting)压缩依然被引用的对象,使空闲的堆空间连接在一起,以便加快后续的空间申请若每一次垃圾回收器在标记过程中,将堆中的对象逐个遍历并对依旧使用的对象进行压缩
2015-03-06 15:30:56
882
原创 Search a 2D Matrix ——Leetcode系列(十八)
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted from left to right.The first integer of each
2014-09-24 15:29:29
834
原创 Sum Root to Leaf Numbers ——Leetcode系列(十七)
Sum Root to Leaf NumbersGiven a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents th
2014-09-10 22:31:01
877
原创 Gas Station——Leetcode系列(十六)
Gas Station Total Accepted: 14176 Total Submissions: 57777My SubmissionsThere are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car w
2014-07-08 10:18:01
836
原创 分配糖果问题——Leetcode系列(十五)
Candy There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must
2014-07-04 18:58:26
1401
原创 查找数组中只出现一次的数(一)——Leetcode系列(十四)
Single Number Total Accepted: 24874 Total Submissions: 55282My SubmissionsGiven an array of integers, every element appears twice except for one. Find that single one.Note:Your algor
2014-06-30 20:18:47
858
原创 深度复制链表——Leetcode系列(十三)
Copy List with Random Pointer A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the
2014-06-30 19:32:46
968
原创 判断字符串是否能分割成字典中的单词(二)——Leetcode系列(十二)
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens = "
2014-06-29 22:27:10
3450
原创 判断字符串是否能分割成字典中的单词(一)——Leetcode系列(十一)
Word BreakGiven a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetco
2014-06-22 19:04:53
4148
原创 查找列表是否含有环(二)——Leetcode系列(十)
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?Proof:
2014-06-18 13:53:29
830
原创 查找列表是否含有环(一)——Leetcode系列(九)
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?My Answer:/** * Definition for singly-linked list. * class ListNode { *
2014-06-16 10:42:11
759
原创 列表重新排序——Leetcode系列(八)
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to
2014-06-13 14:58:14
823
原创 使用迭代法对二叉树进行前序遍历——Leetcode系列(七)
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti
2014-06-11 09:53:25
1141
原创 使用迭代法对二叉树进行后序遍历——Leetcode系列(六)
Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,1].Note: Recursive solut
2014-06-10 21:15:43
913
原创 使用插入排序算法对列表进行排序——Leetcode系列(五)
Sort a linked list using insertion sort.My Answer:
2014-06-09 14:08:54
1054
原创 使用快速排序算法对列表进行排序——Leetcode系列(四)
Sort a linked list in O(n log n) time using constant space complexity.My Answer:
2014-06-08 14:29:55
2850
原创 同一直线上最多的点的个数——Leetcode系列(三)
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
2014-06-07 15:04:24
867
原创 逆序输出字符串的单词——Leetcode系列(二)
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Clarification:What constitutes a word?A sequence of non-spac
2014-06-06 14:01:07
1048
原创 计算逆波兰式——Leetcode系列(一)
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples:
2014-06-06 13:50:07
922
原创 Eclipse + Tomcat 配置
开发环境Eclipse For Java EE(Kepler Release)Tomcat(7.0)开发步骤点击Eclipse->Help->Install New Software..添加更新源:http://download.eclipse.org/callisto/releases/选中Web and J2EE Development并安装新建
2014-04-11 17:04:46
9672
原创 php文件管理工具——RESPONSIVE filemanager
RESPONSIVE filemanager 功能:文件上传 文件下载 重命名文件 删除文件 新建文件夹 为每个用户创建子目录 效果图参数设置$base_url 设置文件位置的基本路径
2014-04-09 16:36:37
13260
原创 NIS伺服器使用流程
作用:client 自动挂载server下的用户目录 server的用户可以登录client,并有读写权限 NIS 服务器端配置安装ypserv服务 yum install ypserv 设置domain域 查看服务器的NIS 域 nisdomainname新建一个domain域 nisdomainname domaintest如果要永久保存此domai
2014-03-28 09:28:00
9606
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人