我正在为BigIntegers编写一个波兰表示法计算器(只是*,^和!)而且OutOfMemoryError我正在减去BigInteger.ONE要使阶乘工作的行,为什么?
package polish_calculator;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Stack;
public class Main {
static BigInteger factorial(BigInteger number){
Stack <BigInteger> factorialStack = new Stack<BigInteger>();
factorialStack.push(number);
while (!number.equals(BigInteger.ONE)){ //load the stack
factorialStack.push(number.subtract(BigInteger.ONE)); // here's the error
}
BigInteger result = BigInteger.ONE;
while(!factorialStack.empty()){ // empty and multiply the stack
result.multiply(factorialStack.pop());
}
return result;
}
public static void main(String[] args) throws IOException {
BigInteger testFactorial = new BigInteger("12");
System.out.println(factorial(testFactorial));
Stack <String> stack = new Stack<String>();
BufferedReader …Run Code Online (Sandbox Code Playgroud) 所以我想使用XSL转换以下内容
<doc>
<data id="priority" level="2" include="true">
<name>Priority</name>
</data>
<data id="cost" level="1" leveltype="number">
<name>Cost</name>
</data>
<data id="date" level="3" include="true">
<name>Date</name>
</data>
</doc>
Run Code Online (Sandbox Code Playgroud)
对此
<doc>
<data id="priority">
<name>Priority</name>
</data>
<data id="cost">
<name>Cost</name>
</data>
<data id="date">
<name>Date</name>
</data>
<!-- ordering matters, though if necessary I can reorder this manually via the DOM instead of XSL -->
<levels>
<level id="cost" include="false" type="number"/>
<level id="priority" include="true"/>
<level id="date" include="true"/>
</level>
</doc>
Run Code Online (Sandbox Code Playgroud)
基本上我想采用关卡属性并使它们成为自己的东西.如果有某种方法可以删除级别编号并使用节点的顺序代替它,那将是一个巨大的好处.
我需要通过curl为命令行设置特定nagios主机的计划停机时间.我是这样做的吗?
这是我已经用于从命令行启用/禁用服务/主机通知的内容.
curl -d "some input here" url "user:pass"
Run Code Online (Sandbox Code Playgroud)
就像我需要为计划停机时间做的那样.现在的问题是停机时间选项需要更多选项,即启动时间,结束时间,评论等.
那么如何通过命令行中的curl完成它呢?
curl -d " some key value pair(hostname,servicename" url "username:passowrd"
Run Code Online (Sandbox Code Playgroud)
这将从命令行打开和关闭服务/主机通知.所以我想以这种方式使用curl来为特定的nagios服务器提供停机时间.
上面的脚本不起作用,因为nagios的停机时间选项需要更多的参数,我试图在脚本中注入这些参数.但它没有那样做.我们也需要提供starttime,endtime和comment值.
另外,我已经尝试了curl的选项--form和--form-string with the script ...无法通过.
理想的想法是,不是去Nagios web界面,我们想从命令行完成这件事(我们已经成功完成了服务/主机服务和通知).
希望我现在绝对清楚.
TIA
巴斯卡尔
我打赌这在文档的某处突出显示,但我现在有点懒.
我们如何设置从SVN凭证到我们在通知中使用的电子邮件的映射,以防Hudson在签入后观察到失败的构建?将TeamCity广泛的通知设置与Hudson或Jenkins的设置进行比较会很好.
只需链接到文档中的正确位置即可.
谢谢,安东
UPD:我们现在面临的主要问题是只通知罪犯,而不是所有开发者.
通过从彼此中减去两个日期时间对象,我遇到了一些问题.我使用以下代码:
$today = DateTime->now( time_zone => 'Europe/Berlin' );
my $dt1 = DateTime-> new (
year => 2011,
month => 08,
day => 08,
hour => 1,
minute => 0,
second => 4,
time_zone =>'Europe/Berlin'
);
print "DT1 : $dt1\n";
print "today: $today\n";
my $sub = $today->subtract_datetime($dt1);
print "sub days: ".$sub->days."\n";
Run Code Online (Sandbox Code Playgroud)
DT1的打印声明今天打印:
DT1 : 2011-08-08T01:00:04
today: 2011-08-16T08:34:10
Run Code Online (Sandbox Code Playgroud)
但是如果我在减法后打印$sub->days它显示1而不是8天的值.
我的减法中有错误吗?
非常感谢您的帮助.
我的 Jenkins 服务器在 Windows 2008 服务器上的 Tomcat 中运行。我在 CentOS 上设置了 NFS 服务器,Win2008 服务器可以通过 mount 命令访问 NFS 共享文件夹。我在 Windows 上以管理员用户身份运行时对其进行了测试。我将该文件夹作为 Z 驱动程序安装在 Windows 2008 服务器上。但是我在 Jenkins 的工作说它找不到 Z 驱动程序,我猜 Jenkins Web 应用程序可能没有足够的权限来访问 Z 驱动程序。请查看 Jenkins 的错误信息
控制台输出:
Started by user anonymous
Building in workspace C:\.jenkins\workspace\upland-install
[upland-install] $ cmd /c call "C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp\hudson4487584210513580576.bat"
C:\.jenkins\workspace\upland-install>rd d:\tmp\upland_dist /s /q
C:\.jenkins\workspace\upland-install>xcopy Z:\upland_release\364 d:\tmp /S
**Invalid drive specification**
0 File(s) copied
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?将 Jenkins 安装为 Windows 服务?
El-Gamal的关键长度是多少?