走过海棠暮

文章 0 评论 0 浏览 24

走过海棠暮 2024-11-10 23:31:02

更好地看看这个例子,即使我返回或传播异常,资源也总是关闭的。

try {
 //action A
 return 0;
} catch (Exception e){
 //action C
 throw new Excpetion("Probleme here",e)
} finnaly {
 //action C
 resources.close();
}

如果动作 A 和 be 和 int a = 0 一样原始,那么没有区别,但在像这样更复杂的情况下,finnaly 块有它的用法

Better look at this example, resources are allways closed even if I return or propagate the Excpetion up.

try {
 //action A
 return 0;
} catch (Exception e){
 //action C
 throw new Excpetion("Probleme here",e)
} finnaly {
 //action C
 resources.close();
}

If action A and be are as primitve as int a = 0, then there is no difference, but in more complicated situations like this, finnaly block have it's usage

最后和没有最终有什么区别?

走过海棠暮 2024-11-10 20:42:22

澄清序列的实例与 XPath/XSLT 中的其他任何内容一样都是不可变的,答案是肯定的

  1. 迭代序列

    
     
     <!--。是序列的当前项-->
    
    
  2. 将项目添加到序列(生成一个作为此操作结果的新序列):

     insert-before($target as item()*,
                     $position 作为 xs:integer,
                     $插入为 item()*) as item()*
    

摘要:返回根据 $target 的值构造的新序列
$inserts 的值插入于
由值指定的位置
$位置。 ($target 的值为
不受顺序影响
施工。)

.3. 两个序列的串联(产生一个新序列即此操作的结果):

   $seq1 , $seq2

..4。 从序列中删除项目

     remove($target as item()*, $position as xs:integer) as item()*

摘要:返回根据 $target 的值构造的新序列
与该位置的项目
由 $position 的值指定
已删除

..5。 从序列中提取子序列

 子序列($sourceSeq as item()*,
               $startingLoc 为 xs:double,
               $length as xs:double) **as item**()*

摘要:返回值中项目的连续序列
$sourceSeq 从该位置开始
由 $startingLoc 的值指示
并继续计算项目数量
由$length的值表示。

还有许多更有用的序列上的标准 XPath 2.0 函数

注意:XPath 2.0 序列唯一不具备的功能是“嵌套性”。序列始终是“平坦的”,并且序列中的一项不能是序列本身。有多种方法可以模拟多级序列——例如,一个项目可以是一个节点,它的子节点可以被视为一个嵌套序列。

更新:以下是如何方便地使用这些函数来解决OP的更新问题:

<xsl:stylesheet version="2.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:my="my:my" >

 <xsl:template match="/">
  <xsl:sequence select="my:populateSequence((), 1, 10)"/>
 </xsl:template>

 <xsl:function name="my:populateSequence" as="xs:integer*">
  <xsl:param name="pSeq" as="xs:integer*"/>
  <xsl:param name="pStart" as="xs:integer"/>
  <xsl:param name="pEnd" as="xs:integer"/>

  <xsl:sequence select=
   "if($pStart gt $pEnd)
      then $pSeq
      else my:populateSequence(($pSeq, $pStart), $pStart+1, $pEnd)
   "/>
 </xsl:function>
</xsl:stylesheet>

当此XSLT 2.0转换应用于任何XML文档(未使用)时,就会产生想要的结果< /强>:

1 2 3 4 5 6 7 8 9 10

With the clarification that an instance of a sequence, as anything else in XPath/XSLT are immutable, the answer is positive:

  1. Iterating over a sequence:

    <xsl:for-each select="$seq">
     <!-- Whatever necessary code here -->
     <!-- . is the current item of the sequence-->
    </xsl:for-each>
    
  2. Add an item to a sequence (produces a new sequence that is the result of this operation):

       insert-before($target as item()*,
                     $position as xs:integer,
                     $inserts as item()*) as item()*
    

Summary: Returns a new sequence constructed from the value of $target
with the value of $inserts inserted at
the position specified by the value of
$position. (The value of $target is
not affected by the sequence
construction.)

.3. Concatenation of two sequences (produces a new sequence that is the result of this operation):

   $seq1 , $seq2

..4. Remove an item from a sequence:

     remove($target as item()*, $position as xs:integer) as item()*

