自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

秀秀的博客

java开发

  • 博客(64)
  • 资源 (2)
  • 收藏
  • 关注

原创 设计模式-----观察者模式

观察者模式定义观察者模式(又被称为发布-订阅(Publish/Subscribe)模式,属于行为型模式的一种,它定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象。这个主题对象在状态变化时,会通知所有的观察者对象,使他们能够自动更新自己。结构图角色:Subject:抽象主题(抽象被观察者),抽象主题角色把所有观察者对象保存在一个集合里,每个主题

2018-01-23 11:06:29 214

原创 141. Linked List Cycle

问题Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?问题描述题目很简单就是给一个链表需要判断链表是否有环代码 ListNode p=head;//快指针 ListNode q=

2018-01-17 10:20:19 241

转载 67. Add Binary

问题Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.描述题目大意为两个二进制字符串相加,以最多位的为准,位不够的低位补0,然后进行相加代码class Solution { public St

2018-01-15 10:37:22 229

原创 53. Maximum Subarray

问题Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1]

2018-01-12 11:16:45 167

转载 mysql写入中文乱码

MySql系列:中文写入数据库出现错误java.sql.SQLException: Incorrect string value: ‘\xE5\xxxx’ for column ‘xxxx’ at row 1及其解决方法 在将kft-activiti-demo的数据库连接改为mysql之后,可以正常登陆,但是在新建请假流程的时候出现如下错误:Caused by: java.sql.SQLEx

2018-01-11 17:20:57 343

原创 122. Best Time to Buy and Sell Stock II

问题Find the largest palindrome made from the product of two n-digit numbers.Since the result could be very large, you should return the largest palindrome mod 1337.Example:Input: 2Output: 98

2018-01-09 11:19:36 160

原创 7. Reverse Integer

问题Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123 Output: 321 Example 2:Input: -123 Output: -321 Example 3:Input: 120 Output: 212.描述题目很简单,就是给一个整数将

2018-01-09 10:19:35 148

原创 122. Best Time to Buy and Sell Stock II

问题Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.2.描述题目很简单,不用加法实现整数相加,对位运算的理解,异或为两个数相加,但是不带进位,与运算为两个数

2018-01-08 11:34:06 157

原创 122. Best Time to Buy and Sell Stock II

问题Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was

2018-01-08 10:30:12 171

原创 122. Best Time to Buy and Sell Stock II

问题Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy

2018-01-05 13:34:02 160

原创 697. Degree of an Array

问题Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.Your task is to find the smallest possible length of a (

2018-01-04 11:08:13 179

原创 237. Delete Node in a Linked List

问题Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value

2018-01-04 10:28:29 137

原创 136. Single Number

问题Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra me

2017-12-25 10:34:18 136

原创 292. Nim Game

问题You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be th

2017-12-25 10:24:42 158

原创 Longest Uncommon Subsequence I

1.问题Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defined as the longest subsequence of one of these

2017-12-22 15:43:55 173

原创 Next Greater Element I

1.问题描述You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of num

2017-12-22 15:13:26 224

原创 java源码RandomAccess

package java.util;/** * Marker interface used by <tt>List</tt> implementations to indicate that * they support fast (generally constant time) random access. The primary * purpose of this interface

2017-12-21 18:08:16 234

原创 分糖

1.问题描述Given an integer array with even length, where different numbers in this array represent different kinds of candies. Each number means one candy of the corresponding kind. You need to distribute

2017-12-21 10:35:47 311

原创 Array Partition I

问题描述Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as pos

2017-12-19 11:01:46 276

原创 求整数可以被自身的各个位进行整除

1.问题描述问题解决主要为对left与reght进行递增遍历class Solution { public List<Integer> selfDividingNumbers(int left, int right) { List<Integer> retList= new ArrayList<>(); for (int n = left;n<=right;

2017-12-18 10:46:27 835

原创 求数组中两个元素加起来等于指定的数

1.问题描述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 s

2017-12-14 11:50:47 624

原创 求二进制数中1的个数

本题中的原本含义为求两个数之间的汉明距离汉明距离:两个数之间相同位但是不同的个数的数量具体百度2.问题: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y

2017-12-14 11:01:30 221

原创 设计模式-----命令模式

命令模式定义将一个请求封装成一个对象,从而让你使用不同的请求把客户端参数化,对请求排队或者记录请求日志,可以提供命令的撤销和恢复功能。通用类图通用Receiver类public abstract class Receiver { //抽象接收者,定义每个接收者都必须完成的业务 public abstract void doSomething(); }具体Re

2017-01-04 10:42:10 286

原创 设计模式-----中介者模式

中介者模式定义用一个中介对象封装一系列的对象交互,中介者使各对象不需要显示的相互作用,从而使其耦合松散,而且可以独立的改变他们之间的交互。通用类图Mediator 抽象中介者角色抽象中介者角色定义统一的接口,用于各同事角色之间的通信Contrcete Mediator具体中介者角色具体中介者角色通过协调各同事角色实现协作行为,因此它必须依赖于各个同事角色。Colleague 同事角色每一个同

2017-01-04 10:07:56 310

原创 设计模式-----原型模式

原型模式定义:原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象原型模式通类图原型模式的核心就是clone方法,通过对对象的拷贝,实现java的Cloneable接口,并重写clone接口。public class PrototypeClass implements Cloneable{ //覆写父类Object方法 @Override

2016-12-26 15:09:27 274

原创 设计模式-----代理模式

代理模式定义为其他对象提供一种代理以控制对这个对象的访问。代理模式也叫委托模式,许多模式,如状态模式、策略模式、访问者模式、本质上都是在特殊的场景下使用了代理模式。Subject抽象主题角色 抽象主体类可以是抽象类也可以是接口,是一个最普通的业务定义,没有特殊的要求RealSubject具体主题角色 也叫委托角色、被代理角色,是业务逻辑的具体执行者Proxy代理主题

2016-12-26 14:36:50 247

原创 Zabbix学习----环境配置

基本的问题 ,就不说了 ,网上一大堆教程。重点说下php安装参数:./configure --prefix=/usr/local/php-5.5.7 \--with-config-file-path=/usr/local/php-5.5.7/etc --with-bz2 --with-curl \--enable-ftp --enable-sockets --disable-ipv6 --wi

2016-12-22 13:14:29 313

原创 openResty-----nginx基础

nginx基础变量变量赋值在nginx中变量的类型只有一种,字符串。比如我们在nginx.conf中进行定义:set $a "hello world"我们使用了标准 ngx_rewrite 模块的 set 配置指令对变量 $a 进行了赋值操作。特别地,我们把字符串 hello world 赋给了它。nginx变量名前面有符号,这是nginx的要求,所有变量前边都必须要有符号 ,这是nginx的要求,

2016-12-16 15:47:47 1669

原创 openResty-----安装

安装openResty参考: http://openresty.org/cn/installation.html本教程来源:http://jinnianshilongnian.iteye.com/blog/2186270安装完成之后我们进入cd /usr/local/nginx/conf/对nginx.conf进行编辑: 在HTTP模块中添加lua模块c模块之后,在conf下面创建lua.

2016-12-16 09:50:05 338

原创 linux性能测试----nmon

nmon介绍nmon 工具可以为 AIX 和 Linux 性能专家提供监视和分析性能数据的功能,其中包括:CPU 使用率 内存使用情况 内核统计信息和运行队列信息 磁盘 I/O 速度、传输和读/写比率 文件系统中的可用空间 磁盘适配器 网络I/O 速度、传输和读/写比率 页面空间和页面速度 CPU 和 AIX 规范 消耗资源最多的进程 IBM HTTP Web 缓存用户自定

2016-12-15 21:34:52 988

原创 RabbitMQ从入门到精通----集群模式

集群模式一台RabbitMQ的处理能力终究是有限的,同时容灾性很差。那么我们RabbitMQ的集群的出发点就在与扩大程序的规模以提高程序的负载能力,同时提高集群的容灾性,当一台宕机后,仍有其他服务器进行处理业务请求。集群架构我们了解了RabbitMQ的交换器exchange以及队列queue和路由键Routing key以及如何将他们绑定到一起,那么在RabbitMQ中是如何记录我们使

2016-12-15 15:31:59 993

原创 设计模式-----建造者模式

建造者模式建造者模式的定义将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。Director导演类—–负责安排已有的模块的顺序,然后通知builder进行构建ConcreteBuilder具体建造者——实现抽象类的所有方法,返回一个组件好的对象Product产品类——–具体的产品类Builder抽象建造者——-规范建造者的规范建造者模式的实践在模板模式中,我们通过将r

2016-12-15 14:22:51 319

原创 设计模式-----模板模式

模板模式模板模式的定义定义一个操作中的算法的框架,而将一些步骤延迟到子类中。使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤通用类图:为了防止恶意的操作,一般模板方法都加上final关键字,不允许被覆写。抽象模板中的基本方法尽量设计为protected类型,符合迪米特法则,不需要暴露 的属性或方法尽量不要设置为protected类型。实现类若非必要,尽量不要扩大父类中的访问 权限模

2016-12-15 13:30:27 462

原创 设计模式-----抽象工厂模式

抽象工厂模式工厂模式改为抽象工厂在上面的工厂方法中我们举例,女娲造人的例子,但是我们想要加上性别,为此重新建模:Human接口中提供getSex的方法,我们将BlackHuman改为抽象类同时提供实现Human接口中的方法,在下方我们提供Female与MaleBlackMan的实现类,分别表示男性以及女性黑人。在工厂类的接口中我们依然提供创建人类对象的方法,在具体实现FemaleFactory与Ma

2016-12-15 11:04:50 319

原创 设计模式-----工厂模式

工厂模式工厂方法模式的定义 定义一个用于创建对象的接口,让子类决定实例化哪一个类。工厂方法使一个类的实例化延迟到其子类。在工厂模式中,其中Product负责抽象具体对象的共性,实现对事务最抽象的定义。Creator为抽象创建类,也就是抽象工厂,具体如何创建产品类是由具体的实现工厂 ConcreteCreator完成的。工厂类的实现我们来看一个女娲造人的类图:其中AbstractHumanFa

2016-12-15 10:20:50 331

原创 设计模式-----单例模式

单例模式单例模式要求一个类只能生成一个对象,所有对象对它的依赖都是相同的,自行实例化并向整个系统提供这个实例。Singleton类称为单例类,通过使用private的构造函数确保了在一个应用中只产生一个实 例,并且是自行实例化的(在Singleton中自己使用new Singleton())public class Singleton { private static final S

2016-12-14 16:42:24 247

原创 设计模式

设计模式的6大原则开闭原则(Open Close Principle)一个软件实体如类、模块和函数应该对扩展开放,对修改关闭。软件实体应该对扩展开放,对修改关闭,其含义是说一个软件实体应该通过扩展来实现变化,而不是通过修改已有的代码来实现变化。里氏代换原则(Liskov Substitution Principle)定义:所有引用基类的地方必须能透明地使用其子类对象。通俗地讲,只要有父类出现的地

2016-12-14 15:49:47 424

原创 RabbitMQ从入门到精通----编码与模式

初始需求正如我们在使用RabbitMQ中,我们的初始需求并不是单纯的想要寻找一个消息队列,而我们的需求是解耦应用程序之间的耦合或者是将一个耗时的操作从应用中剥离出来,异或者整合不同的语言编写出来的应用程序,但是这些问题的本质就是解耦与操作。或者换种方法进行理解是我们可以把同步的应用程序转换为异步的操作,主程序进行其他操作时,我们可以将信息来发送到队列中,然后去做其他的事情,然后等待消息的返回,而不用

2016-12-12 15:02:03 2420

原创 RabbitMQ从入门到精通----交换器详解

RabbitMQ交换器详解正如我们所理解的,当我们发送消息到RabbitMQ中,它的流程为:发送到交换器交互器根据Routing key(路由键)发送至相关队列在RabbitMQ中一共提供四种交换器(Exchange):directfanouttopicheadersdirect详解direct交换器相对来说比较简单,匹配规则为:如果路由键匹配,消息就被投送到相关的队列。在服务器中必

2016-12-12 09:54:01 1344

原创 RabbitMQ从入门到精通----运行与管理

在上文中我们已经简单的介绍了AMQP消息通信的基本概念,并对运行环境进行了安装,但是当我们将RabbitMQ部署在线上的时候,有涉及到了RabbitMQ的优化,在本节中我们 着重讲解RabbitMQ的管理服务器的管理RabbitMQ为erlang语言编写,由于erlang语言的特性很好的实现简单的分布式,但是我们以前并没有接触过Erlang语言,因此很多的优化也会有着不同。启动节点在本节中我们使用术

2016-12-10 16:45:34 3024

李航高清统计学习方法

<统计学习方法》是计算机及其应用领域的一门重要的学科。《统计学习方法》全面系统地介绍了统计学习的主要方法,特别是监督学习方法,包括感知机、k近邻法、朴素贝叶斯法、决策树、逻辑斯谛回归与最大熵模型、支持向量机、提升方法、EM算法、隐马尔可夫模型和条件随机场等。除第1章概论和最后一章总结外,每章介绍一种方法。叙述从具体问题或实例入手,由浅入深,阐明思路,给出必要的数学推导,便于读者掌握统计学习方法的实

2017-10-19

OrientDB中文使用手册

OrientDB完整中文介绍文档

2017-07-17

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除