小言

小言 查看完整档案

填写现居城市  |  填写毕业院校  |  填写所在公司/组织填写个人主网站
编辑
_ | |__ _ _ __ _ | '_ \| | | |/ _` | | |_) | |_| | (_| | |_.__/ \__,_|\__, | |___/ 个人简介什么都没有

个人动态

小言 回答了问题 · 2018-12-13

解决dubbo服务注册失败

  1. provider 注册的dubbo端口号必须唯一
  2. 一个项目配置多个service-provider
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
    <dubbo:application name="pule-sdk-app" id="pule-sdk-app" />
    <dubbo:registry address="zookeeper://localhost:2181" />
    <dubbo:provider protocol="dubbo" port="20881">
        <dubbo:service interface="com.pule.msapi.sdk.CodeService" ref="codeService" group="pule" version="1.0.0" />
    </dubbo:provider>
    <dubbo:provider protocol="dubbo" port="20882">
        <dubbo:service interface="com.pule.msapi.sdk.LuoSiMaoSMSService" ref="msgService" group="pule" version="1.0.0" />
    </dubbo:provider>
    <bean id="codeService" class="com.pule.mssdk.service.CodeServiceImpl" />
    <bean id="msgService" class="com.pule.mssdk.service.LuoSiMaoSMSServiceImpl" />
</beans>

关注 2 回答 2

小言 提出了问题 · 2018-12-12

解决dubbo服务注册失败

2个服务,只能启动其中一个

配置信息
ServiceA

# Dubbo Config properties
## ApplicationConfig Bean
dubbo.application.id = pule-video-provider
dubbo.application.name = pule-video-provider

## ProtocolConfig Bean
dubbo.protocol.id = dubbo
dubbo.protocol.name = dubbo
dubbo.protocol.port = 20880
dubbo.protocol.status = server

## RegistryConfig Bean
dubbo.registry.id =  pule-video-registry
dubbo.registry.address = zookeeper://127.0.0.1:2181

ServiceB

# Dubbo Config properties
## ApplicationConfig Bean
dubbo.application.id = pule-sdk-provider
dubbo.application.name = pule-sdk-provider

## ProtocolConfig Bean
dubbo.protocol.id = dubbo
dubbo.protocol.name = dubbo
dubbo.protocol.port = 20880
dubbo.protocol.status = server

## RegistryConfig Bean
dubbo.registry.id =  pule-sdk-registry
dubbo.registry.address = zookeeper://127.0.0.1:2181

启动失败信息

2018-12-12 17:22:48.474  INFO 56057 --- [           main] c.a.dubbo.common.logger.LoggerFactory    : using logger: com.alibaba.dubbo.common.logger.slf4j.Slf4jLoggerAdapter
2018-12-12 17:22:48.478  INFO 56057 --- [           main] a.b.d.c.e.WelcomeLogoApplicationListener : 

 :: Dubbo Spring Boot (v0.2.0) : https://github.com/apache/incubator-dubbo-spring-boot-project
 :: Dubbo (v2.6.2) : https://github.com/apache/incubator-dubbo
 :: Google group : dev@dubbo.incubator.apache.org

2018-12-12 17:22:48.479  INFO 56057 --- [           main] e.OverrideDubboConfigApplicationListener : Dubbo Config was overridden by externalized configuration {dubbo.application.id=pule-es-provider, dubbo.application.name=pule-es-provider, dubbo.protocol.id=dubbo, dubbo.protocol.name=dubbo, dubbo.protocol.port=20880, dubbo.protocol.status=server, dubbo.registry.address=zookeeper://127.0.0.1:2181, dubbo.registry.id=pule-es-registry}

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.1.RELEASE)