Summary: Returns a new sequence constructed from the value of $target
with the item at the position
specified by the value of $position
removed

..5. Extract a subsequence from a sequence:

   subsequence($sourceSeq as item()*,
               $startingLoc as xs:double,
               $length as xs:double) **as item**()*

Summary: Returns the contiguous sequence of items in the value of
$sourceSeq beginning at the position
indicated by the value of $startingLoc
and continuing for the number of items
indicated by the value of $length.

And there are many more useful standard XPath 2.0 functions over sequences.

Note: The only feature that the XPath 2.0 sequence doesn't have is "nestedness". A sequence is always "flat" and an item of a sequence cannot be a sequence itself. There are ways to simulate multi-level sequences -- for example, an item can be a node and its children nodes can be regarded as a nested sequence.

Update: Here is how these functions can be used conveniently to solve the OP's updated question:

<xsl:stylesheet version="2.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:my="my:my" >

 <xsl:template match="/">
  <xsl:sequence select="my:populateSequence((), 1, 10)"/>
 </xsl:template>

 <xsl:function name="my:populateSequence" as="xs:integer*">
  <xsl:param name="pSeq" as="xs:integer*"/>
  <xsl:param name="pStart" as="xs:integer"/>
  <xsl:param name="pEnd" as="xs:integer"/>

  <xsl:sequence select=
   "if($pStart gt $pEnd)
      then $pSeq
      else my:populateSequence(($pSeq, $pStart), $pStart+1, $pEnd)
   "/>
 </xsl:function>
</xsl:stylesheet>

When this XSLT 2.0 transformation is applied on any XML document (not used), the wanted result is produced:

1 2 3 4 5 6 7 8 9 10

XSL - 列出等效实现

走过海棠暮 2024-11-10 18:01:17

通过编码我们可以这样使用

android.R.drawable.ic_menu_save

by coding we can use like this

android.R.drawable.ic_menu_save

Android系统中的基本图标是继承的吗?

走过海棠暮 2024-11-10 15:51:39

您无法使用 Visual Studio 完成 ReSharper 为您提供的功能。如果是这样,JetBrains 将永远不会出售副本。

它被认为比我工作的 Visual Studio 的基本功能有了足够的改进,公司中的每个 .NET 开发人员都使用它。如果没有它,没有人会写出一行 C#。 Cool 与此无关,而且该公司对许可费也毫不犹豫。这是值得的。

You can't do what ReSharper gives you with Visual Studio. If that were the case, JetBrains would never sell a copy.

It's considered enough of an improvement over bare bones Visual Studio where I work that every .NET developer in the company uses it. No one writes a line of C# without it. Cool has nothing to do with it, and the company doesn't balk at the license fees. It's worth it.

我为什么应该购买 ReSharper 或 CodeRush?

走过海棠暮 2024-11-10 12:15:31

您的 server.xml 中是否定义了 jvmRoute?
这是文档:
http://tomcat.apache.org/tomcat-5.5-doc/config /engine.html
我会查看您的 server.xml 但链接错误。

Do you have a jvmRoute defined in your server.xml?
Here are the docs:
http://tomcat.apache.org/tomcat-5.5-doc/config/engine.html
I would have looked at your server.xml but the link is wrong.

Spring Session 复制问题

走过海棠暮 2024-11-10 11:28:28

这只是为了对使用按位运算符时发生的情况进行一些解释。

假设我们有一个 1 字节(8 位)值:val1 = 00000011。我们还有另一个 1 字节值:val2 =00100001

如果我们将 val1 的位向左移动 2,如下所示:

val1 = val1 << 2;

val1 现在看起来像这样:00001100 然后,

如果我们像这样将 val2 与 val1 进行 OR (|) 运算:

val1 = val1 | val2

val1 将如下所示:00101101。

我希望这会有所帮助 ^_^

This is just to give a bit of explanation on what's happening when you use bitwise operators.

Let's say we have a 1 byte (8 bits) value: val1 = 00000011. And we have another 1 byte value: val2 =00100001

If we shift the bits of val1 to the left 2, like so:

val1 = val1 << 2;

val1 now looks like this: 00001100.

Then, if we OR (|) val2 with val1 like this:

val1 = val1 | val2

val1 will look like this: 00101101.

I hope this helps ^_^

从位数组重建值

