问题列表 - 第5642页

Zend Framework:如何取消Zend_Registry中的密钥?

我正在测试我的Zend Framework应用程序,并希望测试在注册表中未设置特定键时发生的事情.这是我正在测试的功能:

protected function getDomainFromConfig() {
    $config = Zend_Registry::get('config');
    if (!isset($config->domain)) {
        throw new Exception('Please make sure you have "domain" set in your config file and your config file is being set in the Zend_Registry.');
    }
    return $config->domain;
}
Run Code Online (Sandbox Code Playgroud)

如何取消注册表中的密钥?我试过这个,但它不起作用:

$config = Zend_Registry::get('config');
$config->__unset('domain');
Run Code Online (Sandbox Code Playgroud)

更新:我真正想知道的是,如果未设置配置文件中的"domain"键,我应该如何测试我的方法抛出异常.

php registry zend-framework config

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

要在Windows上使用的Subversion Server

什么Subversion(SVN)服务器会推荐新手入门Windows Server操作系统?

我想我将在客户端上使用TortoiseSVN,并且主要进行.NET开发.

更新:
很好的建议.我根据投票选择答案.我将尝试VisualSVN和CollabNet.请阅读我认为非常好的chyne答案(+1).我也会尝试这种方法.

我将在一两个星期内回复这个问题,并在评论中提出我的想法.

.net svn tortoisesvn

13
推荐指数
3
解决办法
7662
查看次数

如何将sortedDictionary转换为字典?

Dictionary<string, string> optionDictionary = new Dictionary<string, string>();

optionDictionary = ....;

SortedDictionary<string, string> optionsSorted;

if(sorting)
{
   optionsSorted = new SortedDictionary<string, string>(optionDictionary );
   // Convert SortedDictionary into Dictionary
}

return optionDictionary ;
Run Code Online (Sandbox Code Playgroud)

c# generics

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

XSLT:如何在<xsl:copy>期间更改属性值?

我有一个XML文档,我想更改其中一个属性的值.

首先,我使用以下方法复制从输入到输出的所

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)

现在我想"type"在任何名为的元素中更改属性的值"property".

xslt xslt-2.0 xslt-1.0

56
推荐指数
4
解决办法
9万
查看次数

接口的必要性,独特项目中的注射

为什么我应该在几乎没有机会重用或升级的网站上实现接口和依赖注入?

interface web

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

我在哪里可以下载JOGL?

我正在寻求开始使​​用Java Open GL,但我找不到它.

java opengl jogl

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

闭包与回调有什么不同?

我问了一个关于回调的问题并得出了另一个问题(见评论).闭包与回调有什么不同?

javascript closures callback

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

jQuery width()返回0

可能重复:
要求jQuery等待所有图像在执行之前加载的官方方法

我正在写一个jQuery插件,处理一个简单的调用插件功能(像一堆图像动画$("#image1").anims()这里#image1是一个图像),但是由于该插件的部分功能,我用$(this).width()在获取图像正确的宽度启动函数调用.

但是,由于调用插件函数$(document).ready,它试图在图像加载之前获取图像的宽度,因此它总是返回0.是否有解决方法?

javascript jquery

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

从方法中检索调用方法名称

可能重复:
如何找到调用当前方法的方法?

我在对象中有一个方法,从对象中的许多地方调用.是否有一种快速简便的方法来获取调用此流行方法的方法的名称.

伪代码示例:

public Main()
{
     PopularMethod();
}

public ButtonClick(object sender, EventArgs e)
{
     PopularMethod();
}

public Button2Click(object sender, EventArgs e)
{
     PopularMethod();
}

public void PopularMethod()
{
     //Get calling method name
}
Run Code Online (Sandbox Code Playgroud)

在内部,PopularMethod()我希望看到Main它是否被调用的价值Main......我想看看" ButtonClick"是否PopularMethod()被调用ButtonClick

我在看,System.Reflection.MethodBase.GetCurrentMethod()但这不会让我得到调用方法.我看过这个StackTrace类,但是每次调用该方法时我都不喜欢运行整个堆栈跟踪.

c# reflection methods calling-convention

57
推荐指数
5
解决办法
7万
查看次数

如何从Java应用程序运行批处理文件?

在我的Java应用程序中,我想运行一个调用" scons -Q implicit-deps-changed build\file_load_type export\file_load_type" 的批处理文件

似乎我甚至无法执行我的批处理文件.我没有想法.

这就是我在Java中所拥有的:

Runtime.
   getRuntime().
   exec("build.bat", null, new File("."));
Run Code Online (Sandbox Code Playgroud)

以前,我有一个我想运行的Python Sconscript文件,但由于这不起作用,我决定通过批处理文件调用脚本,但该方法尚未成功.

java batch-file runtime.exec

104
推荐指数
7
解决办法
27万
查看次数