小编Ace*_*Ace的帖子

查找3个日期中最早的日期

我在Java中有三个日期:a,b,c.任何或所有这些日期可能为空.在没有大量if-else块的情况下,确定a,b,c中最早日期的最有效方法是什么?

java date

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

XSL:用xml标签替换某些字符

这个有点棘手,我已经坚持了一段时间.我想做的是用标签代替括号'['(例如按钮,链接等),代替']'

<section>
    <title>Buttons</title>
    <orderedlist>
        <listitem>
            <para>Clicking on [Save] will attempt to save changes, then it navigates to <xref linkend="saved" xrefstyle="select: title"/>.</para>
        </listitem>
        <listitem>
            <para>Clicking on [Cancel] navigates to <xref linkend="noSave" xrefstyle="select: title"/>.</para>
        </listitem>
    </orderedlist>
</section>
Run Code Online (Sandbox Code Playgroud)

至:

<section>
    <title>Buttons</title>
    <orderedlist>
        <listitem>
            <para>Clicking on <uicontrol>Save</uicontrol> will attempt to save changes, then it navigates to <xref linkend="saved" xrefstyle="select: title"/>.</para>
        </listitem>
        <listitem>
            <para>Clicking on <uicontrol>Cancel</uicontrol> navigates to <xref linkend="noSave" xrefstyle="select: title"/>.</para>
        </listitem>
    </orderedlist>
</section>
Run Code Online (Sandbox Code Playgroud)

并且'['']'不一定总是在section.listitem.para中

编辑:当括号中的某些单词时,我只需要替换[].

xml xslt replace

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

添加(BezierSegment到a)画布路径

我正在尝试BezierSegment为我的WPF 添加一个画布.我收到了一个不正确演员的编译时错误:

参数1:无法从'System.Windows.Media.PathGeometry'转换为'System.Windows.UIElement'

这就是我到目前为止......

//bezier curve it 
BezierSegment curve = new BezierSegment(startPoint, endPoint,controlPoint,false);

// Set up the Path to insert the segments
PathGeometry path = new PathGeometry();

PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = hs.LeStartingPoint;
pathFigure.IsClosed = true;
path.Figures.Add(pathFigure);

pathFigure.Segments.Add(curve);
System.Windows.Shapes.Path p = new Path();
p.Data = path;
this.mainWindow.MyCanvas.Children.Add(path);
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激!

c# wpf bezier drawing

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

如何将@xml:base 添加到我的 .xml 文件中?

我需要一个样式表来转换我的 docbook xml 文件,以便它们现在在我的部分标签中包含一个 xml:base 元素。我该怎么做(因为 xml:base 需要系统和节点信息???)

输入:

<section xmlns="http://docbook.org/ns/docbook" xml:id="voidVisit" version="5">
<title>Void</title>

 <section>
  <title>Screenshot</title>
      <mediaobject>
          <imageobject>
              <imagedata fileref="screenshots/Dialog.png" />
          </imageobject>
      </mediaobject>
 </section>
</section>
Run Code Online (Sandbox Code Playgroud)

输出:

      ...
      <section xml:id="void" version="5"
           xml:base="file:/C:/Projects/my/proj/trunk/spec/module/components/void.xml">
     <title>Void</title>
     <section>
        <title>Screenshot</title>
        <mediaobject>
           <imageobject>
              <imagedata fileref="screenshots/Dialog.png"/>
           </imageobject>
        </mediaobject>
     </section>
     ...
Run Code Online (Sandbox Code Playgroud)

xml xslt docbook

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

XSL-FO:对表条目强制换行

当我将modspecs发布到pdf(XSL-FO)时,我遇到了一个问题.我的表存在问题,其中单元格的内容会将其列溢出到下一个列中.如何强制中断文本以便创建新行?

我无法手动插入零空格字符,因为以编程方式输入表条目.我正在寻找一个简单的解决方案,我只需添加到docbook_pdf.xsl(作为xsl:param或xsl:属性)

编辑: 这是我目前的地方:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import href="urn:docbkx:stylesheet"/>
...(the beginning of my stylesheet for pdf generation, e.g. header and footer content stuff)
<xsl:template match="text()">
    <xsl:call-template name="intersperse-with-zero-spaces">
        <xsl:with-param name="str" select="."/>
    </xsl:call-template>
</xsl:template>
<xsl:template name="intersperse-with-zero-spaces">
    <xsl:param name="str"/>
    <xsl:variable name="spacechars">
        &#x9;&#xA;
        &#x2000;&#x2001;&#x2002;&#x2003;&#x2004;&#x2005;
        &#x2006;&#x2007;&#x2008;&#x2009;&#x200A;&#x200B;
    </xsl:variable>

    <xsl:if test="string-length($str) &gt; 0">
        <xsl:variable name="c1" select="substring($str, 1, 1)"/>
        <xsl:variable name="c2" select="substring($str, 2, 1)"/>

        <xsl:value-of select="$c1"/>
        <xsl:if test="$c2 != '' and
            not(contains($spacechars, $c1) or
            contains($spacechars, $c2))">
            <xsl:text>&#x200B;</xsl:text>
        </xsl:if>

        <xsl:call-template name="intersperse-with-zero-spaces">
            <xsl:with-param name="str" select="substring($str, 2)"/>
        </xsl:call-template>
    </xsl:if>
