Hey. I would like to understand what "class << self" stands for in the next example.
module Utility
class Options #:nodoc:
class << self
def parse(args)
end
end
end
end
Thx!
Given
class ValidationRule:
def __init__(self, **kwargs):
# code here
Is there a way that I can define __init__ such that if I were to initialize the class with something like ValidationRule(other='email') then self.other would be "added" to class without having to explicitly name every possible kwarg?
Hi,
I use python sax to parse xml file.
The xml file is actually a combination of multiple xml files.
It looks like as follows:
<row name="abc" age="40" body="blalalala..." creationdate="03/10/10" />
<row name="bcd" age="50" body="blalalala..." creationdate="03/10/09" />
My python code is in the following. It show "junk after…
Hello,
I have three panes with the InfoPane center option.
I want to know how to set their size.
Using this code:
import wx
import wx.aui
class MyFrame(wx.Frame):
def __init__(self, parent, id=-1, title='wx.aui Test',
pos=wx.DefaultPosition, size=(800, 600),
style=wx.DEFAULT_FRAME_STYLE):
…
If I have a notebook with three spreadsheet widgets, what is the best way to have changes to the spreadsheet update a dictionary (or maybe an sqlite file?). Do all wx grid objects come with a built in dictionary related to the SetNumberRows and SetNumberCols? Basically I am looking for guidance on how to work with the user-input data…
I'm trying to define a simply Fraction class
And I'm getting this error:
python fraction.py
Traceback (most recent call last):
File "fraction.py", line 20, in <module>
f.numerator(2)
TypeError: 'int' object is not callable
The code follows:
class Fraction(object):
def __init__( self, n=0, d=0 ):
…
i am using Jvectormap to place 2 maps on my page.
the maps are placed normally and everything is fine. they are placed in 2 different divs:
<div id="map1">
</div>
<div id="map2">
</div>
and the Jquery:
$(function () {
$('#map1').vectorMap({
color: '#aaaaaa',…
Does anybody know how I can get multiple instances of the same grid to display on one frame? Whenever I create more than 1 instance of the same object, the display of the original grid widget completely collapses and I'm left unable to do anything with it.
For reference, here's the code:
import wx
import…
Hey I'm trying to rotate a rectangle around its center and when I try to rotate the rectangle, it moves up and to the left at the same time. Does anyone have any ideas on how to fix this?
def rotatePoint(self, angle, point, origin):
sinT = sin(radians(angle))
cosT = cos(radians(angle))
return…
Hi,
I am working on an iphone application in which I am consuming a webservice.
So i am parsing the XML file data. any idea about how to parse self closing tag
like: State/ and how to read data of self tag like: Contact Email="abc@anc.com" Name="PhD" Phone="123-521-3388" Source="location"/
I am parsing…
I want a Qt window to come up with the following arrangement of dock widgets on the right.
Qt allows you to provide an argument to the addDockWidget method of QMainWindow to specify the position (top, bottom, left or right) but apparently not how two QDockWidgets placed on the same side will be…
Hello,
In Python, I can declare attributes all over the class. For example :
class Foo:
def __init__(self):
self.a = 0
def foo(self):
self.b = 0
It's difficult to retrieve all attributes in my class when I have a big class with a lot of attributes.
Is it better to have the following…
Hmm, the title was harder to formulate than I thought.
Basically, I've got these simple classes mapped to tables, using SQLAlchemy. I know they're missing a few items but those aren't essential for highlighting the problem.
class Customer(object):
def __init__(self, uid, name, email):
…
I guess my mind is so engaged in IIS and web applications that I can't think of a reason to go through the trouble of using a self-hosted WCF service. I have always had the availability of IIS so creating a self-hosted WCF service seems like more work than I would want to do. Why would I want…
I'm writing a small program with the OpenSSL library that is suppose to establish a connection with an SSLv3 server. This server dispenses a self-signed certificate, which causes the handshake to fail with this message: "sslv3 alert handshake failure, self signed certificate in certificate…
Hi,
I can't figure out how to design classes in my system.
In classA I create object selenium (it simulates user actions at website).
In this ClassA I create another objects like SearchScreen, Payment_Screen and Summary_Screen.
# -*- coding: utf-8 -*-
from selenium import selenium…
A.
Am learning Python OOP now and confused with somethings in the code below.
Question:
1. def init(self, radius=1):
What does the argument/attribute "radius = 1" mean exactly?
Why isn't it just called "radius"?
The method area() has no argument/attribute "radius".
Where does it…
i have this in the superview:
mySubView = [[MySubView alloc] init];
[self addSubview:mySubView];
[mySubView release];
then at some point later, in the sub view, this:
[self removeFromSuperview];
when i debug it, i notice that the dealloc for the subview is never called, even…
I'm trying to make a view and controller in PyQt where the view is emitting a custom signal when a button is clicked, and the controller has one of its methods connected to the emitted signal. It does not work, however. The respond method is not called when I click the button. …
Hi all,
Let's say we have these classes:
class Foo(object):
_bar = ""
def __init__(self):
self.bar = "hello"
def getBar(self):
return self._bar
def setBar(self, bar):
self._bar = bar
def getAttributes(self):
for attr in…
When I click to the embedded Google Maps API of the following Web Page: http://ada.kiexpro.com/html/list.html (click ?? at the top-right corner).
It displays:
This web site needs a different Google
Map API key. A new key can be generted
at…