小编bad*_*son的帖子

jquery:$().animate()不是函数

我做了很多搜索,无法找到我的问题的答案,所以这里.

我正在尝试使用本教程创建一个滑动切换菜单,我收到一个错误slideoutMenu.animate is not a function

这是有问题的html div:

<div id="corner-button"><a href="#" class="slideout-menu-toggle">myLink</a></div>

    <div class="slideout-menu">
            <h3><a href="#" class="slideout-toggle">Toggle</a></h3>
            <ul>
                <li>Add new task</li>
                <li>See completed tasks</li>
                <li>Go to metrics page</li>
            </ul>
        </div>
Run Code Online (Sandbox Code Playgroud)

这是我的js函数:

$(document).ready(function(){
    $('.slideout-menu-toggle').on('click', function(event){
        event.preventDefault();
        console.log("in the toggle func");
            var slideoutMenu = $(".slideout-menu");
            var slideoutMenuWidth = $(".slideout-menu").width();
            console.log("width : " + slideoutMenuWidth);
            slideoutMenu.toggleClass("open");

            if(slideoutMenu.hasClass("open")){
                console.log("open....");
                slideoutMenu.animate({
                    left: "0px"
                }, 500);
            } else {
                slideoutMenu.animate({
                left: -slideoutWidth
                }, 250);
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

我已经尝试了很多东西,将上面的内容包含在一个简单的javascript函数中并使用

(function($){
    // code here
}) …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

chartjs:如何在条形图中设置自定义比例

Chartjs是一个非常优秀的开源工具,但有一个关于我正在尝试创建的条形图的快速问题.鉴于此图表数据:

    var chartData = {
        labels : labels,
        datasets :[
            {
                fillColor : "rgba(220,220,220,0.5)",
                strokeColor : "rgba(220,220,220,0.8)",
                highlightFill: "rgba(220,220,220,0.75)",
                highlightStroke: "rgba(220,220,220,1)",
                scaleOverride: true,
                scaleSteps: 9,
                data : values
            }
        ]   
    }
Run Code Online (Sandbox Code Playgroud)

我曾希望图表的最高值为10,无论是否有10的值.我认为scaleOverride和scaleSteps会实现这一点.

有可能得到那个输出吗?我通过文档,没有看到任何其他明显的选项设置.

更新

让它工作.我的原帖不包括底部的javascript函数.

<div class="barChartTest" id="rating_12229" onload="drawChart();">
<input type="hidden" class="rating-component" comp-name="test1" comp-value="6"/>
<input type="hidden" class="rating-component" comp-name="test2" comp-value="7"/>
<input type="hidden" class="rating-component" comp-name="test3" comp-value="6"/>
<input type="hidden" class="rating-component" comp-name="test4" comp-value="5"/>
<input type="hidden" class="rating-component" comp-name="test5" comp-value="1"/>
</div> 
<canvas id="rating_12229" width="50" height="20"></canvas>
Run Code Online (Sandbox Code Playgroud)

这是我的javascript:

function buildRatingChartData(ratingId){
    var comps = document.getElementById(ratingId).getElementsByClassName("rating-component");   
    var labels = []; …
Run Code Online (Sandbox Code Playgroud)

javascript chart.js

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

在处理SICP之前,我的数学背景应该有多深?

嗨,我一直在尝试通过SICP书的方式工作,我发现自己抄袭了一些在线答案,但得到了递归与迭代程序的整体想法等等.但是我得到了增长部分的订单,数学真的超出了我的脑海.

为了说明我的数学技能,今天早上我花了一个小时学习如何用指数加减分数....

无论如何,我的数学印章必须提升,我将继续努力.但在处理SICP之前,是否有一个简短的概念清单?我会解决这本该死的书,如果它杀了我......我认为这很棒,但我想以最好的方式接近它.

现在我觉得我的时间可能最适合处理一些基本的算法,而我正在把数学排在一起.

有什么建议?谢谢!BP

math scheme

5
推荐指数
3
解决办法
1613
查看次数

休眠外键问题:执行DDL“更改表...”时出错

我有一个非常简单的对象结构,这给我一个我无法解决的错误。做了大量的搜索,我认为这一定是一个很常见的用例,所以不确定是什么问题。我有以下三个课程:

@Entity
public class Widget {

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int idd;
    private Date date;
    private String type;
    private int ownerId;

    @OneToOne(cascade = CascadeType.ALL)
    private Rating rating;


    @OneToMany(cascade = CascadeType.ALL)
    private List<Tag> tagList;


}


@Entity
public class Rating {
public enum ChartType  {RADAR, BAR, LINE, STAR};

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int ratingId;
private String name;

@Enumerated(EnumType.STRING)
private ChartType chartType;
private double normalizedValue;

@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
private List<RatingComponent> componentList = new ArrayList<>();


public Rating() {
    buildNormalizedValue();
}
}


@Entity
public …
Run Code Online (Sandbox Code Playgroud)

java hibernate hibernate-mapping

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

eXist xml db:java.lang.NoClassDefFoundError:org/apache/ws/commons/serialize/DOMSerializer

我试图访问使用嵌入式方法的eXist中XML DB,如所描述这里.

该页面有一个类路径所需的jar列表,​​我在那里有所有这些,但我一直收到这个错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/ws/commons/serialize/DOMSerializer
Run Code Online (Sandbox Code Playgroud)

这是我在课堂上的内容; 我正在使用eclipse:

antlr-2.7.7.jar
commons-collections-3.2.1.jar
commons-logging-1.1.1.jar
commons-pool-1.6.jar
exist-modules.jar
exist-optional.jar
exist.jar
jta-1.1.jar
log4j-1.2.17.jar
pkg-repo.jar
quartz-2.1.6.jar
slf4j-api-1.7.2.jar
slf4j-log4j12-1.7.2.jar
sunxacml-1.2.jar
xmldb.jar
xmlrpc-client-3.1.3.jar
xmlrpc-common-3.1.3.jar
xmlrpc-server-3.1.3.jar
saxonhe-9.4.0.7.jar
serializer-2.7.1.jar
xalan-2.7.1.jar
xercesImpl-2.11.0.jar
xml-apis-1.4.01.jar
xml-resolver-1.2.jar
Run Code Online (Sandbox Code Playgroud)

这是相关代码:

        System.out.println("trying to call class.forname on " + DRIVER);
        Class cl = Class.forName(DRIVER);

        System.out.println("creating db instance");
        Database database = (Database) cl.newInstance();
        database.setProperty("create-database", "true");

        System.out.println("register database");
        DatabaseManager.registerDatabase(database);

        System.out.println("getting collection: " + URI + collectionName);
        Collection collection = DatabaseManager.getCollection(URI + collectionName);
        //collection.setProperty(OutputKeys.INDENT, "yes");

        //System.out.println("getting resource"); …
Run Code Online (Sandbox Code Playgroud)

java xml exist-db

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

sqlalchemy + pyodbc如何信任证书?

我有一个使用 pyodbc 的 python 脚本,它连接到远程服务器,并在其上运行 sql 服务器。我有一个使用 sqlalchemy 编写的函数的包,我可以在我的一台计算机上使用它。我用这个字符串连接:

driver = 'SQL+Server+Native+Client+11.0'
engine_string = prefix + '://' + username + ':' + password + '@' + server + '/' + database + '?driver=' + driver
Run Code Online (Sandbox Code Playgroud)

在另一台计算机上,我无法安装本机客户端 11.0,我知道该客户端已被弃用。我尝试将值切换为

driver = 'ODBC+Driver+18+for+SQL+Server'
Run Code Online (Sandbox Code Playgroud)

我在该版本中遇到错误

[ODBC Driver 18 for SQL Server]SSL Provider: The certificate chain was issued by an authority that is not trusted.
Run Code Online (Sandbox Code Playgroud)

然后我尝试了与 Windows 实用程序的通用 odbc 连接,并得到了相同的错误。当我检查“信任服务器证书”时,我能够使 odbc 管理器连接正常工作

从长远来看,这可能不太好,但是有没有办法将该属性添加到上面的第一个字符串中?我尝试了几种变体,但没有任何效果。

我能够与以下内容建立工作连接:

cnxn = pyodbc.connect( 
driver = '{ODBC Driver 18 for SQL Server}', …
Run Code Online (Sandbox Code Playgroud)

python sql-server odbc pyodbc

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

排除结果前缀不起作用

我正在尝试编写一个 xslt 转换,该转换在输出的根元素中不包含任何 @xmlns:* 属性。给定这个 xml :

<?xml version="1.0" encoding="UTF-8"?>
<jw:root xmlns:jw="http://lexisnexis.com/neptune/gtdttest/jw">
    <jw:a/>
    <b test="1">
        <c/>
    </b>
</jw:root>
Run Code Online (Sandbox Code Playgroud)

和这个样式表

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    version="2.0"
    xmlns:jw="http://namespace/test/jw" exclude-result-prefixes="jw">

<xsl:template match="node()|@*">
    <xsl:copy>

         <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="@test"/>

</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)

我得到这个:

<?xml version="1.0" encoding="UTF-8"?>
<jw:root xmlns:jw="http://lexisnexis.com/neptune/gtdttest/jw">
    <jw:a/>
    <b>
        <c/>
    </b>
</jw:root>
Run Code Online (Sandbox Code Playgroud)

我尝试过 - 将 @exclude-result-prefixes 放在根模板上, - 不复制属性, - 不在身份模板中使用“复制”,而是使用 - 使用 #all

我在规范中读过,虽然我现在找不到它,但它<xsl:copy/>忽略了 @exclude-result-prefixes,并且其他东西也可以覆盖它。

有什么方法可以删除那些 @xmlns:[prefix] atts?ns 是在输出使用的 dtd 中定义的,这让我很困惑将它们放在那里。猜猜我将不得不单独通过java打开并以这种方式删除?

谢谢!

xml xslt xml-namespaces

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

MockMvc 测试:jsonPath,测试返回的每个元素都包含子字符串

我正在做集成测试,返回值是一个json对象数组。下面这行代码匹配没有错误:

        mockMvc.perform(MockMvcRequestBuilders.get(uri)
            .param("name", text)
            .accept(MediaType.APPLICATION_JSON))
            .andDo(print())
            .andExpect(status().isOk())
            .andExpect(MockMvcResultMatchers.jsonPath("$[0].name", Matchers.containsString("div3")));
Run Code Online (Sandbox Code Playgroud)

但是当我更改$[0].name为时$[*].name出现错误

java.lang.AssertionError: JSON path "$[*].name"
Expected: a string containing "div3"
 but: was a net.minidev.json.JSONArray (<["Testing Custom Searches div3: 1","Testing Custom Searches div3: 4","Testing Custom Searches div3: 7","Testing Custom Searches div3: 10","Testing Custom Searches div3: 13","Testing Custom Searches div3: 16","Testing Custom Searches div3: 19"]>)
Run Code Online (Sandbox Code Playgroud)

我一直在四处寻找,但没有找到答案...有没有办法检查每个 *.name 元素是否包含给定的子字符串?

integration-testing jsonpath spring-boot mockmvc

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