- 博客(265)
- 资源 (10)
- 收藏
- 关注
原创 nginx配置
event配置worker_processes 4;events { use epoll; worker_connections 65535; accept_mutex off; multi_accept off;}服务器的连接配置keepalive_timeout 60;tcp_nodelay o...
2018-06-02 21:35:56
287
原创 Netty学习小记
Netty提供了方便快速的API用于搭建网络, 一下是我学习Netty后的一些小笔记Netty的线程模型 Netty使用React线程模型 具体Netty服务端的初始化如下public final class SecureChatServer { static final int PORT = Integer.parseInt(System.getProperty("p
2017-12-10 16:35:17
434
原创 Spring MVC annotation
Spring MVC 配置多个基于annotation的Controller时候 多个DispatcherServlet配置转发的的servlet-urlmap时候 DispatcherServlet 1, servletName = a, dispatcherServlet servlet-urlmap /a/*, 那么请求/a/user/get, 对应的Controller 的Requ
2017-08-10 20:39:50
386
翻译 MySQL在linux上的安装
下载MySQL二进制分发版本tar包 需要安装libaio的库shell> yum search libaio # search for infoshell> yum install libaio # install libraryshell> apt-cache search libaio # search for infoshell> apt-get install libaio1 #
2017-07-16 22:24:11
620
翻译 ActiveMQ学习笔记-消息特性
ActiveMQ消息属性消息属性 属性名 类型 默认值 描述 JMSDestination javax.jms.Destination 生产者set进去 发送消息目的地 JMSReplyTo javax.jms.Destination null 用户定义 JMSType String “” 用户定义
2017-05-20 23:01:05
2118
翻译 ActiveMQ学习笔记-分发策略
异步发送ActiveMQ默认的发送模式是异步发送,如果我们使用场景是非事务类型或者需要持久化消息,允许少量的消息丢失的话,推荐使用异步发送。同步发送需要增加ack的确认,这样子会增大时延和系统消耗。cf = new ActiveMQConnectionFactory("tcp://locahost:61616?jms.useAsyncSend=true");((ActiveMQConnectionF
2017-05-16 22:45:51
3522
1
翻译 ActiveMQ学习笔记目的地特性
组合目的地使用单一的虚拟目的地往目的地集合发送消息,用一个虚拟的队列网多个物理队列发送消息,这里使用到,这个特殊的分割符。// send to 3 queues as one logical operationQueue queue = new ActiveMQQueue("FOO.A,FOO.B,FOO.C");producer.send(queue, someMessage);
2017-05-15 21:46:37
1400
原创 51nod-加农炮
一个长度为M的正整数数组A,表示从左向右的地形高度。测试一种加农炮,炮弹平行于地面从左向右飞行,高度为H,如果某处地形的高度大于等于炮弹飞行的高度H(A[i] >= H),炮弹会被挡住并落在i - 1处,则A[i - 1] + 1。如果H <= A[0],则这个炮弹无效,如果H > 所有的A[i],这个炮弹也无效。现在给定N个整数的数组B代表炮弹高度,计算出最后地形的样子。 例如:地形高度A =
2017-05-09 21:53:09
460
原创 activemq-集群和主从模式 学习笔记
activemq主从模式与集群三种masterslave模式三种主从模式networkConnector模式activemq持久化comsumer特性destination特性消息分发策略消息特性message-features
2017-04-19 19:38:17
5984
原创 HTTP提交几种提交模式
get请求的时候,我们的参数直接反映在url里面,形式为key1=value1&key2=value2形式,比如:如果是post请求,那么表单参数是在请求体中,也是以key1=value1&key2=value2的形式在请求体中。通过chrome的开发者工具可以看到如下: 使用ajax提交的时候,要修改Content-Type 为json格式 同时使用JSON.stringify(jsonObj
2017-03-20 21:52:06
401
原创 leetcode:Assign Cookies
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-index on Wikipedia: “A scien
2017-02-26 00:10:52
272
原创 leetcode:H-Index II
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm?Show Hint public class Solution { public int hIndex(int[] citations) { if(
2017-02-25 23:32:55
280
原创 leetcode: H-Index
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-index on Wikipedia: “A scien
2017-02-25 23:20:54
239
原创 leetcode:235. Lowest Common Ancestor of a Binary Search Tree
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two
2017-02-22 23:40:24
240
原创 leetcode:39. Combination Sum
Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C
2017-02-22 22:59:34
215
转载 Java虚拟机启动参数详解
转载之博客园java启动参数共分为三类; 其一是标准参数(-),所有的JVM实现都必须实现这些参数的功能,而且向后兼容; 其二是非标准参数(-X),默认jvm实现这些参数的功能,但是并不保证所有jvm实现都满足,且不保证向后兼容; 其三是非Stable参数(-XX),此类参数各个jvm实现会有所不同,将来可能会随时取消,需要慎重使用;一 标准参数中比较有效的verbose -verbose
2016-12-30 14:45:54
883
原创 leetcode:85. Maximal Rectangle
Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area.For example, given the following matrix:1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0im
2016-09-23 22:34:31
305
原创 leetcode:399. Evaluate Division
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer do
2016-09-16 03:23:56
698
原创 leetcode: Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be construc
2016-08-28 14:49:11
411
原创 leetcode:Lexicographical Numbers
Given an integer n, return 1 - n in lexicographical order.For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9].Please optimize your algorithm to use less time and space. The input size may be
2016-08-28 14:36:07
502
原创 leetcode:First Unique Character in a String
Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.Examples:s = “leetcode” return 0.s = “loveleetcode”, return 2. 找出一个串里面第一个不重复的字母的下标
2016-08-28 14:11:45
403
原创 leetcode:Longest Absolute File Path
Suppose we abstract our file system by a string in the following manner:The string “dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext” represents:dir subdir1 subdir2 file.ext The directory di
2016-08-28 13:43:44
585
原创 leetcode:295. Find Median from Data Stream
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.Examples: [2,3,4] , the median is 3
2016-08-14 23:02:52
355
原创 tomcat
配置综述对tomcat服务器的配置,主要是指tomcat主目录下面conf文件夹下对各个配置文件的配置,包括用户权限访问控制,安全配置,集群配置,与HTTP服务器进行集成(Apache服务器,Nginx服务器等),JNDI资源的设置与访问等。以下是我个人学习tomcat.apache.org官网的一些笔记,或者是翻译。 配置文件可以描述为以下几种主要的目录: 1. Server:顶层元素
2016-08-02 23:13:48
585
转载 Linux防火墙的基本知识
本文转载之这里写链接内容一、防火墙的分类(一)、包过滤防火墙。 数据包过滤(packet Filtering)技术是在网络层对数据包进行选择,选择的依据是系统内设置的过滤逻辑,称为访问控制表(access control lable,ACL)。通过检查数据流中每个数据包的源地址和目的地址,所用的端口号和协议状态等因素,或他们的组合来确定是否允许该数据包通过。 包过滤防火墙的优点是它对用户来说是透
2016-08-02 22:50:08
561
原创 maven配置文件
maven工程下pom.xml一些常见配置常用插件配置 <build> <pluginManagement> <plugins> <!-- compiler插件, 设定JDK版本 --> <plugin> <groupId>org.apache.mav
2016-07-31 14:38:54
442
原创 Java泛型的类型擦除
JAVA的泛型是一种语法糖,当我们在新建一个容器类的时候,代码是这么编写的ArrayList<String> list = new ArrayList<String>();编译后的JAVA代码是等价于ArrayList list = new ArrayList();当中String的信息是不会带入到list中的, list的存放的东西都是Object类型,相当于容器类的个体在编译后类型被擦除了。
2016-07-18 20:39:27
390
原创 Redis3自带的ruby脚本和cluster命令的使用
Resharding the cluster所谓的对集群数据进行分片,就是把实例节点的一些hash桶转移到其他实例节点。我们使用ruby脚本进行分片: ./redis-trib.rb reshard 127.0.0.1:7000我们需要提供一个节点的ip跟端口用于定位redis集群,redis-trib.rb将会自动寻找集群中的其他节点,键入命令后,会提示我们要转移多少数据 How man
2016-07-17 15:17:56
1329
翻译 Redis3Cluster的学习笔记
redis3集群模式下的一些好处这是官方给出的:RedisCluster提供了数据在多个redis实例中分片的方式,automatically sharded across multiple Redis nodes。Redis在数据分片上提供了一定的可用性,在某些节点宕机或者无法连接时候提供了支持。(除非大多数的主redis服务都不可用): 数据自动分片在多实例中 当少数实例宕机时候仍
2016-07-07 23:20:07
1520
原创 hihocoder: 题外话·堆
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述小Ho有一个糖果盒子,每过一段时间小Ho都会将新买来的糖果放进去,同时他也会不断的从其中挑选出最大的糖果出来吃掉,但是寻找最大的糖果不是一件非常简单的事情,所以小Ho希望能够用计算机来他帮忙计算这个问题!提示:吃糖果吃多了会变胖的!输入每个测试点(输入文件)有且仅有一组测试数据。在一组测试数据中:第1行为1个整数N,表
2016-06-19 00:51:08
327
原创 hihocoder:Lost in the City
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi gets lost in the city. He does not know where he is. He does not know which direction is north.Fortunately, Little Hi has a map of the city. The map
2016-06-19 00:50:01
371
原创 leetcode:Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an array.Example: For num = 5 you sh
2016-04-21 23:28:34
306
原创 leetcode: Longest Increasing Path in a Matrix
找出一个矩阵中最长的递增序列,求出最长长度是多少 Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diago
2016-01-31 12:22:57
392
原创 leetcode:Additive Number
给出一串数字字符串,比如”112358”,它可以这样子构造 1 + 1 = 2, 1 + 2 = 3, 2 + 3 = 5, 3 + 5 = 8;“199100199” 1 + 99 = 100, 99 + 100 = 199 存在如下的限制 比如字符串1023 不能构成 1 + 02 = 3的形式,前面不能有前导0直接暴力搜索。深度优先import java.math.BigDecimal
2016-01-22 22:22:35
369
原创 leetcode:House Robber
给出一个数组,求出给数组的不连续相连数字的最大和 基础的dp题目使用dp[][i]表示数组下标为i的最大不连续和 其中dp[0][i]表示不取下标i的值 dp[1][i]表示取下标i的值 可以得到状态转移方程 dp[0][i] = max(dp[0][i-1], dp[1][i-1]) dp[1][i] =dp[0][i-1] + nums[i]public class Solution
2015-11-08 23:58:23
334
原创 leetcode:Missing Number
一个无序排序的数字在1-n的范围内,但是其中却少了一个数字,求出其中的一个直接用异或运算a^b=c可以知道b = c ^ a 或者 b = a ^ c满足交换律public class Solution { public int missingNumber(int[] nums) { int total = 0, k = 0; for(i
2015-11-08 22:58:15
338
转载 在Mac OS X编译安装Apache
本文转载于http://www.bicky.me/blog/archive/building-apache-and-php-on-os-x/Apache 2.2.27和PHP 5.5.12在Mac OS X 10.8.5编译安装过程: 在开始之前首先升级Xcode的组件: preferences => Downloads => 下载Command Line Tools包然后进入Apache的源码包
2015-11-01 22:37:26
1869
原创 linux svn服务器搭建笔记
自己申请了了一台DigitalOcean的服务器,用于平时个人玩着来用,搭了一个svn服务器,linux的发行版本是ubuntu使用一下svn这个命令,没有的话使用下面命令进行下载apt-get install subversion建立一个svn的存储目录svn create /home/svn这样子,会在/home/svn目录下面新建一些文件,这是svn的一些配置文件关注
2015-10-18 20:50:30
411
翻译 commons-pool的学习
在一些缓存,数据库的操作中总能看到commons-pool包的身影,从理论上,对一些实例化的成本的对象进行缓存,需要的时候从缓存池中拿出,可以降低应用的运行成本,提高效率,但是具体到实际中代码怎么实现,也是一知半解,简单阅读了apache官网的commons-pool的referrence,结合别人的理解,做一下笔记。从对象的角度看,commons-pool提供了两个基本的接口,PooledOb
2015-09-12 16:12:38
1479
原创 redis conf文件解释
redis里面的 的内存参数 1k = 1000bytes 1kb = 1024byte 1m = 1000000byte 1mb = 1024 * 1024 byte 其中MB,mB,mb,Mb代表的意思都是一样的 1 daemonize no 是否以守护线程的形式运行redis,默认为false 2 pidfile /var/run/redis.pid 运行后的redis的pi
2015-09-10 00:20:24
444
axis2与spring集成
2015-05-14
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人