- 博客(16)
- 资源 (8)
- 收藏
- 关注
原创 Exchange Seats
题目地址:https://leetcode.com/problems/exchange-seats/description/Mary is a teacher in a middle school and she has a table seat storing students’ names and their corresponding seat ids.The column id is con
2017-10-14 19:48:37 1022
原创 Count Numbers with Unique Digits
题目地址:https://leetcode.com/problems/count-numbers-with-unique-digits/description/Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10^n.Example: Given n = 2, return
2017-10-14 15:29:05 285
原创 Redis持久化方法
持久化即将数据存储在硬盘中,Redis为我们提供了两种持久化选项:一种叫快照(snapshoting),另一种叫只追加文件(append-only file,AOF)。快照(snapshoting)快照就是将某个时刻的数据持久化到硬盘。如果系统崩了,那么用户只是丢失最近一次生成快照之后更改的数据,之前的数据还是存在的。创建快照的几种方法:客户端向Redis发送BGSAVE命令创建快照。客户端向R
2017-10-08 10:16:46 610
原创 Spring中Bean的作用域(Scope)
在Spring 5.0中支持以下六种Bean的作用域: 范围 描述 singleton (默认)每个Spring IOC容器中一个Bean定义只有一个实例对象。 prototype 一个Bean定义可以有多个对象实例 request 一个HTTP请求创建一个Bean的实例,该作用域只在web-aware Spring ApplicationContext中有效。 s
2017-10-07 21:55:51 551
原创 Different Ways to Add Parentheses
原文地址:https://leetcode.com/problems/different-ways-to-add-parentheses/description/Given a string of numbers and operators, return all possible results from computing all the different possible ways to g
2017-10-07 17:30:24 222
原创 Integer Break
题目地址:https://leetcode.com/problems/integer-break/description/Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the m
2017-10-07 11:42:52 231
原创 Rotate Image
题目地址:https://leetcode.com/problems/rotate-image/description/You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note: You have to rotate the image in-plac
2017-10-07 10:27:30 246
原创 Perfect Number
题目地址:https://leetcode.com/problems/perfect-number/description/We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.Now, given an intege
2017-10-06 19:49:23 406
原创 大型网站CAP理论和BASE模型
CAP理论2007年7月,在PODC会议上Eric Brewer提出了著名的CAP理论,CAP分别代表的是Consistency,Availability,Partition-Tolerance三个短语的首字母,翻译成中文即数据一致性,数据可用性,分区耐受性。如图所示: Consistency:所有的节点在同一时刻看到的数据是一样的,也就是数据的一致性Availability:无论成功与否,都
2017-10-05 16:01:47 541
原创 Java中线程池的种类
因为线程的创建和销毁是一项十分消耗资源的操作,为了避免这种浪费,所以可以用线程池,Java中提供了4种线程池:newCachedThreadPoolnewCachedThreadPool创建一个可缓存线程池,理论上线程数目是没有什么限制的,其实最大数目是Interger.MAX_VALUE,如果线程池长度超过处理需要,可灵活回收空闲线程,若无可回收,则新建线程。适用于执行很多短期异步的小程序或者负载
2017-10-05 12:44:48 377
原创 分布式服务器中的Session(会话)管理
Session是用户使用网站服务过程中一个十分重要的数据对象,它是客户端与服务器进行交互的基础数据,如果在交互过程中出现错误,可能会导致十分严重的后果,所以会话管理在大型分布式网站中是十分重要的一个模块。那么如何才能实现高可用的会话管理呢?Session Replication(会话复制)如果是整个应用单台服务器的话,会话复制貌似用处不是很大,因为单台服务器挂了,会话再留着也没什么卵用了,但是多台服
2017-10-05 11:28:26 1343
原创 负载均衡常用算法
负载均衡在大型网站中应用已经是十分普遍了,它在大型网站中处理高并发请求扮演着十分重要的角色。那么负载均衡算法又有哪些呢,一下是一些常见的负载均衡算法:轮询法(Round Robin)轮询法基本上算是最简单的负载均衡算法了,它的思想就是不管啥情况,对所有的服务器节点全部按顺序来,将请求按照顺序轮流地分配到各个服务器上。这种算法会使每台服务器处理的请求是相同的,所以适合用于服务器硬件条件基本都相同的场景
2017-10-05 10:27:53 4272
原创 Spring动态代理用JDK还是用CGLIB?
切面编程是Spring中非常重要的一个模块,切面编程的实现原理是动态代理,那么动态代理又有两种实现方式,一种方法是直接实现JDK中的InvocationHandler接口,另一种方法是继承CGLIB。那么问题来了,这两种方法有啥区别呢,分别适用于什么情况呢?首先如果不是很清楚两者的区别的话,记住一般情况下InvocationHandler要比CGLIB要好就行了。如果目标对象的代理至少实现了一个接口
2017-10-04 17:27:59 7456
原创 Spring自动装配的方法
当我们用XML做元数据配置的时候,需要在<bean/> 标签中指定装配的方法,装配方法有四种:no,byName,byType,constructor。下来看看这是种方法到底是啥意思。no首先这是一个默认值,也就是说如果没有特别说明的话,那默认的装配方法就是no。no就是不装配。bean标识必须通过ref来定义,对于比较大的工程部署来讲就不太推荐改变默认设置了,因为明确指定需要更多的控制和透明度。b
2017-10-03 11:50:10 1064
原创 Spring自动装配的优缺点
自动装配(也就是依赖注入)是Spring一个十分重要的模块,Spring容器可以对Bean进行自动装配,自动装配真是个好技术,好处有:优点自动装配可以大大地减少属性和构造器参数的指派。自动装配也可以在解析对象时更新配置。任何事物有好就有坏,那自动装配有啥缺点呢?缺点在property和constructor-arg设置中的依赖总是重载自动装配,我们无法对原始类型(如int,long,bool
2017-10-03 11:06:04 8882
原创 Keyboard Row
原文地址:https://leetcode.com/problems/keyboard-row/description/Given a List of words, return the words that can be typed using letters of alphabet on only one row’s of American keyboard like the image bel
2017-10-01 20:50:38 285
OSGi in Action
2017-10-05
apt-mirror-api-0.1.jar
2016-11-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人