问题列表 - 第49379页

如何检查线程是否正在睡眠?

有没有办法检查给定的线程是否在睡觉?

java multithreading sleep

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

在模块中使用"带类型"结构时放松类型检查

我已经定义了两个模块类型和两个模块

module type FOO = sig type e end
module type BAR = sig type t end    
module Foo : FOO = struct type e = int end
module Bar : BAR = struct type t = int end
Run Code Online (Sandbox Code Playgroud)

然后我将一个仿函数定义为

module Fun (F:FOO) (B:BAR with type t = F.e) = struct type x = string end
Run Code Online (Sandbox Code Playgroud)

(这是一个玩具示例,请忽略这一事实FB不使用的算符)

现在,如果我定义模块

module Bla = Fun (Foo) (Bar)
Run Code Online (Sandbox Code Playgroud)

我明白了

Error: Signature mismatch:
       Modules do not match:
         sig type t = …
Run Code Online (Sandbox Code Playgroud)

ocaml types module signature

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

iOS 4.3改变了UIImagePickerController的相机叠加视图的转换

在iOS 4.3上测试我的应用程序后,我注意到我的UIImagePickerController的相机覆盖有一个额外的转换,极大地扩展了内容.在iOS 4.3之前,一切都正确显示.

这就是我的工作

imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;

cameraOverlay = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
cameraOverlay.backgroundColor = [UIColor clearColor];
cameraOverlay.userInteractionEnabled = NO;

//add subviews to camera Overlay

imagePicker.cameraOverlayView = pauseButton;
Run Code Online (Sandbox Code Playgroud)

任何想法,我必须做什么来摆脱增加的转变?

iphone objective-c uiimagepickercontroller ios4 ios

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

如何知道函数返回类型和参数类型?

虽然我知道Python的鸭子类型概念,但我有时会遇到函数的参数类型或函数返回值的类型.

现在,如果我自己编写函数,我就知道了类型.但是,如果有人想要使用并调用我的函数,他/她应该如何知道这些类型呢?我通常将类型信息放在函数的docstring中(如:"...the id argument should be an integer...""... the function will return a (string, [integer]) tuple.")

但是查找文档字符串中的信息(并将其作为编码器放在那里)真的应该如何完成?

编辑:虽然大多数答案似乎都指向"是的,文档!" 对于"复杂"类型,我觉得这并不总是很容易.
例如:如何在docstring 中简明扼要地描述函数返回元组列表,每个元组的元组(node_id,node_name,uptime_minutes)以及元素分别是字符串,字符串和整数?
文档字符串PEP文档没有给出任何指导.
我想反驳就是在这种情况下应该使用类,但我发现python非常灵活,因为它允许使用列表和元组来传递这些东西,即没有类.

python types

64
推荐指数
6
解决办法
8万
查看次数

无法解决整理冲突?

我有这个错误,我不知道如何解决它

无法在等于操作的情况下解决"Arabic_CI_AS"和"SQL_Latin1_General_CP1_CI_AS"之间的排序规则冲突.

注意:我已经从数据库选项 - >排序规则中更改排序规则

我将它从"Arabic_CI_AS"更改为"SQL_Latin1_General_CP1_CI_AS"

我仍然得到同样的错误!!
有什么建议可以解决这个问题?

sql-server asp.net

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

如何在JQuery中选择一个对象?

我是JQuery的初学者,我怎么能用JQuery选择一个对象?

这是代码:

<script type="text/javascript" language="javascript">

function Hide(senderID) {
   $("#" + senderID).hide(200);
   // this exception is thrown // Microsoft JScript runtime error: Object expected
}

</script>

<div id="div1" onclick="javascript:Hide(this.id)" 
Run Code Online (Sandbox Code Playgroud)

任何帮助!

javascript asp.net jquery

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

如何在python中打开中文名称的文件

我试图在"w"模式下打开一个文件,在python中使用"open()"函数.

文件名是:仿宋人笔意.jpg.

open函数使用此文件名失败,但成功使用普通文件.

如何在python中打开名称不是英文的文件?

我的代码如下:

try:
    filename = urllib.quote(filename.encode('utf-8'))
    destination = open(filename, 'w')
    yield("<br>Obtained the file reference")
except:
    yield("<br>Error while opening the file")
Run Code Online (Sandbox Code Playgroud)

对于非英文文件名,我总是得到"打开文件时出错".

提前致谢.

python

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

以下代码有什么问题?它没有编译

#include <iostream> 
#include <vector>
using namespace std;

class Base
{
public:
      void Display( void )
      {
            cout<<"Base display"<<endl;
      }

      int Display( int a )
      {
            cout<<"Base int display"<<endl;
            return 0;
      }

};

class Derived : public Base
{
public:

      void Display( void )
      {
            cout<<"Derived display"<<endl;
      }
};


void main()
{
   Derived obj;
   obj.Display();  
   obj.Display( 10 );
}
Run Code Online (Sandbox Code Playgroud)
$test1.cpp: In function ‘int main()’:  
test1.cpp:35: error: no matching function for call to ‘Derived::Display(int)’  
test1.cpp:24: note: candidates are: void Derived::Display()
Run Code Online (Sandbox Code Playgroud)

在评论时obj.Display(10) …

c++

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

有没有办法在gdb中设置一个以调用堆栈为条件的断点?

我正在Linux上的gdb 7.1中调试C++.

我有一个a()在代码中的许多地方调用的函数.我想在其中设置一个断点,但只有从它调用它b().有什么办法吗?

有没有什么方法可以做到这一点,只有b()c()无线电话中调用,等等?

c++ callstack gdb breakpoints

26
推荐指数
4
解决办法
4223
查看次数

realloc无法分配

我正在使用VS08来构建/运行以下c ++代码:

#include <stdlib.h>

struct Header
{   
  int count;
}*lstHeader=NULL;

int main()
{
    for(int i=0;i<10;i++)
    {
        lstHeader=(Header*)realloc(lstHeader,sizeof(Header)+i);
        lstHeader[i].count=i;
    }
    return 1;
}
Run Code Online (Sandbox Code Playgroud)

并在运行后我得到以下VS异常:

Windows has triggered a breakpoint in MyProgram.exe.

This may be due to a corruption of the heap, which indicates a bug in 
MyProgram.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while MyProgram.exe has focus.

The output window may have more diagnostic information.
Run Code Online (Sandbox Code Playgroud)

我试过malloc lstHeader而不是将它分配给NULL,但是同样的VS异常发生了,我无法想象y.

c c++

0
推荐指数
1
解决办法
636
查看次数