- 博客(165)
- 资源 (2)
- 收藏
- 关注
转载 POJO和javabean的异同
什么是POJO 按照Martin Fowler的解释是“Plain Old Java Object”,从字面上翻译为“纯洁老式的java对象”,但大家都使用“简单java对象”来称呼它。POJO的内在含义是指那些没有从任何类继承、也没有实现任何接口,更没有被其它框架侵入的java对象。pojo和javabean的比较pojo的格式是用于数据的临时传递,它只能
2015-07-01 10:21:48
582
转载 Hashtable和HashMap的区别
1.Hashtable是Dictionary的子类,HashMap是Map接口的一个实现类;2.Hashtable中的方法是同步的,而HashMap中的方法在缺省情况下是非同步的。即是说,在多线程应用程序中,不用专门的操作就安全地可以使用Hashtable了;而对于HashMap,则需要额外的同步机制。但HashMap的同步问题可通过Collections的一个静态方法得到解决:Map C
2015-06-24 12:29:30
442
转载 MySQL执行计划解读
Explain语法EXPLAIN SELECT ……变体:1. EXPLAIN EXTENDED SELECT ……将执行计划“反编译”成SELECT语句,运行SHOW WARNINGS 可得到被MySQL优化器优化后的查询语句 2. EXPLAIN PARTITIONS SELECT ……用于分区表的EXPLAIN执行计划包含的信息 id
2015-05-07 16:01:31
398
转载 sql之left join、right join、inner join的区别
left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录 right join(右联接) 返回包括右表中的所有记录和左表中联结字段相等的记录inner join(等值连接) 只返回两个表中联结字段相等的行举例如下: --------------------------------------------表A记录如下:aID aNum1
2015-05-06 16:49:27
315
转载 TOMCAT内存溢出及大小调整
一、tomcat内存设置问题 收藏 在使用Java程序从数据库中查询大量的数据或是应用服务器(如tomcat、jboss,weblogic)加载jar包时会出现java.lang.OutOfMemoryError异常。这主要是由于应用服务器的内存不足引起的。这种异常常有以下几种情况(以下以tomcat环境为例,其它WEB服务器如jboss,weblogic等是同一个道理):
2015-03-26 14:30:24
396
转载 java.lang.OutOfMemoryError: Java heap space错误及处理办法
java.lang.OutOfMemoryError: Java heap space ===================================================使用Java程序从数据库中查询大量的数据时出现异常:java.lang.OutOfMemoryError: Java heap space在JVM中如果98%的时间是用于GC且可用的
2015-03-26 11:28:33
2061
转载 tomcat 大并发报错 Maximum number of threads (200) created for connector with address null and port 8080
1、INFO: Maximum number of threads (200) created for connector with address null and port 8091说明:最大线程数错误解决方案:使用线程池,用较少的线程处理较多的访问,可以提高tomcat处理请求的能力。使用方式:首先。打开/conf/server.xml,增加
2015-03-25 16:33:25
837
转载 四层负载均衡和七层负载均衡的区别
1. 四层负责均衡:是通过报文中的目标地址和端口,再加上负载均衡设备设置的服务器选择方式,决定最终选择的内部服务器与请求客户端建立TCP连接,然后发送Client请求的数据。由上图可知:在四层负载设备中,把client发送的报文目标地址(原来是负载均衡设备的IP地址),根据均衡设备设置的选择web服务器的规则选择对应的web服务器IP地址,这样client就可以直接跟此服务器建立T
2015-03-23 13:19:50
342
原创 运行bat文件,一闪而过的问题
因为现在项目组的web应用做的差不多了,所以需要用Jmeter对其进行相应的压力测试。但奇怪的事情发生了,按照说明配好环境变量后,点击jmeter.bat文件却得到一闪而过的结果。然后各种找原因,最终圆满解决。其实,问题的原因很简单,就是cmd的编码有问题,导致无法读取bat文件,从而出现一闪而过的现象。通过chcp 936这个命令把cmd的编码改成gbk后即可成功执行jmeter.bat了。
2015-03-10 13:35:36
17744
转载 Spring MVC和Struts2的比较
虽然说没有系统的学习过Spring MVC框架, 但是工作这么长时间, 基本上在WEB层使用的都是Spring MVC, 自己觉得Struts2也是一个不错的WEB层框架, 这两种框架至今自己还未有比较, 今天闲着没事干, 从网上找了一些资料, 再加上平时使用Spring MVC的感触来总结一下。Spring MVC PK Struts2我们用struts2时采用的传统的配
2015-02-02 13:10:32
403
转载 Hibernate和IBatis对比
项目也做过几个, 使用IBatis就做一个项目, 基本上都是使用Hibernate, 也只是知道几点关于这两个框架的区别, 今天闲着没事干, 从网上找了几篇文章, 做了一个简单的整理。网上关于这两个框架的比较也很多, 只是自己想把别人的东西拿过来整理一下, IBatis和Hibernate的比较。(非原创)Hibernate VS iBATIS简介Hibernate是当前最流行
2015-02-02 13:05:20
440
转载 Mysql create table tb as select 和create table tb like的区别
对于mysql的复制相同表结构方法,有create table as 和create table like 两种,区别是什么呢? create table t2 as select * from t1 where 1=2 ; 或者 limit 0;as创建出来的t2表(新表)缺少t1表(源表)的索引信息,只有表结构相同,没有索引。 create table
2015-02-02 10:39:57
747
原创 [LeetCode] Longest Valid Parentheses
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()",
2015-01-09 16:02:58
301
原创 [LeetCode] Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = "great": great / \ gr
2015-01-05 13:07:41
496
原创 [LeetCode] Word Break II
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 = "
2015-01-04 17:31:08
344
原创 [LeetCode] Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 if the array contains less than 2 elements
2015-01-03 21:22:56
827
原创 [LeetCode] Compare Version Numbers
Compare two version numbers version1 and version1.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and co
2015-01-03 15:10:11
792
原创 [leetCode] Fraction to Recurring Decimal
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.
2015-01-03 14:36:09
862
原创 [LeetCode] Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB class S
2015-01-02 15:21:33
356
原创 [LeetCode] Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next()
2015-01-02 14:57:13
1341
原创 [LeetCode] Excel Sheet Column Number
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ...
2014-12-31 15:42:31
458
原创 [LeetCode] Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.class Solution {public: int trailingZeroes(int n) { int
2014-12-31 15:25:59
497
原创 java.net.BindException: Address already in use: connect
用HttpURLConnection频繁连接Linux服务器时,出现了 java.net.BindException: Address already in use: connect 这个错误,说明端口冲突了。why?我明明每次连接后都会执行Connection.disconnect()这个操作。其实答案跟上篇博客差不多,都是TIME_WAIT在作怪,于是只有执行下Thread.sleep
2014-12-31 13:25:55
741
原创 频繁连接断开mysql出现的问题
今天写的程序需要频繁执行连接断开mysql这一操作,而且时间间隔又很短,于是乎出现了下面这个问题The driver was unable to create a connection due to an inability to establish the client portion of a socket.This is usually caused by a limit on the
2014-12-31 13:05:14
5406
原创 [LeetCode] Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 / \ 2 3Return 6.
2014-12-30 15:04:40
341
原创 [LeetCode] Populating Next Right Pointers in Each Node II
Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extr
2014-12-29 17:09:59
266
原创 [LeetCode] Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight forward. Could you devis
2014-12-29 16:27:48
399
原创 [LeetCode] String to Integer (atoi)
Implement atoi to convert a string to an integer.class Solution {public: int atoi(const char *str) { int i = 0,flag = 1; long long ans = 0; while(str[i] == ' ') i ++;
2014-12-28 21:58:41
338
原创 [LeetCode] Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.class Solution {p
2014-12-28 21:03:47
331
原创 [LeetCode] Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will be only one unique solution.A sudoku
2014-12-28 19:08:01
290
原创 [LeetCode] Surrounded Regions
Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region.For example,X X X XX O O X
2014-12-26 17:01:30
315
原创 [LeetCode] Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element
2014-12-26 14:13:43
302
原创 [LeetCode] Clone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each
2014-12-25 17:00:00
224
原创 [LeetCode] Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; *
2014-12-25 15:57:02
277
原创 [LeetCode] Construct Binary Tree from Preorder and Inorder Traversal
Given preorder and inorder traversal of a tree, construct the binary tree./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; *
2014-12-25 14:56:52
286
原创 [LeetCode] Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; *
2014-12-25 13:42:40
245
原创 [LeetCode] Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST./** * Definition for singly-linked list. * struct ListNode { * int val; * Lis
2014-12-25 13:36:34
284
原创 [LeetCode] Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1
2014-12-24 21:34:10
297
原创 [LeetCode] Populating Next Right Pointers in Each Node
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointer to point to its next right node. If t
2014-12-24 16:56:51
273
原创 [LeetCode] Sum Root to Leaf Numbers
Given 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 the number 123.Find the tota
2014-12-24 16:09:22
348
计算机组成运算器相关课件
2010-09-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人