2018-12-12 17:22:48.532  INFO 56057 --- [           main] c.pule.msessearch.MsEsSearchApplication  : Starting MsEsSearchApplication on yanmingdeMacBook-Pro.local with PID 56057 (/Users/yanming/Desktop/java/PULEMS/ms-es-search/target/classes started by yanming in /Users/yanming/Desktop/java/PULEMS)
2018-12-12 17:22:48.533  INFO 56057 --- [           main] c.pule.msessearch.MsEsSearchApplication  : No active profile set, falling back to default profiles: default
2018-12-12 17:22:48.583  INFO 56057 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@15c43bd9: startup date [Wed Dec 12 17:22:48 CST 2018]; root of context hierarchy
2018-12-12 17:22:48.872  INFO 56057 --- [           main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : pule-es-provider, class : com.alibaba.dubbo.config.ApplicationConfig] has been registered.
2018-12-12 17:22:48.873  INFO 56057 --- [           main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : pule-es-provider] has been registered.
2018-12-12 17:22:48.873  INFO 56057 --- [           main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : pule-es-registry, class : com.alibaba.dubbo.config.RegistryConfig] has been registered.
2018-12-12 17:22:48.873  INFO 56057 --- [           main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : pule-es-registry] has been registered.
2018-12-12 17:22:48.873  INFO 56057 --- [           main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The dubbo config bean definition [name : dubbo, class : com.alibaba.dubbo.config.ProtocolConfig] has been registered.
2018-12-12 17:22:48.873  INFO 56057 --- [           main] .a.d.c.s.c.a.DubboConfigBindingRegistrar : The BeanPostProcessor bean definition [com.alibaba.dubbo.config.spring.beans.factory.annotation.DubboConfigBindingBeanPostProcessor] for dubbo config bean [name : dubbo] has been registered.
2018-12-12 17:22:49.102  INFO 56057 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration' of type [com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration$$EnhancerBySpringCGLIB$$76e5c3eb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-12 17:22:49.167  INFO 56057 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-12 17:22:49.168  INFO 56057 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-12 17:22:49.169  INFO 56057 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'relaxedDubboConfigBinder' of type [com.alibaba.boot.dubbo.autoconfigure.RelaxedDubboConfigBinder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-12 17:22:49.199  INFO 56057 --- [           main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : pule-es-provider] have been binding by prefix of configuration properties : dubbo.application
2018-12-12 17:22:49.206  INFO 56057 --- [           main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : pule-es-registry] have been binding by prefix of configuration properties : dubbo.registry
2018-12-12 17:22:49.224  INFO 56057 --- [           main] .f.a.DubboConfigBindingBeanPostProcessor : The properties of bean [name : dubbo] have been binding by prefix of configuration properties : dubbo.protocol
2018-12-12 17:22:49.448  INFO 56057 --- [           main] o.elasticsearch.plugins.PluginsService   : no modules loaded
2018-12-12 17:22:49.450  INFO 56057 --- [           main] o.elasticsearch.plugins.PluginsService   : loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin]
2018-12-12 17:22:49.450  INFO 56057 --- [           main] o.elasticsearch.plugins.PluginsService   : loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2018-12-12 17:22:49.450  INFO 56057 --- [           main] o.elasticsearch.plugins.PluginsService   : loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2018-12-12 17:22:49.450  INFO 56057 --- [           main] o.elasticsearch.plugins.PluginsService   : loaded plugin [org.elasticsearch.script.mustache.MustachePlugin]
2018-12-12 17:22:49.450  INFO 56057 --- [           main] o.elasticsearch.plugins.PluginsService   : loaded plugin [org.elasticsearch.transport.Netty3Plugin]
2018-12-12 17:22:49.450  INFO 56057 --- [           main] o.elasticsearch.plugins.PluginsService   : loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018-12-12 17:22:50.020  INFO 56057 --- [           main] i.netty.util.internal.PlatformDependent  : Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system instability.
2018-12-12 17:22:50.059  INFO 56057 --- [           main] o.s.d.e.c.TransportClientFactoryBean     : adding transport node : 127.0.0.1:9300
2018-12-12 17:22:51.123  INFO 56057 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-12-12 17:22:51.134  INFO 56057 --- [           main] c.pule.msessearch.MsEsSearchApplication  : Started MsEsSearchApplication in 2.844 seconds (JVM running for 3.336)
2018-12-12 17:22:51.137  INFO 56057 --- [pool-1-thread-1] .d.c.e.AwaitingNonWebApplicationListener :  [Dubbo] Current Spring Boot Application is await...

关注 2 回答 2

小言 提出了问题 · 2016-07-03

一个canvas动画中,如何处理气泡与其它气泡的合理碰撞?

如题,小弟做了一个canvas动画,模仿以前那种屏保常见的气泡,我想实现气泡与气泡之间的合理碰撞。请大大们给出一些思路,谢谢。

做了一些尝试。
在每一帧碰撞的时候去检测当前气泡与其他所有气泡的是否发生碰撞,如果是,就反转它们当前的运动方向。失败

