问题列表 - 第18787页

创建单个python可执行模块

伙计们,我在模块中有很多python代码,它们存在于几个python包中,现在我需要创建单个python可执行模块或文件,其中包含所有这些文件,因此它将在Windows和Linux服务器上运行.什么是可能的解决方案以及如何做到这一点?

python linux winapi executable

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

Rhinomocks,如何验证根本没有调用存根/模拟?

使用Rhinomocks,我如何验证根本没有调用Mock/stub?意思是没有在mock/stub上调用方法?

我知道AssertWasNotCalled方法,但是这个方法要求我提一个方法名.(也许我有一个可以调用10种不同方法的类).

 Log.AssertWasNotCalled(x => x.LogAndReportException(null, null), x => x.IgnoreArguments());
Run Code Online (Sandbox Code Playgroud)

rhino-mocks

7
推荐指数
2
解决办法
2256
查看次数

从另一个函数Python调用变量

我试图调用一个变量用于另一个函数.该变量仅在另一个函数中,并未声明为全局变量.有谁知道如何调用其他变量.下面的代码显示了正在使用的'retval'变量,但它在另一个函数中声明.

def email_results():

    if make.retval > 0:
        os.system('python email_success.py')
    else: 
        os.system('python email_failure.py')

if __name__ == '__main__': myObject = email_results()
Run Code Online (Sandbox Code Playgroud)

谢谢

我声明的函数是:

def make():

    if os.path.exists(t):

        command = "export ROOTDIR="+rootDir+"; "
        command += "export PROJECT="+project+"; "
        command += "export BUILD_DIR=$ROOTDIR/$PROJECT/basebuild; "
        command += "export AD_EXEC_DIR=$BUILD_DIR/output_dev; "
        command += "export BLDTARGET=MVArm9; "
        command += "export PROFILE=release; "
        command += "cd $ROOTDIR/$PROJECT; "
        command += "make > "+logFileName+" 2>&1"

        print "The command that I will be executing is:"
        print command

    #executing make command …
Run Code Online (Sandbox Code Playgroud)

python

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

是否可以在一个visual studio c ++项目中使用相同名称的源文件?

我正在为我正在学习的c ++课程开发一个静态库项目.老师坚持认为我们只为每个源文件定义一个函数,将属于同一类的文件/函数分组到每个类的子目录中.这导致了如下结构:

MyClass
    \MyClass.cc (constructor)
    \functionForMyClass.cc
    \anotherFunctionForMyClass.cc 
OtherClass
    \OtherClass.cc (constructor)
Run Code Online (Sandbox Code Playgroud)

这是不是好的做法是我不想讨论的事情,因为我只是以这种方式组织我的项目.

我正在使用visual studio 2008,并且在两个类中使用同名函数(以​​及文件名)时会出现奇怪的链接错误.这似乎是由于visual studio将所有.obj文件(每个源文件一个)放在一个中间目录中,在编译具有相同名称的源文件时覆盖先前生成的目标文件.

这可以通过根据输入文件的相对路径将目标文件放在子目录中来解决.Visual Studio允许用户配置它生成的目标文件的名称,并在那里使用宏,但似乎没有"输入文件的相对路径"的宏.

那么,有没有办法让这个工作?如果没有,为每个班级使用一个项目最好的解决方案?

c++ macros visual-studio

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

如何强制sqlmetal保持字段名称大小写?

当Visual Studio自动生成dbml文件时,我会得到表中出现的确切字段名称.

但是,由于VS不为dbml提供刷新功能,因此我手动运行sqlmetal以重新创建dbml文件.它有一个例外 - sqlmetal"纠正"名称

ses_Id -> Ses_Id
aga_Id -> Aga_Id
Run Code Online (Sandbox Code Playgroud)

等等 - 它可能会将camelCase更改为CamelCase.

Sqlmetal帮助没有列出任何开关来保持字段名称按原样(只有复数开关).那么,有没有人知道隐藏的开关保持字段名称的情况?

先感谢您.

解决了