走过海棠暮 2024-11-10 03:54:05

链接需要是 display: block; 以便能够获取高度和宽度

以使块级链接仍然并排显示,您应该浮动li 项目或使它们 display: inline-block;

例如,使用 float 表示 li 并使用一些颜色进行可视化

#header .nav_wrapper ul {
    font-family: "Zurich Cn BT", Tahoma;
    font-size: 12px;    
    list-style: none;
    margin: 0;
    padding: 0;
}

#header .nav_wrapper li {
    float: left;
    width: 72px;
    height: 30px;
    margin-right: 15px;
    background: #eee;
    text-align: center;
}

#header .nav_wrapper li a {
  display: block; 
  line-height: 30px;
  }

ul.nav li a, ul.nav li a:visited, ul.nav li a:focus {
    color: #764422;
    text-decoration: none;    
}

ul.nav li a:hover, ul.nav li a:active {
    color: #fff;
    background: #444 url(../images/nav-bg.png);
}

the <a> links need be display: block; in order to be able to take height and width

to make the block level links still display side by side you should float the li items or make them display: inline-block;

e.g. using float for the li's and some colors for visualisation

#header .nav_wrapper ul {
    font-family: "Zurich Cn BT", Tahoma;
    font-size: 12px;    
    list-style: none;
    margin: 0;
    padding: 0;
}

#header .nav_wrapper li {
    float: left;
    width: 72px;
    height: 30px;
    margin-right: 15px;
    background: #eee;
    text-align: center;
}

#header .nav_wrapper li a {
  display: block; 
  line-height: 30px;
  }

ul.nav li a, ul.nav li a:visited, ul.nav li a:focus {
    color: #764422;
    text-decoration: none;    
}

ul.nav li a:hover, ul.nav li a:active {
    color: #fff;
    background: #444 url(../images/nav-bg.png);
}

CSS 悬停图像背景时遇到问题

走过海棠暮 2024-11-09 20:49:02

我假设您谈论的是 Windows 窗体:

要显示窗体,请使用 Show() 方法:

Form form2 = new Form();
form2.Show();

要关闭窗体,请使用 Close():

form2.Close();

I assume your talking about windows forms:

To display your form use the Show() method:

Form form2 = new Form();
form2.Show();

to close the form use Close():

form2.Close();

如何打开第二个表格?

走过海棠暮 2024-11-09 10:43:45

试试这个:

RewriteRule http://www.companyname.com/(.*)/(\d+) http://www.companyname.com/index.php?firstvalue=$1&secondvalue=$2

Try this:

RewriteRule http://www.companyname.com/(.*)/(\d+) http://www.companyname.com/index.php?firstvalue=$1&secondvalue=$2

让 URL 动态看起来不错

走过海棠暮 2024-11-09 10:37:15

您可能会发现 Timpani Software 的 MergeMagician 工具很有趣。它是一个分支管理和自动合并解决方案,可与 TFS(以及 Subversion)配合使用。您在分支之间创建发布/订阅关系,然后服务器自动进行合并。

MM 可用于实现 Shawn 提到的 TFS 分支指南中讨论的所有模式。

仅供参考,它是一个商业工具。我不知道有任何开源工具可以与 TFS 一起执行类似的操作。

请访问 http://www.timpanisoftware.com 查看。主页上有一个很好的概述视频。

You might find Timpani Software's MergeMagician tool interesting. It is a branch management and automated merging solution that works with TFS (and also Subversion). You create publish/subscribe relationships between branches, and then the server automates the merges.

MM can be used to implement all of that patterns discussed in the TFS Branching Guide that Shawn mentioned.

FYI, it is a commercial tool. I don't know of any open source tools that do anything like this that work with TFS.

Check it out at http://www.timpanisoftware.com. There's a good overview video on the home page.

TFS 分支和合并策略

走过海棠暮 2024-11-09 08:57:45

如果您的目标是在 Jenkins 中执行 Jython 代码,您可能需要查看 Jython 插件

从版本 1.6 开始,您实际上可以安装 Jython 软件包(假设您有自己想要使用的库),并且它会自动在所有 Jenkins 从属设备之间同步软件包。

If your goal is to execute Jython code within Jenkins, you may want to have a look at the Jython Plugin.

