小编Rag*_*ngh的帖子

Avro架构不支持向后兼容性

我有这个avro架构

{
 "namespace": "xx.xxxx.xxxxx.xxxxx",
 "type": "record",
 "name": "MyPayLoad",
 "fields": [
     {"name": "filed1",  "type": "string"},
     {"name": "filed2",     "type": "long"},
     {"name": "filed3",  "type": "boolean"},
     {
          "name" : "metrics",
          "type": 
          {
             "type" : "array", 
             "items": 
             { 
                 "name": "MyRecord", 
                 "type": "record", 
                 "fields" : 
                     [                         
                       {"name": "min", "type": "long"}, 
                       {"name": "max", "type": "long"}, 
                       {"name": "sum", "type": "long"}, 
                       {"name": "count", "type": "long"}
                     ]
             } 
          }
     }
  ]
}
Run Code Online (Sandbox Code Playgroud)

这是我们用来解析数据的代码

public static final MyPayLoad parseBinaryPayload(byte[] payload) {
        DatumReader<MyPayLoad> payloadReader = new SpecificDatumReader<>(MyPayLoad.class);
        Decoder decoder = DecoderFactory.get().binaryDecoder(payload, null); …
Run Code Online (Sandbox Code Playgroud)

java serialization avro

10
推荐指数
1
解决办法
2512
查看次数

引导日期时间选择器,单击图像时显示对话框

我正在使用bootstrap日期时间选择器进行输入.

我定义了以下html div

<div class="form-group">
    <label for="movingDate">Moving Date</label>
    <div class="input-group date ui-datepicker">
        <input type="text" id="prefMovingDate" name="movingDateTime" class="form-control" data-required="true">
        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

这个javascript启用bootstrap日期时间选择器

    $('#prefMovingDate').datetimepicker({
        format : 'd-M-yyyy H:ii P',
        autoclose : true,
    });
Run Code Online (Sandbox Code Playgroud)

输出如下

在此输入图像描述

现在,当我点击文本框时,我看到了这一点

在此输入图像描述

这很好,但我想要的是,即使点击了小日历图标,也会出现日期选择弹出窗口.我尝试了各种方法,但我无法理解它.任何有关这方面的帮助将不胜感激.

html javascript jquery twitter-bootstrap bootstrap-datetimepicker

7
推荐指数
2
解决办法
2万
查看次数

mongoose填充不填充数组

我面临的问题是mongoose查询没有填充数组类型.

这是学院架构

'use strict';

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var InstituteSchema = new Schema({
    name: String,
    address: String,
    city: String,
    country: String,
    zip: String,
    owner: { type: mongoose.Schema.ObjectId, ref: 'User' },
    teachers: [{type: mongoose.Schema.ObjectId, ref: 'Teacher'}],
    categories: [String],
    created : { type : Date, default : Date.now }
});

module.exports = mongoose.model('Institute', InstituteSchema);
Run Code Online (Sandbox Code Playgroud)

这是教师Schema

'use strict';

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var TeacherSchema = new Schema({
    education: [{degree: String, instituteName: String}],
    dob: Date,
    photoUrl: …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb node.js

7
推荐指数
1
解决办法
2176
查看次数

执行redis服务器的lua脚本时出错

我正在按照这个简单的教程来试用一个简单的lua脚本

http://www.redisgreen.net/blog/2013/03/18/intro-to-lua-for-redis-programmers/

我用这些行创建了一个简单的hello.lua文件

local msg = "Hello, world!"
return msg
Run Code Online (Sandbox Code Playgroud)

我试着运行简单的命令

EVAL "$(cat /Users/rsingh/Downloads/hello.lua)" 0
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误

(error) ERR Error compiling script (new function): user_script:1: unexpected symbol near '$' 
Run Code Online (Sandbox Code Playgroud)

我找不到这里有什么问题,我找不到遇到过这个问题的人.

任何帮助将深表感谢.

lua redis

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

如果 class.getProtectionDomain 返回 null 意味着什么

我有一个方法返回加载特定类的 jar。方法如下。对于某些类,下面的行返回 null

ProtectionDomain 保护域 = c.getProtectionDomain();

我想了解在什么情况下它为空。代码进行编译,因此我认为该类在编译时是可见的,并且特定类所在项目的依赖项也是编译时依赖项。

这是方法

  public static String jarFor(Class c) {
    ProtectionDomain protectionDomain = c.getProtectionDomain();
    CodeSource codeSource = protectionDomain.getCodeSource();
    URL url = codeSource.getLocation();
    String path = url.getPath();
    if (Os.isWindows() && path.startsWith("/")) {
      path = path.substring(1);
    }
    return URLDecoder.decode(path);
  }
Run Code Online (Sandbox Code Playgroud)

class

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

jenkins在重新启动我的sql时失败了"sudo:没有tty存在且没有指定askpass程序抱歉,请再试一次."

我刚刚配置了jenkins,并且在预构建步骤中我试图重新启动jenkins但我最终得到以下错误

Commencing build of Revision c5b9f8daac092efc5396d80f568a2cf89ae8b697 (origin/HEAD, origin/master)
Checking out Revision c5b9f8daac092efc5396d80f568a2cf89ae8b697 (origin/HEAD, origin/master)
No change to record in branch origin/HEAD
No change to record in branch origin/master
[webapp] $ /bin/sh -xe /tmp/hudson5215632082686866774.sh
+ sudo /etc/init.d/mysql restart
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: 3 incorrect password attempts
Build step …
Run Code Online (Sandbox Code Playgroud)

mysql amazon-web-services jenkins

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

为x-editable字段取十进制输入

我正在使用x-editable和bootstrap

我定义了以下html字段

<div class="form-group">
    <label class="col-sm-4">Service Charges(%)</label>
    <div class="col-sm-6 hoverEdit">
        <a class="editableAccount" id="serviceTax"></a>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我定义了以下脚本以使该字段可编辑

$('.editableAccount').editable({
    type : 'number',
    title : 'Enter New Value',
    success : function(response, newValue) {
        updateAccount(this.id, newValue);
    }
});
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试编辑字段并输入小数值时,我得到了这个

在此输入图像描述

我想使这个字段可编辑,以便我可以输入十进制值.我在文档上看不到任何帮助.有人请在这里帮助我,我对html和javascript相当新.

jquery twitter-bootstrap x-editable

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

如何在猫鼬中查询嵌套数组

我有这样的架构

'use strict';

var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var TeacherSchema = new Schema({
    education: [{degree: String, instituteName: String}],
    dob: Date,
    photoUrl: String,
    phoneNumber: String,
    institutes: [{type: mongoose.Schema.ObjectId, ref: 'Institute'}],
    subjects: [{
        name: String,
        topics: [{
            name: String,
            modules: [{
                name: String,
                classes: [{
                    name: String,
                    startTime: Date,
                    endTime: Date,
                    fee: Number
                }]
            }]
        }]
    }],
    created: {type: Date, default: Date.now}
})

module.exports = mongoose.model('Teacher', TeacherSchema);
Run Code Online (Sandbox Code Playgroud)

我的问题是如何查询嵌套数组?具体来说,我想查找所有至少有一个科目/主题/模块/课程的老师,其名称以“ Math”开头。我怎么能用猫鼬呢?

mongoose mongodb node.js

4
推荐指数
1
解决办法
6013
查看次数

Parse.com,将用户添加到创建的角色

我有一个云代码,当用户注册时它会创建两个帐户角色。下面是方法

Parse.Cloud.afterSave("account", function(request) {
    var accountName = request.object.get("name");

    //create admin role
    var adminRoleACL = new Parse.ACL();
    adminRoleACL.setPublicWriteAccess(true);
    var adminRole = new Parse.Role(accountName + "_Administrator", adminRoleACL);
    adminRole.save() ; 

    //create user role
    var userRoleACL = new Parse.ACL();
    userRoleACL.setPublicWriteAccess(true);
    var userRole = new Parse.Role(accountName + "_User", userRoleACL);
    userRole.save();
});
Run Code Online (Sandbox Code Playgroud)

现在我想要实现的是添加刚刚注册这两个角色的用户。但不幸的是,我看到在云代码中我无法获得当前用户。因此,我要做的是在从客户端创建角色之后,在角色中添加用户。下面是相同的代码。代码执行正常,我没有看到任何错误,但是我没有看到用户被添加到数据浏览器中的角色。知道为什么会这样吗?我错过了什么吗?真的感谢您的帮助。

user.signUp(null, {
    success : function(user) {
        var currentUser = Parse.User.current();

        var accountName = account.get("name");

        var query = new Parse.Query(Parse.Role);
        query.contains("name", accountName);

        query.find({
            success : function(roles) {
                if (!roles) {
                    alert("No roles for " …
Run Code Online (Sandbox Code Playgroud)

role user-roles parse-platform

2
推荐指数
1
解决办法
7927
查看次数

jquery验证不适用于所有字段

我有一个具有不同字段集的表单.在每个步骤中,我使用规则验证整个表单,该规则应仅验证表单上的可见元素.我可以看到第一步验证工作正常.但是在第2步中只验证了一些字段.这是表格的定义

<form id="enquiryForm" action="">
            <div id="fieldset1" style="display: block;">
                <fieldset class="addingenq">
                    <legend>
                        <h2>Contact information</h2>
                        <span class="steps">Step 1 of 3</span>
                    </legend>
                    <p>
                        <input type="text" id="firstname" name="first" value="" placeholder="First Name" required>
                    </p>
                    <p>
                        <input type="text" id="lastname" name="last" value="" placeholder="Last Name" required>
                    </p>
                    <p>
                        <input id="step1" type="button" value="Next" onclick="javascript: completeStep1();"/>
                    </p>
                </fieldset>
            </div>
            <div id="fieldset2" style="display: none;">
                <fieldset class="addingenq">
                    <legend>
                        <h2>Move information</h2>
                        <span class="steps">Step 2 of 3</span>
                    </legend>
                    <p>
                        <input type="text" id="originCity" placeholder="Origin City" required>
                    </p>
                    <p>
                        <input type="text" id="originCountry" placeholder="Origin Country" value="India" required> …
Run Code Online (Sandbox Code Playgroud)

forms jquery jquery-validate

2
推荐指数
1
解决办法
5112
查看次数

maven 无法下载 jacoco 0.7.10-SNAPSHOT jar

我对此感到困惑。我的 pom.xml 中有这个

<build>
    <pluginManagement>
        ... other plugins ...
        <plugin>
           <groupId>org.jacoco</groupId>
           <artifactId>jacoco-maven-plugin</artifactId>
           <version>0.7.10-SNAPSHOT</version>
        </plugin>
    </pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)

这是我的存储库部分

<repositories>
    <repository>
        <id>oss-sonatype</id>
        <name>oss-sonatype</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <updatePolicy>daily</updatePolicy>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    ..... other repositories ....        
</repositories>
Run Code Online (Sandbox Code Playgroud)

据我所知,jacoco-0.7.10-SNAPSHOT 存在于https://oss.sonatype.org/content/repositories/snapshots/org/jacoco/jacoco-maven-plugin/0.7.10-SNAPSHOT/

我的理解是应该下载它并构建应该成功但我收到以下错误

[错误] 插件 org.jacoco:jacoco-maven-plugin:0.7.10-SNAPSHOT 或其依赖项之一无法解析:找不到工件 org.jacoco:jacoco-maven-plugin:jar:0.7.10-SNAPSHOT -> [帮助 1]

我看到了人们建议在 ~/.m2/settings.xml 文件中添加存储库的解决方案。我想知道我可以在不更改 .m2/settings.xml 的情况下执行此操作,以及为什么当前设置不起作用。非常感谢任何提示。

PS如果这已经在某处得到了回答,请原谅我。我还没有找到解决办法。

java dependency-management maven-plugin maven

2
推荐指数
1
解决办法
3682
查看次数

JUnit,参数化测试超时

我使用 JUnit 的参数化测试功能,用不同的配置一次又一次地运行相同的测试。我的问题是测试超时是否适用于每个测试运行单独还是集体。

更具体地说:如果我只使用一个参数运行测试,并且测试超时为 10 分钟,那么如果我再添加两个条目来运行同一测试,测试超时是否会变为 30 分钟?

如果没有,那么我该如何配置它?

java junit

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

catalina.sh jdpa start无法启动服务器

我试图调试webapp所以我想将远程调试器连接到apache tomcat.但是,当我运行命令"catalina.sh jdpa start"时,它不会启动服务器而是向我显示此信息

./catalina.sh jdpa run
使用CATALINA_BASE:/Users/rsingh/work/apache-tomcat-7.0.27*
使用CATALINA_HOME:/Users/rsingh/work/apache-tomcat-7.0.27
使用CATALINA_TMPDIR:/ Users/rsingh/work/apache-tomcat-7.0.27/temp
使用JRE_HOME:/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
使用CLASSPATH:/ Users/rsingh/work/apache-tomcat-
7.0.27/bin/bootstrap.jar:/Users/rsingh/work/apache-tomcat-7.0.27/bin/tomcat-juli.jar
用法:catalina.sh(commands ...)
命令:
debug在调试器中启动Catalina
debug -security Debug Catalina使用安全管理器
jpda start启动Catalina,在JPDA调试器下
运行Start Catalina在当前窗口中
运行-security在当前窗口中
启动,安全管理器启动启动Catalina在单独的窗口中
启动-security 在一个单独的窗口中启动安全管理器
停止停止Catalina等待最多5秒钟的过程结束
停止n停止卡塔利娜,等待n秒钟进程结束
停止-force停止卡塔利娜,等待 到5秒然后使用kill -KILL如果仍然运行
stop n -force Stop Catalina,等待n秒然后使用kill -KILL如果仍在运行
configtest在server.xml上运行基本语法检查 - 检查结果
版本的退出代码你在运行什么版本的tomcat?
注意:等待进程结束并使用-force选项需要定义$ CATALINA_PID
*

我没有看到为apache创建日志文件,我没有看到我启动服务器的语法中的任何错误.有没有人遇到过它?

apache tomcat remote-debugging

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