没有这样的开关,并且MS被通知了这个问题 - 添加这样的功能的愿望报告(因为它有更新项目的问题)被关闭为wontfix :-(

linq sqlmetal linq-to-sql visual-studio

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

SOAP不一致?Delphi 2010(Win32)服务器和.NET客户端交换'out-parameter'和'result'

有人可以对这种行为有所了解吗?看起来Delphi SOAP将函数结果设置为最后一个参数,但WSDL.exe将第一个参数作为函数结果读取.

我在Delphi SOAP服务中有以下方法,其中结果字符串用于基本错误处理:

function LoadCustomer(CustomerID: Double; out CustomerName: String): String;
Run Code Online (Sandbox Code Playgroud)

生成的WSDL如下所示:

<message name="LoadCustomer2Request">
  <part name="CustomerID" type="xs:double"/>
</message>
<message name="LoadCustomer2Response">
  <part name="CustomerName" type="xs:string"/>
  <part name="return" type="xs:string"/>
</message>
Run Code Online (Sandbox Code Playgroud)

出于某种原因,WSDL.exe生成以下C#代码,用于交换CustomerName和'Result'字符串:

public string LoadCustomer(double CustomerID, out string @return) {
        WindowsFormsApplication1.ServiceReference1.LoadCustomerRequest inValue = new WindowsFormsApplication1.ServiceReference1.LoadCustomerRequest();
        inValue.CustomerID = CustomerID;
        WindowsFormsApplication1.ServiceReference1.LoadCustomerResponse retVal = ((WindowsFormsApplication1.ServiceReference1.ISKiWebInterface)(this)).LoadCustomer(inValue);
        @return = retVal.@return;
        return retVal.CustomerName;
    }
Run Code Online (Sandbox Code Playgroud)

.net delphi soap wsdl delphi-2010

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

为什么将double赋值给int不会触发gcc警告?

int i = 3.1 / 2
Run Code Online (Sandbox Code Playgroud)

即使使用-Wall选项也不会引起任何警告.有时,我想知道精确丢失的位置.为什么gcc不支持此警告,而msvc支持这个?

谢谢.

编辑:我的gcc -v显示

Configured with: ../../gcc-4.4.1/configure --prefix=/mingw --build=mingw32 --enable-languages=c,ada,c++,fortran,objc,obj-c++ --disable-nls --disable-win32-registry --enable-libgomp --enable-cxx-flags='-fno-function-sections -fno-data-sections' --disable-werror --enable-threads --disable-symvers --enable-version-specific-runtime-libs --enable-fully-dynamic-string --with-pkgversion='TDM-2 mingw32' --enable-sjlj-exceptions --with-bugurl=http://www.tdragon.net/recentgcc/bugs.php

c precision gcc gcc-warning

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

C#函数是否有标准的"永不返回"属性?

我有一个看起来像这样的方法:

void throwException(string msg)
{
    throw new MyException(msg);
}
Run Code Online (Sandbox Code Playgroud)

现在,如果我写

int foo(int x, y)
{
    if (y == 0)
        throwException("Doh!");
    else
        return x/y;
}
Run Code Online (Sandbox Code Playgroud)

编译器会抱怨foo"并非所有路径都返回一个值".

是否有一个属性我可以添加到throwException以避免这种情况?就像是:

[NeverReturns]
void throwException(string msg)
{
    throw new MyException(msg);
}
Run Code Online (Sandbox Code Playgroud)

我担心自定义属性不会这样做,因为为了我的目的,我需要编译器的合作.

c# attributes exception return-type

30
推荐指数
5
解决办法
3528
查看次数

Java Swing:从XML生成动态GUI表单

我正在用Java编写这个应用程序,我JTree在左边有一个JFrame,并且选择的项目JTree确定了右边显示的内容.这类似于Edit --> PreferencesThunderbird和其他一些应用程序的偏好.

无论如何,主要区别在于我的应用程序中右边的东西是动态的,需要在运行时使用文件输入生成.

我所追求的是可以实现的各种方式,代码片段或现有的框架/库(如果存在).

输入文件需要比序列化期间生成的XML更高级别.无需输出功能.

谢谢

java xml user-interface swing

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

iPhone代码 - CGPoint分配问题

我试图实现这个移动UIImageView对象的代码,
我在createPosition方法中得到了对象(jumpBall1 ...)的编译器警告:UIImageView may not respont to -setupperLimit, -setlowerLimit, -setspeed

码:

@interface JumpBallClass : UIViewController
{
    CGPoint center;
    CGPoint speed;

    CGPoint lowerLimit;
    CGPoint upperLimit;

    IBOutlet UIImageView *jumpBall1;
    IBOutlet UIImageView *jumpBall2;
}

@property (assign) CGPoint lowerLimit;
@property (assign) CGPoint upperLimit;
@property (assign) CGPoint speed;
@property(nonatomic,retain) IBOutlet UIImageView *jumpBall1;
@property(nonatomic,retain) IBOutlet UIImageView *jumpBall2;


- (void)update;

@end

@implementation JumpBallClass
- (void)update
{
    center.x += speed.x;
    center.y += speed.y;

    if (center.x > upperLimit.x || center.x < lowerLimit.x)
    { speed.x = -speed.x; }
    if …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c

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