Starting version 1.6, you can actually install Jython packages (say if you have your own library you'd like to use), and it'll automatically sync up the packages across all Jenkins slaves.

我可以使用 Jython/Python 扩展 Jenkins

走过海棠暮 2024-11-09 05:07:38

尝试一下,因为当我想对 TextView 执行此操作时,上述建议对我不起作用:

TextView.setScrollbarFadingEnabled(false);

祝你好运。

Try this as the above suggestions didn't work for me when I wanted to do this for a TextView:

TextView.setScrollbarFadingEnabled(false);

Good Luck.

如何始终显示滚动条

走过海棠暮 2024-11-09 03:39:27

try-catch 中使用 :colorscheme 作为 Randy 已完成 如果您只想加载它(如果存在)并执行其他操作,则可能就足够了。如果您对 else 部分不感兴趣,可以使用简单的 :silent! colorcheme 就足够了。

否则, globpath() 是要走的路。然后,如果您确实愿意,可以检查使用 filereadable() 返回的每个路径。

" {rtp}/autoload/has.vim
function! has#colorscheme(name) abort
    let pat = 'colors/'.a:name.'.vim'
    return !empty(globpath(&rtp, pat))
endfunction

" .vimrc
if has#colorscheme('desert')
     ...

编辑: fileread($HOME.'/.vim/colors/'.name.'.vim') 可能看起来很简单,而且绝对有吸引力,但如果我们正在寻找的颜色方案,这还不够因为是在别处。通常,如果它已通过插件管理器安装在另一个目录中。在这种情况下,唯一可靠的方法是检查 vim 'runtimepath '(又名'rtp')。因此globpath()。请注意,:colorscheme name 命令在 {rtp}/colors/{name}.vim 中搜索。

Using :colorscheme in a try-catch as Randy has done may be enough if you just want to load it if it exists and do something else otherwise. If you are not interested in the else part, a simple :silent! colorscheme is enough.

Otherwise, globpath() is the way to go. You may, then, check each path returned with filereadable() if you really wish to.

" {rtp}/autoload/has.vim
function! has#colorscheme(name) abort
    let pat = 'colors/'.a:name.'.vim'
    return !empty(globpath(&rtp, pat))
endfunction

" .vimrc
if has#colorscheme('desert')
     ...

EDIT: filereadable($HOME.'/.vim/colors/'.name.'.vim') may seem simple and it's definitively attractive, but this is not enough if the colorscheme we're looking for is elsewhere. Typically if it has been installed in another directory thanks to a plugin manager. In that case the only reliable way is to check in the vim 'runtimepath' (a.k.a. 'rtp'). Hence globpath(). Note that :colorscheme name command searches in {rtp}/colors/{name}.vim.

在我的 .vimrc 中,如何检查配色方案是否存在?

走过海棠暮 2024-11-09 02:27:53

该语言是否支持面向对象对于您的目的来说并不重要。毕竟,PHP 支持对象,而且您似乎用得很好。

就我个人而言,我建议从 Java 或 C# 开始。这两种语言的社区非常庞大,并且有大量在线教程可以帮助您入门。

使用 Visual Studio Express 开始编写 C# 非常容易。还有一个很好的hello world 教程

另外,如果您坚持使用 C#,则可以利用 WMI 将使您能够完成该项目所需的一切(以及更多)。

最后,大多数 Windows 计算机将能够运行您的应用程序,而无需安装任何额外的东西,并且 Visual Studio 会在构建过程中为您构建 .exe。

Whether or not the language supports OO doesn't really matter for your purposes. After all, PHP supports objects and you seem to do just fine with it.

Personally, i'd recommend Java or C# to get started with. The communities for these two languages are huge and there are plenty of tutorials online to help you get started.

It's extremely easy to get starting writing C# with Visual Studio Express. And a good hello world tutorial.

Also, if you stick with C# you can take advantage of WMI which will allow you to do everything you need for this project (and much much more).

Lastly, most windows machines will be able to run your application without having to install anything extra and Visual Studio builds the .exe for you as part of the build process.

Web 开发人员可以使用哪种非面向对象语言来创建一次性桌面应用程序?

更多

推荐作者

书间行客

文章 0 评论 0

神妖

文章 0 评论 0

undefined

文章 0 评论 0

38169838

文章 0 评论 0

彡翼

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文