问题列表 - 第13411页

设计 - 使用Windsor时应在何处注册对象

我的应用程序中将包含以下组件

  • 数据访问
  • DataAccess.Test
  • 商业
  • Business.Test
  • 应用

我希望使用Castle Windsor作为IoC来粘合各层,但我对胶合的设计有点不确定.

我的问题是谁应该负责将物品注册到温莎?我有几个想法;

  1. 每个层都可以注册自己的对象.为了测试BL,测试平台可以为DAL注册模拟类.
  2. 每个层都可以注册其依赖项的对象,例如业务层注册数据访问层的组件.要测试BL,测试平台必须卸载"真正的"DAL对象并注册模拟对象.
  3. 应用程序(或测试应用程序)注册依赖项的所有对象.

有人可以用不同的途径帮助我提出一些想法和利弊吗?以这种方式利用Castle Windsor的示例项目的链接将非常有用.

c# castle-windsor inversion-of-control

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

合并代码感觉舒服吗?

今天早上,我读了两篇关于重构的意见.

  • 意见1(页面不存在)
  • 意见2(页面不存在)

他们建议将代码分支(并随后合并)到:

  1. 保持行李箱清洁.
  2. 允许开发人员摆脱风险的变化.

根据我的经验(特别是与Borland的StarTeam合作),合并是一种非繁琐的操作.出于这个原因,我只在我必须时(即当我想要冻结候选版本时)进行分支.

从理论上讲,分支是有道理的,但合并的机制使其成为一种非常危险的操作.

我的问题:

  • 合并代码感觉舒服吗?
  • 您是否因为冻结候选版本以外的原因而分支代码?

version-control merge branch

24
推荐指数
5
解决办法
5895
查看次数

有没有办法重新打开套接字?

我在一些代码中创建了许多"短期"套接字,如下所示:

nb=1000
for i in range(nb):
    sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sck.connect((adr, prt)
    sck.send('question %i'%i)
    sck.shutdown(SHUT_WR)
    answer=sck.recv(4096)
    print 'answer %i : %s' % (%i, answer)
    sck.close()
Run Code Online (Sandbox Code Playgroud)

这个工作正常,只要nb足够"小".

由于NB可能是相当大的,虽然,我想这样做

sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.connect((adr, prt)
for i in range(nb):
    reopen(sck) # ? ? ?
    sck.send('question %i'%i)
    sck.shutdown(SHUT_WR)
    answer=sck.recv(4096)
    print 'answer %i : %s' % (%i, answer)
sck.close()
Run Code Online (Sandbox Code Playgroud)

所以问题是:
有没有办法"重用"已经关闭的套接字?

python sockets

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

如何从Java调用Linux shell命令

我试图使用重定向(>&)和管道(|)从Java执行一些Linux命令.Java如何调用cshbash命令?

我试着用这个:

Process p = Runtime.getRuntime().exec("shell command");
Run Code Online (Sandbox Code Playgroud)

但它与重定向或管道不兼容.

java shell command-line

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

UIInterfaceOrientationLandscapeLeft和UIInterfaceOrientationLandscapeRight是否相反?

文件说:

UIInterfaceOrientationLandscapeLeft

设备处于横向模式,设备直立,主页按钮位于右侧.

UIInterfaceOrientationLandscapeRight

设备处于横向模式,设备直立,主页按钮位于左侧.

但是,我让他们完全颠倒了.SDK中真的会出现这样的错误,还是我只是疯了?

码:

+ (NSString *)NSStringFromUIInterfaceOrientation:(UIInterfaceOrientation)o
{
    switch (o) {
        case UIInterfaceOrientationPortrait: return @"UIInterfaceOrientationPortrait";
        case UIInterfaceOrientationPortraitUpsideDown: return @"UIInterfaceOrientationPortraitUpsideDown";
        case UIInterfaceOrientationLandscapeLeft: return @"UIInterfaceOrientationLandscapeLeft";
        case UIInterfaceOrientationLandscapeRight: return @"UIInterfaceOrientationLandscapeRight";
    }
    return nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    NSLog(@"Should: %@", [[self class] NSStringFromUIInterfaceOrientation:toInterfaceOrientation]);
    return YES;
}    
Run Code Online (Sandbox Code Playgroud)

我将上面的代码粘贴到默认的基于导航的应用程序模板的RootViewController.m中.

后续行动:报告为错误7216046.

iphone cocoa-touch uikit

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

[Silverlight] WCF客户端的编程配置

我们正在通过WCF公开基于服务器的API开发Silverlight客户端.

我正在尝试将我的WCF客户端代码(工作正常)从基于配置的模型移动到编程模型.这将使我能够拥有一个"root"URL,我可以在启动时应用它,而不需要安装必须维护庞大的配置文件.

不过,我正在将我的配置转换为支持Silverlight的代码.

我在下面的配置中提供了一项服务:

<configuration>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="CustomBinding_ISilverlightHelper">
                    <binaryMessageEncoding />
                    <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
                        <extendedProtectionPolicy policyEnforcement="Never" />
                    </httpTransport>
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:50072/API/WCF/Silverlight/SilverlightHelper.svc"
                binding="customBinding" bindingConfiguration="CustomBinding_ISilverlightHelper"
                contract="API.WCF.Silverlight.ISilverlightHelper" name="CustomBinding_ISilverlightHelper" />
        </client>
    </system.serviceModel>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚如何创建equivelant client-config代码.目前我有:

CustomBinding customBinding = new CustomBinding();
// I see I need to do something with customBinding but the properties don't seem 
    // logical
    // I have used BasicHttpBinding, but it just returns with "Not Found" (the service does resolve to a valid URL)
BasicHttpBinding basicHttpBinding = …
Run Code Online (Sandbox Code Playgroud)

silverlight wcf

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

AS3中的有效压缩将被转换为PHP

我需要将一些非常长的字符串从flash应用程序发送到PHP页面,当然我想压缩它以减少进出服务器的流量负载.如何以有效的方式压缩字符串并在PHP中轻松解压缩?

从现在看来,我们倾向于标准的zip文件传输,但PHP中用于处理此操作的功能有点沉重.收到zip流后,我必须从该流创建一个文件 - 之后用zip _* - 函数读取文件.

直接操作字符串会更方便和漂亮.

最好的祝福,

php flash actionscript-3

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

如何使用ant转储MySQL数据库?

我找不到有关如何使用ant任务转储MySQL数据库的任何信息.

我是否必须创建自己的任务才能执行此操作?

ANT script ===generate==> myDataBase.sql
Run Code Online (Sandbox Code Playgroud)

java mysql ant mysqldump

10
推荐指数
2
解决办法
5767
查看次数

如何确定Greasemonkey脚本未运行的原因

我试图让Greasemonkey脚本在页面上运行.但事实并非如此.

你如何调试脚本?

启动新Greasemonkey脚本的最小可能步骤是什么?

greasemonkey

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

弱连接的便携性如何?#pragma weak my_symbol

弱连接的便携性如何?

#pragma weak my_symbol
Run Code Online (Sandbox Code Playgroud)

我看到了这个问题: 如何制作 - 弱 - 链接 - 工作与gcc讨论如何使其工作.但有没有一个很好的方法来做到这一点,不需要gcc?

弱链接和用#ifdef保护声明有什么区别?

#ifndef my_weak_fn
    void my_weak_fn(){/* Do nothing */ return;}
#endif
Run Code Online (Sandbox Code Playgroud)

c linker portability gcc weak-linking

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