我在jQuery中有这段代码
$element.parent().children().last().hide().show('slide', {direction : 'left'}, 700, function () {
$element.delay(2000, function() {
$element.parent().children().last().hide('slide', {direction: 'left'}, 700);
reload_table(question_number);
//delay ends here
});
});
Run Code Online (Sandbox Code Playgroud)
delay 声明为:
jQuery.fn.delay = function(time,func){
return this.each(function(){
setTimeout(func,time);
});
};
Run Code Online (Sandbox Code Playgroud)
现在我收到错误:
无用的setTimeout调用(参数周围缺少引号?)
FF3.x,Firefox 6+还可以.有什么想法吗?为什么会发生这种情况?
I have a class that inherits from 2 other classes. These are the base classes:
class FirstBase(object):
def __init__(self, detail_text=desc, backed_object=backed_object,
window=window, droppable_zone_obj=droppable_zone_obj,
bound_zone_obj=bound_zone_object,
on_drag_opacity=on_drag_opacity):
# bla bla bla
class SecondBase(object):
def __init__(self, size, texture, desc, backed_object, window):
# bla bla bla
Run Code Online (Sandbox Code Playgroud)
And this is the child:
class Child(FirstBase, SecondBase):
""" this contructor doesnt work
def __init__(self, **kwargs):
# PROBLEM HERE
#super(Child, self).__init__(**kwargs)
"""
#have to do it this TERRIBLE WAY
def __init__(self, size=(0,0), texture=None, desc="", backed_object=None,
window=None, droppable_zone_obj=[], bound_zone_object=[], …Run Code Online (Sandbox Code Playgroud) 我正在使用C ++作为后端使用ctypes。现在在C ++中有一个像这样的函数:
void HandleString(std::string something){
...
}
Run Code Online (Sandbox Code Playgroud)
我想知道如何从python调用此函数-没有ctype(c_char_p显然不能工作)向该函数发送字符串参数...
我如何解决此问题并将字符串从Python传递到c ++(并将参数更改为char *而不是选项)
PS我可以创建这样的解决方法吗?
我想知道我做错了什么或结果真的那么差.让我们假设最简单的NN示例如文档中所示:
>>>net = buildNetwork(2, 3, 1, bias=True)
>>> ds = SupervisedDataSet(2, 1)
>>> ds.addSample((0, 0), (0,))
>>> ds.addSample((0, 1), (1,))
>>> ds.addSample((1, 0), (1,))
>>> ds.addSample((1, 1), (0,))
>>> trainer = BackpropTrainer(net, ds)
>>> trainer.trainUntilConvergence()
>>> print net.activate((0,0))
>>> print net.activate((0, 1))
>>> print net.activate((1, 0))
>>> print net.activate((1, 1))
Run Code Online (Sandbox Code Playgroud)
例如
>>> print net.activate((1,0))
[ 0.37855891]
>>> print net.activate((1,1))
[ 0.6592548]
Run Code Online (Sandbox Code Playgroud)
预计是0.我知道我可以明显地圆但仍然我会期望网络对于这样一个简单的例子更精确.它可以被称为"工作"在这里,但我怀疑我错过了一些重要的原因,这是非常无法使用的......
问题是,如果你设置verbose=True为你的教练你可以看到很小的错误(如总错误:0.0532936260399)
我认为网络的错误是5%,那么之后如何在激活功能中关闭呢?
我明显使用pybrain来做更复杂的事情,但我有同样的问题.即使网络说错误大约是0.09左右,我也会得到大约50%的测试样本错误.
有任何帮助吗?
我试图找到一些需要qt布局并从中删除所有内容的东西.想象一下窗口是什么样的 - 我有:
QVBoxLayout
| ------QHboxLayout
|---------QWidget
| ------QHboxLayout
|---------QWidget
.........
Run Code Online (Sandbox Code Playgroud)
所以我需要一些东西,我可以递归地调用CLEAR AND DELETE来自我父母的所有东西QVBoxLayout.我尝试了这里提到的东西(清除pyqt布局中的所有小部件),但没有一个工作(无论如何都没有标记正确的答案).我的代码看起来像这样:
def clearLayout(self, layout):
for i in range(layout.count()):
if (type(layout.itemAt(i)) == QtGui.QHBoxLayout):
print "layout " + str(layout.itemAt(i))
self.clearLayout(layout.itemAt(i))
else:
print "widget" + str(layout.itemAt(i))
layout.itemAt(i).widget().close()
Run Code Online (Sandbox Code Playgroud)
但它给出了一个错误:
layout.itemAt(i).widget().close()
AttributeError: 'NoneType' object has no attribute 'close'
Run Code Online (Sandbox Code Playgroud)
=>编辑这种方法有效(但如果除了以下情况之外Layout没有HBoxLayout:
def clearLayout(self, layout):
layouts = []
for i in range(layout.count()):
if (type(layout.itemAt(i)) == QtGui.QHBoxLayout):
print "layout " + str(layout.itemAt(i))
self.clearLayout(layout.itemAt(i))
layouts.append(layout.itemAt(i))
else:
print "widget" + …Run Code Online (Sandbox Code Playgroud) 我试图在eclipse中的mac os 10.7下编译一些东西,然后构建就死了:
Undefined symbols for architecture x86_64:
"_kCFAllocatorDefault", referenced from:
___GLeeGetProcAddress in GLee.o
"_CFURLCreateWithFileSystemPath", referenced from:
___GLeeGetProcAddress in GLee.o
"_CFStringCreateWithCString", referenced from:
___GLeeGetProcAddress in GLee.o
"_CFBundleCreate", referenced from:
___GLeeGetProcAddress in GLee.o
"_CFBundleGetFunctionPointerForName", referenced from:
___GLeeGetProcAddress in GLee.o
"_CFRelease", referenced from:
___GLeeGetProcAddress in GLee.o
"_glGetString", referenced from:
___GLeeGetExtensions in GLee.o
_GLeeGetExtStrGL in GLee.o
_GLeeInit in GLee.o
(maybe you meant: _GLee_Lazy_glGetStringi, _GLeeFuncPtr_glGetStringi )
"___CFConstantStringClassReference", referenced from:
CFString in GLee.o
Run Code Online (Sandbox Code Playgroud)
所以我知道问题在于ld符号.现在我尝试在eclipse中预测项目属性并将-framework CoreFramework添加到g ++和gcc的参数中,但这并没有解决它.
这些符号位于何处,更重要的是 - 如何将它们添加到我的项目中?
我们有一个带有自定义类加载器的应用程序,我需要访问给定类的 classLoader 字段。但是,无法通过反射访问此字段:-(
JavaDoc forjava.lang.Class很清楚:
// This field is filtered from reflection access, i.e. getDeclaredField
// will throw NoSuchFieldException
Run Code Online (Sandbox Code Playgroud)
所以这就是我在调用时getDeclaredField("classLoader")
得到的结果 可以以某种方式获得(我看到 IntelliJ 调试以某种方式这样做;如何?)
也许是一些byteBuddy诡计?
我完成了阅读,相信我.从列表中删除项目时,python仍然起作用.我有一个图表实现.
现在有一个函数可以删除节点附加的一些边.我有一个Edge对象列表,想要按值删除它们...
代码是这样的:
for edge in node.edgeList:
...
edgeToRemove = edge # edgeToRemove now holds something like <edge.Edge object at 0x107dcaf90>
node.edgeList.remove(edgeToRemove) #KINDA WORKS - just doesnt behave consistently...It removes some edges but not others
Run Code Online (Sandbox Code Playgroud)
删除它们的最佳方法是什么?
我像这样捕捉我的pygame程序的屏幕
data = pygame.image.tostring(pygame.display.get_surface(),"RGB")
Run Code Online (Sandbox Code Playgroud)
如何将其转换为base64字符串?(无需将其保存到HDD).重要的是没有保存到HDD.我知道我可以将它保存到文件然后只是将文件编码为base64但我似乎无法编码"在运行中"
谢谢
python ×6
c++ ×2
base64 ×1
byte-buddy ×1
classloader ×1
ctypes ×1
firefox3.6 ×1
g++ ×1
gcc ×1
inheritance ×1
java ×1
javascript ×1
jquery ×1
kwargs ×1
layout ×1
list ×1
macos ×1
pybrain ×1
pygame ×1
pyqt ×1
pyqt4 ×1
reflection ×1
settimeout ×1
xor ×1