小编eul*_*ler的帖子

如何在禁用锚点中添加禁止循环?

我有一个锚标记,我希望在悬停时出现禁止圆形的字形.我知道添加禁用的类只会改变外观而不是它的功能.请注意,此链接不是导航组件,列表或btn组的一部分,只是一个在单击时会触发模态的链接.

我希望在您将鼠标悬停在已禁用的链接上时遵循此行为,如下所示:已禁用链接

<div>
    <a class="disabled" data-toggle="modal" data-target="#notAvailable">Not Available</a>
</div>
Run Code Online (Sandbox Code Playgroud)

html css twitter-bootstrap twitter-bootstrap-3

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

如何在不切割单词的情况下在中间缩写字符串

我正在使用StringUtils.abbreviateMiddle(string, middle, targetLength);缩写中间的字符串,但使用此方法切断了单词.有没有一种方法,它只会在最接近弦的中间位置的空间切断弦?

public static String shortenStringMiddle(String string, String middle, int targetLength) {
    targetLength = Math.abs(targetLength);

    if (string != null && string.length() > targetLength) {

        return StringUtils.abbreviateMiddle(string, middle, targetLength);
    }
    else {
        return string;
    }
}
Run Code Online (Sandbox Code Playgroud)

输入如果应用于此文本:

东南亚鱼虾养殖的疾病控制 - 诊断和畜牧技术:SEAFDEC-OIE研讨会论文集 - 东南亚鱼虾养殖疾病控制研讨会 - 诊断和畜牧技术,2001年12月4日至6日,伊洛伊洛市,菲律宾

System.out.println(StringUtils.abbreviateMiddle("Disease Control in Fish and Shrimp Aquaculture in Southeast Asia - Diagnosis and Husbandry Techniques: Proceedings of the SEAFDEC-OIE Seminar-Workshop on Disease Control in Fish and Shrimp Aquaculture in Southeast Asia - Diagnosis and …
Run Code Online (Sandbox Code Playgroud)

java string

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

如何使用pdfbox连接两个pdf并保留书签和pdf/a合规性?

码:

    /**
 * Creates a
 * cited document from the given bitstream of the given item. This
 * requires that bitstream is contained in item.
 * <p>
 * The Process for adding a cover page is as follows:
 * <ol>
 *  <li> Load source file into PdfReader and create a
 *     Document to put our cover page into.</li>
 *  <li> Create cover page and add content to it.</li>
 *  <li> Concatenate the coverpage and the source
 *     document.</li>
 * </p> …
Run Code Online (Sandbox Code Playgroud)

java pdf pdfa dspace pdfbox

5
推荐指数
0
解决办法
659
查看次数

如果我在文件中有翻译,如何在DSpace中翻译或替换主题词

如果语言被切换,我想翻译我正在维护的DSPace实例中item-view.xsl中显示的主题(MeSH)术语.以前我使用下面的代码(我在XSLUtils.java课堂上添加了这个代码)来查找Babelmesh网站并动态翻译它.

    public static String lookupBabelMeSH(String term, String lang) {
    try {
        URLConnection babelMeshConn = (new URL("https://babelmesh.nlm.nih.gov/mesh_trans.php?oterm=" + URLEncoder.encode(term, "UTF-8") + "&in=ENG&out=" + lang)).openConnection();
        babelMeshConn.setConnectTimeout(5000);
        babelMeshConn.setReadTimeout(5000);

        BufferedReader in = new BufferedReader(new InputStreamReader(babelMeshConn.getInputStream(), "UTF-8"));
        String value = in.readLine();
        in.close();

        if (!StringUtils.isEmpty(value)) {
            return value;
        }
    } catch (MalformedURLException mue) {

    } catch (IOException ioe) {

    }

    return null;
}
Run Code Online (Sandbox Code Playgroud)

然后我就这样使用它item-view.xsl:

  <xsl:choose>
    <xsl:when test="$active-locale!='en'">
      <xsl:variable name="current-locale">
        <xsl:if test="$active-locale='fr'">
          <xsl:text>FRE</xsl:text>
        </xsl:if>
        <xsl:if test="$active-locale='zh'">
          <xsl:text>CHN</xsl:text>
        </xsl:if>
      </xsl:variable>
      <xsl:variable name="translation">
        <xsl:value-of select="util:lookupBabelMeSH(node(),$current-locale)"/> …
Run Code Online (Sandbox Code Playgroud)

java xslt-1.0 dspace

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

在数组中除最后一个项目之外的项目之间插入分号

根据这篇文章中接受的答案,我有这个代码:

if (authors.length >= 1) {
    System.out.print(authors[0]);
}

for (int i = 1; i < authors.length; i++) {
    System.out.print("; " + authors[i]);
}
Run Code Online (Sandbox Code Playgroud)

所以这个的输出是author1; author2; author3 如何将其改为author1; author2 & author3?如果只有2位作者,那么输出应该是author1 & author2.提前致谢.

java loops

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