气泡

demo传送门

关注 5 回答 4

小言 回答了问题 · 2016-07-01

解决有人给我解释下这个继承函数是如何工作的么?

以下是我关于js继承思考的结果及一个实例demo,附上一点总结。

基础:

  1. js对象都有一个原型 prototype 对象 object.prototype 和原型对象的一个引用 constructor (是一个创建原型对象的实例方法的对象引用),即构造函数。

  2. 原型对象对属性及方法可以被引用

js继承基本思路:

  1. 构造一个空的对象 function o(){}

  2. 将对象 o 的原型引用指向 父对象的原型,对象o 获取了父对象原型的引用。

  3. 将对象 o 的构造函数指向子对象(表示使用子对象的构造方法来初始化对象o),并将子对象的原型对象指向 对象 o,实现了对父对象的原型引用,并且可以实现子对象自己的原型方法。

  4. 以下还使用了__super__来保留了对父类的原型对象引用,实现了重载父类原型方法。

var extend = function(child, parent) {
        // 复制父类的属性
        for (var key in parent) {
            if (hasProp.call(parent, key)) child[key] = parent[key];
        }

        // 创建一个空对象并将它的构造函数指向child
        function o() {
            this.constructor = child;
        }

        // 将空对象的prototype对象指向父对象的prototype对象,以此实现继承父类的prototype中的属性及方法
        o.prototype = parent.prototype;

        // 将子对象的prototype对象指向刚创建的空对象
        child.prototype = new o();

        // 获取父对象的公共方法,可实现重载
        child.__super__ = parent.prototype;

        return child;
    },
    hasProp = {}.hasOwnProperty;

var Face = (function() {
    function Face(x, y, z, l, h, w, type) {
        this.x = x;
        this.y = y;
        this.z = z;
        this.l = l;
        this.h = h;
        this.w = w;
        this.type = type;
        this.flag = 0;
        this.highlight = void 0;
    }
    Face.prototype.draw = function() {
        console.log("################# begin draw " + this.type + " ###################");
    }

    Face.prototype.get = function(name) {
        if (hasProp.call(this, name)) {
            return this[name];
        } else {
            return void 0;
        }
    }

    Face.prototype.set = function(prop, val) {
        this[prop] = val;
    }

    return Face;

})();

var FaceFront = (function(SuperClass) {
    extend(FaceFront, SuperClass);

    function FaceFront() {
        FaceFront.__super__.constructor.apply(this, arguments);
    }

    FaceFront.prototype.draw = function() {
        // 重载父类方法
        FaceFront.__super__.draw.apply(this, arguments);
        
        console.log("draw face front ");
        console.log("shape l: " + this.l + ", h:" + this.h + ", w:" + this.w);

        console.log("############### finished draw face front with type " + this.get('type')+" ####################");
    }

    return FaceFront;

})(Face);

var ff = new FaceFront(0, 0, 0, 100, 100, 100, 'R');
ff.draw();

关注 2 回答 2

小言 提出了问题 · 2016-06-30

解决有人给我解释下这个继承函数是如何工作的么?

如题,下面是一个继承函数(子类可继承父类的属性及方法),但是不懂工作原理,求解,求科普,求链接。

var extend = function(child, parent) {
    for (var key in parent) {
        if (hasProp.call(parent, key)) child[key] = parent[key];
    }

    function ctor() {
        this.constructor = child;
    }
    ctor.prototype = parent.prototype;
    child.prototype = new ctor();
    child.__super__ = parent.prototype;
    return child;
},
hasProp = {}.hasOwnProperty;

关注 2 回答 2

小言 回答了问题 · 2016-06-22

解决这个获取树路径的函数哪里有问题呢?

使用上面的get_path递归方法,最后root节点的引用失效了(可能是有Circular相互引用导致),下面的函数有效。

    get_path: function(node, path) {
        console.log(node);
        console.log("-".repeat(10));
        path = path || "";                        
        while(node.parent) {
            path = node.text +' >> ' + path;
            node = node.parent;
        }
        path = node.text +' >> ' + path; // ROOT
        return path;
    },