</xsl:template> …
Run Code Online (Sandbox Code Playgroud)

xml pdf xslt xsl-fo

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

MVVM - 模型教程?

我目前正在用C#创建一个WPF应用程序,并且一直在关注这个图表.我已经阅读了几篇关于MVVM的文章,但我特意在虚线框下面查找所有内容(详见模型和数据访问).我已经有一个本地数据库设置(SQLite),我正在寻找一种有效的方法将它连接到我的应用程序.

是否有任何关于为MVVM创建此特定部分的好文章或演示?

.net c# sqlite wpf mvvm

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

C#WPF - 拖动图像

我试图获得一些简单的功能,从文件中获取图像,将其添加到Canvas,然后允许用户左键单击(并保持)图像,然后将其拖动到Canvas(即更新图像的地点)

这是我到目前为止,我应该添加什么?

private void btnAddImage_Click(object sender, RoutedEventArgs e) {
    try {
        System.Windows.Forms.OpenFileDialog open = new System.Windows.Forms.OpenFileDialog();
        open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
        if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
            PictureBox PictureBox1 = new PictureBox();
            PictureBox1.Image = new Bitmap(open.FileName);
            myCanvas.children.add(PictureBox1);
        }
    }
    catch (Exception) { throw new ApplicationException("Failed loading image"); }
}
Run Code Online (Sandbox Code Playgroud)

c# wpf image wpf-controls

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

XSL:删除xml标记但保留其内容

我最近将几个我的.xml文件从docbook更改为dita.转换没问题,但有一些不需要的工件.我难以理解的是.dita没有<para>从docbook中识别标签,而是将其替换为<p>.您认为没问题,但这会导致XML在下一行显示项目和有序列表,即:

1
 item One
2
 item Two

代替:

1 item One
2 item Two

所以我该如何改变这个:

<section>
<title>Cool Stuff</title>
<orderedlist>
  <listitem>
    <para>ItemOne</para>
  </listitem>

  <listitem>
    <para>ItemTwo</para>
  </listitem>
</orderedlist>
Run Code Online (Sandbox Code Playgroud)

对此:

<section>
<title>Cool Stuff</title>
<orderedlist>
  <listitem>
    ItemOne
  </listitem>

  <listitem>
    ItemTwo
  </listitem>
</orderedlist>
Run Code Online (Sandbox Code Playgroud)

对不起,我应该更清楚这个问题.我需要从不同深度的doument中删除所有标签,但始终遵循(本地)树listitem/para.我对此有点新意,但是我可以通过将其添加到我的docbook2dita转换中来做错.可以在那个地方吗?

xml xslt docbook dita

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

从列表生成输出文本

我有一个带Java后端的SEAM JSF Web应用程序.我有一个具有显示值的对象列表,我想显示它.由于列表是从DB中检索的,因此它是动态的

<s:decorate>
  <ui:define name="label">Description:</ui:define>
      <!-- foreach book in bookList -> display the description
  <h:outputText value="#{bean.bookList.book.description}"/>
      -->
</s:decorate>
Run Code Online (Sandbox Code Playgroud)

所以在某种程度上我想为标签创建一种foreach循环.

jsf

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

Xaml:C#如何保持风格一致

我正在使用VS 2010中的wpf和C#开发半大型Windows应用程序.在xaml上工作时,我添加了一个标记,以便所有按钮和数据网格以相同的方式设置样式.我已经将这个块复制并粘贴到我的几个.xaml文件中,并且工作正常.当然,我现在遇到的问题是我已经多次添加并更改了样式.

在不同的Windows之间保持样式一致的最佳方法是什么?它是使用Resources.resx进行子类化还是其他方式?

c# wpf xaml visual-studio-2010

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

IE不尊重NBSP

我目前有一个问题,我想要一个标签(在一个表内)所有都在一行,在IE(Firefox似乎很好).但目前它被分成3个:

...
<td class="label"><span class="mandatory">* </span>Starting Date:&nbsp;</td>
...
Run Code Online (Sandbox Code Playgroud)

结果:

*
Starting
Date
Run Code Online (Sandbox Code Playgroud)

期望的结果:

*Starting Date
Run Code Online (Sandbox Code Playgroud)

html internet-explorer

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

标签 统计

c# ×4

wpf ×4

xml ×4

xslt ×4

docbook ×2

.net ×1

bezier ×1

date ×1

dita ×1

drawing ×1

html ×1

image ×1

internet-explorer ×1

java ×1

jsf ×1

mvvm ×1

pdf ×1

replace ×1

sqlite ×1

visual-studio-2010 ×1

wpf-controls ×1

xaml ×1

xsl-fo ×1