- 博客(74)
- 资源 (2)
- 收藏
- 关注
原创 MAT打开过大的dump:Java heap space OutOfMemory
当用mat分析过大的dump文件时,可能由于文件太大而mat的内存不足导致报错,Java heap space。 解决方法为: 1. 运行的时候指定vm参数,加大分配内存(如运行在64位机上) MemoryAnalyzer.exe -vmargs -Xmx4g -XX:-UseGCOverheadLimit在MemoryAnalyzer.ini中增加或编辑以下值: -vmargs -
2017-07-27 11:40:04 10584
原创 Git爬坑记录
提pr问题:提pr的时候检查了一遍与develop分支的区别,然后就没再留意了。等到merge的时候,与develop的内容发生了变化(develop的代码移动了位置),导致develop的两个文件被删掉了。 解决:重新提交了两个文件 总结:不止提pr的时候要检查diff,在merge之前更要检查一遍有没有冲突。push问题:在develop分支写代码,然后git操作的时候不小心直接push了,
2017-07-26 16:36:37 533
原创 idea 启动Class JavaLaunchHelper is implemented in both 。。。
Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/java (0x10eb364c0) and /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/
2017-07-26 16:34:00 5608
原创 spring @postConstruct init-method constructor和afterSetProperties() 执行顺序
示例代码:package com.spring.initbean;import javax.annotation.PostConstruct;import org.springframework.beans.factory.InitializingBean;import org.springframework.stereotype.Component;/** * created by anyan
2017-07-20 12:38:00 6611
转载 TCP协议连接和关闭详解
TCP是什么?TCP(Transmission Control Protocol 传输控制协议)是一种面向连接(连接导向)的、可靠的、 基于IP的传输层协议。TCP在IP报文的协议号是6。TCP是一个超级麻烦的协议,而它又是互联网的基础,也是每个程序员必备的基本功。首先来看看OSI的七层模型: OSI的七层模型我们需要知道TCP工作在网络OSI的七层模型中的第四层——Transport层,IP
2017-06-14 17:20:19 954
转载 转载【【分步详解】两个有序数组中的中位数和Top K问题 】
原文转自:【分步详解】两个有序数组中的中位数和Top K问题(这也是一道leetcode的经典题目:《LeetCode》解题笔记:004. Median of Two Sorted Arrays[H] 问题介绍这是个超级超级经典的分治算法!!这个问题大致是说,如何在给定的两个有序数组里面找其中的中值,或者变形问题,如何在2个有序数组数组中查找Top K的值(Top K的问题可以转换成求第k个元素的问
2017-06-07 15:29:09 570
原创 22.Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is: [ “((()))”, “(()())”, “(())()”, “()(())”,
2017-06-06 11:12:49 472
原创 计算1 到 N 之间 某个数字出现的个数
/** * by anyanwen * 一个自然数n,求0-n之间一共包含多少个2 * 如:1-30之间有2,12,20-29,一共13个 * 分别计算个位,十位,百位等上面2的个数,个位每10里面有一个2,十位每100里有10个2,百位每1000里有100个2,以此类推。。另外,当有余数的时候,如123%100 = 23, 那么这100-123个数还需要额外计算120,121,122,12
2017-06-05 16:30:23 1304
原创 编译openjdk8
首先下载openjdk源码,http://hg.openjdk.java.net/jdk8u,我是在centos7上进行编译的,下载解压后,去设置环境变量等东西。然后安装一个低版本的Boots jdk编译用,编译8那就安装jdk7,yum install java-1.7.0-openjdk-devel 环境变量: #!/usr/bin/env bash #语言选项,这个必须
2017-06-01 10:54:29 1167
原创 java运行class文件或jar文件
当需要用命令行运行一个class文件或者jar文件时,经常会报各种错误,这里总结一下操作需要注意的东西。classpath 运行class文件上时,java会从classpath去寻找对应的class,这时如果目录不包含要运行的class所在的目录,那么就会出现下面这个错误,这时候需要将环境变量的classpath中配置当前路径. 或者在运行命令 java后指定classpath: -class
2017-05-16 17:38:10 2751
转载 Netty精粹之轻量级内存池技术实现原理与应用
Netty精粹之轻量级内存池技术实现原理与应用-Float_Luuu在Netty中,通常会有多个IO线程独立工作,基于NioEventLoop的实现,每个IO线程负责轮询单独的Selector实例来检索IO事件,当IO事件来临的时候,IO线程开始处理IO事件。最常见的IO事件即读写事件,那么这个时候就会涉及到IO线程对数据的读写问题,具体到NIO方面即从内核缓冲区读取数据到用户缓冲区或者从用户缓冲区
2017-05-12 15:43:09 667
转载 Netty高性能开发备忘录
原文转自Netty高性能开发备忘录-春天的旁边1. 连接篇1.1 Netty NativeNetty Native用C++编写JNI调用的Socket Transport,是由Twitter将Tomcat Native的移植过来,现在还时不时和汤姆家同步一下代码。经测试,的确比JDK NIO更省CPU。也许有人问,JDK的NIO也用EPOLL啊,大家有什么不同? Norman Maurer这么说的:
2017-05-12 15:13:16 1072
转载 golang-new与make
作者:YY哥 出处:http://www.cnblogs.com/hustcat/ Go语言中的内建函数new和make是两个用于内存分配的原语(allocation primitives)。对于初学者,这两者的区别也挺容易让人迷糊的。简单的说,new只分配内存,make用于slice,map,和channel的初始化。new 这是一个用来分配内存的内建函数,但是与C++不一样的是,它并不初
2017-05-10 10:13:50 367
原创 21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.排序链表归并package leet//Definition for singly-linked list.type
2017-05-10 10:04:31 383
原创 20. Valid Parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “
2017-05-10 09:34:08 362
原创 19. Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked
2017-05-05 13:36:11 450
原创 17. Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string “23
2017-05-03 19:17:18 349
原创 golang 常见用法集合
获取string字符串长度 //字符串中字符全为ASCII中的字符 len(str) //字符串中含非ASCII的Unicode字符 utf8.RuneCountInString(str)string转int //string到int int,err:=strconv.Atoi(string) //string到int64
2017-05-03 17:59:44 1888
原创 16. 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly
2017-05-03 17:33:06 369
原创 15. 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain duplic
2017-05-03 11:42:06 369
原创 14. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. 找到string数组的相同的字符串前缀java:public class Solution { public String longestCommonPrefix(String[] strs) {
2017-04-25 18:19:57 341
原创 13. Roman to Integer
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.Subscribe to see which companies asked this question.JAVA:public class Solution { public in
2017-04-20 19:46:12 300
原创 12. Integer to Roman
题目: Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.先介绍一下罗马数字: 罗马数字共有七个,即I(1),V(5),X(10),L(50),C(100),D(500),M(1000)。按照下面的规则可以表示任意正整
2017-04-01 11:49:17 307
原创 11. Container With Most Water
Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lin
2017-04-01 11:43:01 374
原创 关于`instance of` 在子类父类中的使用,个人的一个小测试
关于instance of 在子类父类中的使用,个人的一个小测试package com.test;/** * @Description * @Author anyanwen * @Date 2017/3/29. */public class InstanceTest { private static class Config{ } private static cla
2017-03-29 16:16:56 1218
原创 10. Regular Expression Matching
Implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element. The matching should cover the entire i
2017-03-27 09:19:12 452
原创 9. Palindrome Number
Determine whether an integer is a palindrome. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, note the restriction of
2017-03-22 09:39:47 295
转载 Java并发包:阻塞队列(BlockingQueue)
转载自:[Java并发包:阻塞队列(BlockingQueue)](http://blog.csdn.net/zxc123e/article/details/51837866)文章译自:http://tutorials.jenkov.com/java-util-concurrent/index.html 抽空翻译了一下这个教程的文章,后面会陆续放出,如有不妥,请批评指正。 转自请注明出处。Bl
2017-03-21 17:19:18 470
转载 Netty之ChannelOption
1、ChannelOption.SO_BACKLOG ChannelOption.SO_BACKLOG对应的是tcp/ip协议listen函数中的backlog参数,函数listen(int socketfd,int backlog)用来初始化服务端可连接队列,服务端处理客户端连接请求是顺序处理的,所以同一时间只能处理一个客户端连接,多个客户端来的时候,服务端将不能处理的客户端连接请求放在队列中等
2017-03-16 18:56:48 3831
原创 7. Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321 Have you thought about this? Here are some good questions to ask before coding. Bonus points for you if
2017-03-16 10:46:33 363
原创 6. ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I I GY
2017-03-15 10:33:15 328
原创 5. Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum Example:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Example:Input: "cbbd"Output: "bb"想
2017-03-14 16:06:58 325
原创 4. Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1:nums1 = [1, 3]nums2
2017-03-10 10:59:21 399
原创 3. longest substring
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with the le
2017-03-09 10:27:50 502
原创 2. Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
2017-03-08 10:20:35 654
原创 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same ele
2017-03-07 10:14:14 635
转载 IntelliJ IDEA的在线注册码
最近lanyu的license地址要过期了,发一个新的注册方法IntelliJ IDEA的在线注册码生成页面(仔细看该链接内容):http://idea.iteblog.com新的License server地址为:http://idea.iteblog.com/key.php
2017-02-23 10:29:25 1961
转载 Nginx/Netty/ZeroMQ网络模型
为啥会有线程或者进程模型这种东西,因为计算机CPU主频已经很难再提高了,现在更倾向于设计多核系统,那么要发挥现在计算机的处理能力,就需要将系统设计成支持多处理器的,最简单的那肯定就是多线程(进程)程序了。。。尤其是在网络编程中,特别是对于每个事物都是独立的情况下,例如没有会话的HTTP请求啥的,这种方式可以极大的提高程序的吞吐量和伸缩性。。。。当然,多线程,多进程的方式必然会增加程序设计的复杂性,尤
2017-02-14 12:17:03 2559
原创 Shell脚本知识整理
shell脚本以.sh为后缀,执行于linux或unix环境下,执行命令有./shellname.sh,sh shellname.sh, bash shellname.sh等。以./为执行方法时,实际上是试用shell中第一行指定的shell进行执行,如下所示。其中-e代表若shell脚本执行出错则推出脚本。若要调试脚本,可以在e后面加x参数,控制台会单步显示执行结果。 #!/bin/bash -
2017-02-14 11:28:18 575
重构 改善既有代码的设计 高清版
2017-08-31
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人