或许应该避免循环引用,只保留父节点的id,获取路径。(效率不高)

    init: function(tree, nodeParent) {
        var _this = this;
        tree = tree || this.data;
        if (tree && Array.isArray(tree)) {
            tree.forEach(function(node, index) {
                node.parent = nodeParent && nodeParent.id ? nodeParent.id : undefined;
                if (node.children && Array.isArray(node.children)) {
                    _this.init(node.children, node);
                }
            })
        }
    },
    get_path: function(node) {
        path = [], parent;            
        while(node.parent) {
            parent = this._get(node.parent);
            path.push(parent);
            node = parent;
        }
        return path.reverse();
    },

关注 2 回答 1

小言 提出了问题 · 2016-06-21

解决这个获取树路径的函数哪里有问题呢?

构造了一个父子树,想获取某个节点的路径,可是获取不了,不知道哪里出错,求解。


var data = [{
    'id': 'root',
    'text': 'Root',
    'children': [{
        'id': 1,
        'text': 'Child 1'
    }, {
        'id': 2,
        'text': 'Child 2',
        'children': [{
            'id': 6,
            'text': 'Child 6'
        }, {
            'id': 7,
            'text': 'Child 5',
            'children': [

            ]
        }]
    }]
}];
var tree = function(data) {
    this.data = data;
}
tree.prototype = {
    init: function(tree, nodeParent) {
        var _this = this;
        tree = tree || this.data;
        if (tree && Array.isArray(tree)) {
            tree.forEach(function(node, index) {
                node.parent = nodeParent;
                if (node.children && Array.isArray(node.children)) {
                    _this.init(node.children, node);
                }
            })
        }
    },
    get_path: function(node, path) {
        path = path || "";
        if (node.parent) {
            path = node.text + ' >> ' + path;
            this.get_path(node.parent, path);
        } else {
            return path;
        }
        console.log(path); // Child 2 >> Child 6 >>
    },
    // 遍历树
    traverse: function(tree, fn) {
        var _this = this;
        tree = tree || this.data;

        if (tree && Array.isArray(tree)) {
            tree.forEach(function(node, index) {
                fn && fn.call(_this, node, tree, index);
                if (node && node.children && Array.isArray(node.children)) {
                    _this.traverse(node.children, fn);
                }
            })
        } else {
            fn.call(_this, tree);
        }
    },
    _get: function(id, fn) {
        var _this = this;
        var found = false;
        this.traverse(this.tree, function(node, tree, index) {
            if (node.id === id) {
                found = node;
                fn && fn.call(_this, node, tree, index);
            }
        })

        if (!found) {
            throw new Error("can get node id " + id);
        }
        return found;
    },
};

var mytree = new tree(data);
mytree.init();

console.log(mytree.get_path(mytree._get(6)));

关注 2 回答 1

小言 提出了问题 · 2016-06-14

解决github页面切换时那一条优雅的进度条如何实现?

如题,觉得比较有意思,有同学知道如何实现吗?顺便可以帮我普及下页面加载的几个关键事件知识?感谢!

关注 6 回答 1

小言 提出了问题 · 2016-06-07

解决JS如何实现一个异步队列来按顺序执行函数?

asyn([func1, func2, func3], function(){
    // func1,func2,func3全部按顺序执行完的回调
})

关注 10 回答 6

小言 提出了问题 · 2016-06-03

这个折半递归搜索哪里错了?

var list = [1,2,3,4,5,6,7,8,9,10];

var binaryRecursiveSearch = function(list, search_num, left, right) {
    var left = left || 0;
    var right = right || list.length;
    var middle;
    var compare = function(a, b) {
    console.log("compare a:"+a+", b:"+b);
        if (a < b) return -1;
        else if (a === b) return 0;
        else return 1;        
    }    
    if (left <= right) {
        middle = Math.round((left + right) / 2);                    
    console.log("left: "+left+", right:"+right+", search_num:"+search_num);
        switch (compare(list[middle], search_num)) {
            case -1: return 
                binaryRecursiveSearch(list, search_num, middle+1, right);     
            case 0: return middle;
            case 1: return 
                binaryRecursiveSearch(list, search_num, left, middle-1);
        }
    }
    return -1;
}
binaryRecursiveSearch(list, 3);

关注 2 回答 1

认证与成就

  • 获得 13 次点赞
  • 获得 19 枚徽章 获得 1 枚金徽章, 获得 4 枚银徽章, 获得 14 枚铜徽章

擅长技能
编辑

(゚∀゚ )
暂时没有

开源项目 & 著作
编辑

(゚∀゚ )
暂时没有

注册于 2014-04-01
个人主页被 437 人浏览