小编Sha*_*ank的帖子

Int数组的数组.仅按顺序存储重复项

我需要为有序重复项存储一个Int数组数组(在数组中).

例:

  • 给定数组:
    mainArray = [7, 7, 3, 2, 2, 2, 1, 7, 5, 5]

现在我需要创建一个int数组的2D数组.
例:

Array [][] = [
               [7, 7], 
               [3], 
               [2, 2, 2], 
               [1], 
               [7],
               [5, 5]
             ]
Run Code Online (Sandbox Code Playgroud)

这是我有的:

for var i = 0; i < val.count; i++ {
    var columnArray = Array<Int>()
    for var j in 0...9 {
        if oldNum == val[j]{
            columnArray.append(val[j])
        }
        else {
            array.append(columnArray);
            //j += 1
            break;
        }
        oldNum = val[j];
        j += 1
    }
}
Run Code Online (Sandbox Code Playgroud)

arrays algorithm ios swift

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

在JAR文件中时,URL getResource无法正常工作

我的应用程序加载文件PROJECTNAME/resource夹中的txt文件。

在此处输入图片说明

这是我加载文件的方式:

URL url = getClass().getClassLoader().getResource("batTemplate.txt");
java.nio.file.Path resPath;
String bat = "";

try {
    resPath = java.nio.file.Paths.get(url.toURI());
    bat = new String(java.nio.file.Files.readAllBytes(resPath), "UTF8");
} catch (URISyntaxException | IOException e1) {
        e1.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)

注意:这在我从Eclipse运行时有效,而在我导出到Jar文件(将所需的库提取到生成的JAR中)时不起作用。我知道该文件正在提取中,因为它在JAR文件中。图像也起作用。

在此处输入图片说明

错误MSG:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException:
    Illegal character in path at index 38: file:/C:/DataTransformation/Reports Program/ReportsSetup.jar
        at com.sun.nio.zipfs.ZipFileSystemProvider.uriToPath(ZipFileSystemProvider.java:87)
        at com.sun.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:166)
        at com.sun.nio.zipfs.ZipFileSystemProvider.getPath(ZipFileSystemProvider.java:157)
        at java.nio.file.Paths.get(Unknown Source)
        at ReportSetup$13.mouseReleased(ReportSetup.java:794)
Run Code Online (Sandbox Code Playgroud)

我在这里也看到了类似的问题,但是它们引用的是JAR文件之外的文件/ URL。

java eclipse jar

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

Angularjs不适用于display none样式

我正在尝试将AngularJS与Tippy.JS一起用于工具提示.

Tippy的HTML模板工具提示(#icreating-html-templates)要求我们使用style="display: none"模板,然后处理其余部分.

我想在工具提示模板中使用angularjs功能但是失败了. 在此输入图像描述

这是一个重现问题的小提琴.#小提琴

如果删除style="display: none"它有效,但Tippy没有.

这有什么走势吗?

更新 @Razzildinho解决方案仅用于呈现值.但它无法与控制器通信.它是单向数据绑定,模型为tippy.

在Tippy里面:

在此输入图像描述

外:

在此输入图像描述

小提琴

javascript css angularjs

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

标签 统计

algorithm ×1

angularjs ×1

arrays ×1

css ×1

eclipse ×1

ios ×1

jar ×1

java ×1

javascript ×1

swift ×1