小编Nik*_*pal的帖子

在jQuery中,如何在ajax调用失败时恢复可拖动?

如果ajax调用on drop返回失败,我希望draggable恢复到其原始位置.这是我想象的代码..如果在ajax调用正在进行中,draggable可以放在droppable中,这是可以的...

<script type="text/javascript">
jQuery(document).ready($){
    $("#dragMe").draggable();
    $("#dropHere").droppable({
        drop: function(){
            // make ajax call here. check if it returns success.
            // make draggable to return to its old position on failure.
        }
    });
}
</script>
<div id="dragMe">DragMe</div>
<div id="dropHere">DropHere</div>
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui droppable draggable

13
推荐指数
1
解决办法
7732
查看次数

为什么Spring Data MongoDB无法实例化这种嵌套类型结构?

我的文档结构如下:

{
    _id: "A",
    groups:[{
        groupId: "someId",
        groupName: "someName",
        params: {
            type1: ["a", "b"],
            type2: ["c", d]
        }
    }],
    config: {
        person: {}
        dataDetails: {
            dataTypeDetails: {},
            dataList: ["dt1", "dt2"]
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我的Spring Data MongoDB模型类型如下所示:

// Imports etc.
@Document
public class Entity {

    @Id
    private String _id;

    private List<Group> groups;
    private Config config;
    // setters and getters

    public class Group {
        private String groupId;
        private String groupName;
        private ParamData params;

        // setter and getters
    }

    public class ParamData { …
Run Code Online (Sandbox Code Playgroud)

mongodb spring-data spring-data-mongodb

12
推荐指数
1
解决办法
1万
查看次数

spring boot 2 + feign + eureka 客户端不会将服务名称解析为 URL

我正在尝试使用 spring-cloud (Finchley.SR1) 的 spring-boot (2.0.5) 并尝试使用 Eureka 作为发现服务器和 Feign/Ribbon 作为客户端来设置两个服务之间的通信。设置非常简单(尽管我尝试过的各种事情和其他答案有点混乱):

Eureka 的应用程序.yml

spring:
  application:
    name: eureka-service
server:
  port: 8761
eureka:
  instance:
    hostname: localhost
    preferIpAddress: true
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka
Run Code Online (Sandbox Code Playgroud)

第二个服务的 bootstrap.yml

spring:
  application:
    name: secondservice
eureka:
  instance:
    hostname: ${spring.application.name}
    preferIpAddress: true
    instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
    statusPageUrlPath: ${server.servlet.context-path}/actuator/info
    healthCheckUrlPath: ${server.servlet.context-path}/actuator/health
    leaseRenewalIntervalInSeconds: 15
    leaseExpirationDurationInSeconds: 45
    metadata-map:
      server.servlet.context-path: ${server.servlet.context-path}
  client:
    enabled: true
    serviceUrl:
      defaultZone: http://localhost:8761/eureka
Run Code Online (Sandbox Code Playgroud)

我的测试/模板服务的 bootstrap.yml

spring:
  application:
    name: templateservice
eureka:
  instance:
    hostname: ${spring.application.name}
    preferIpAddress: true
    instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}} …
Run Code Online (Sandbox Code Playgroud)

spring spring-boot netflix-eureka spring-cloud-feign netflix-ribbon

6
推荐指数
1
解决办法
7490
查看次数

如何在 nodejs 中对发现的微服务进行客户端负载平衡

我们试图在一个环境中使用 nodejs 构建一个微服务,其他微服务是用 java/spring boot 编写的。

其他微服务使用 consul.io 进行服务发现,使用 Ribbon 进行客户端负载平衡。(即:spring-boot、spring-cloud-starter-consul-discovery、spring-cloud-starter-feign 和 spring-cloud-starter-ribbon 项目)

现在在这个组合中,我们有一个consul 节点模块来注册或发现服务,但剩下的事情呢?我如何使用客户端上处理的负载平衡进行发现感知休息调用,类似于功能区。

我怎样才能在节点的堆栈中实现这一点?

node.js microservices netflix-ribbon

5
推荐指数
1
解决办法
3555
查看次数

更新Eclipse时出错:搜索替代解决方案

当我检查更新时,Eclipse抛出以下错误:

An internal error occurred during: "Searching alternate solutions...".
org.codehaus.groovy.eclipse 2.6.1.xx-20120301-1300-e36-RELEASE is unknown in the solver!
Run Code Online (Sandbox Code Playgroud)

我已经搜索并检查了这个相关问题,但是我没有安装上述软件包。当我在已安装的软件中搜索groo / java 8等时,都没有列出任何内容。

如果我只是忽略列出的groovy插件更新(并标记为错误),并尝试继续进行更新,则更新软件时出现以下错误:

An error occurred while collecting items to be installed
session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
No repository found containing: osgi.bundle,org.codehaus.jackson.core,1.9.13
No repository found containing: osgi.bundle,org.codehaus.jackson.mapper,1.9.13
No repository found containing: osgi.bundle,org.eclipse.net4j.jms.api,3.0.0.v20110215-1551
No repository found containing: osgi.bundle,org.springframework.roo.wrapping.protobuf-java-lite,2.3.0.0001
Run Code Online (Sandbox Code Playgroud)

Eclipse版本:Neon发行版(4.6.0)和内部版本ID:20160613-1800

我该如何解决?


Eclipse的安装详细信息:

Ansi Console    1.3.1.201508091828  net.mihai-nita.ansicon.feature.group    Mihai Nita
Axis2 Tools 1.1.301.v201410160332   org.eclipse.jst.ws.axis2tools.feature.feature.group Eclipse Web Tools Platform
Cloud Foundry Tools Core    1.0.4.v201606021906 …
Run Code Online (Sandbox Code Playgroud)

eclipse groovy spring-tool-suite

3
推荐指数
1
解决办法
4170
查看次数