小编use*_*082的帖子

通过带有angularjs和ionic的html img标签显示图像

我目前正在使用离子和Angularjs 进行混合移动应用程序,我正试图通过img html标签显示图像.我的页面由顶部的caroussel(效果很好,显示图像)和带有小图像的列表组成.在我的页面的控制器中有:

app.controller('SalleCtrl', function ($scope,$location) {

$scope.salle = {
    "num": "2",
    "imgR": [
        "img/art_affiche_6_thumb-300x300.jpg",
        "img/art_affiche_6_thumb-300x300.jpg"
    ],
    "title": "Salle 2 : Premières peintures",
    "_audio_guide": [],
    "_audio_guide_fe": [],
    "_audio_guide_en": [],
    "artworks": [
        {
            "img": "img/art_affiche_6_thumb-300x300.jpg",
            "href": "http://172.16.12.158/wordpress/mcm_oeuvre/oeuvre-14-2/",
            "title": "Oeuvre 14"
        },
        {
            "img": "img/art_affiche_9_thumb-300x300.jpg",
            "href": "http://172.16.12.158/wordpress/mcm_oeuvre/oeuvre-3/",
            "title": "Oeuvre 3"
        }
    ]
};
});
Run Code Online (Sandbox Code Playgroud)

在我的HTML页面中有:

<ion-view title="{{salle.title}}">

<ion-nav-buttons side="right">
    <button menu-toggle="right" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>
<ion-content class="has-header" id="" >
    <ul rn-carousel class="image">
         <li ng-repeat="image in salle.imgR" style="background-image:url({{ image }});background-color:black;background-repeat:no-repeat;background-position:center …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery angularjs

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

从ajax post请求下载带有jquery的zip文件

我想知道是否可以对特定网址发送ajax post请求并仅在请求时接收数据中的zip文件?或者我必须发送两个请求...一个,为了将zip文件的url放在已创建的服务器中,另一个请求下载zip文件?

php ajax jquery

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

Sonar抱怨:使用StringBuilder而不是StringBuffer

我目前正在做一段代码,必须能够匹配一些正则表达式,并在匹配正则表达式的字符串中进行一些替换.

为了做到这一点,我在java中使用matcher对象.但正如您可以在互联网上看到的那样,所有示例都使用StringBuffer来使用appendreplacement和appendtail方法(oracleDoc)进行替换.

但是当我推送我的代码时,Sonar抱怨使用stringbuffer而不是stringbuilder.

  • 在这种情况下,Sonar的这个警告是错误的吗?
  • 是否有任何库使用stringbuilder执行相同的操作?

显然,一些开发人员抱怨这里.

我找到了一种不使用StringBuffer并使用StringBuilder的方法,但我确信这不如使用StringBuffer那样有效(并且可能是一种不好的做法).您可以在junit测试中复制粘贴,此示例代码如下:

    String entry = "Actual 4.11-6 and 13-5";
    String expectedReturn = "Actual 4*11^(-6) and 13^(-5)";

    String number = "(^|\\s)-?\\d+((\\.||,)\\d+){0,1}(.\\d+){0,1}-\\d+";
    Pattern pattern = Pattern.compile(number);
    Matcher matcher = pattern.matcher(entry);

    //USING STRING BUFFER
    StringBuffer stringBuffer = new StringBuffer();
    String substring;
    while(matcher.find()){
        substring = matcher.group(0);
        matcher.appendReplacement(stringBuffer,substring.replace(".","*").replace("-","^(-")+")");
    }
    matcher.appendTail(stringBuffer);

    //USING STRING BUILDER
    matcher = pattern.matcher(entry);
    int lastIndex = 0;
    StringBuilder stringBuilder = new StringBuilder();
    while(matcher.find()){
        stringBuilder.append(entry.substring(lastIndex,matcher.start()));
        substring = matcher.group(0);
        stringBuilder.append(substring.replace(".","*").replace("-","^(-")+")");
        lastIndex = matcher.end(); …
Run Code Online (Sandbox Code Playgroud)

java stringbuilder append stringbuffer sonarqube

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