Hi, I have following piece of code
NSMutableArray *mutArray = [[NSMutableArray alloc] init];
[mutArray addObject: [NSProcessInfo processInfo]];
[mutArray addObject: @"This is NSString Object"];
[mutArray addObject: [[NSMutableString alloc] initWithString: @"1st Mutable String"]];
for (id element in mutArray){
NSLog(@" ");
N...
I'm trying to use a Python library written in C that has no documentation of any kind. I want to use introspection to at least see what methods and classes are in the modules. Does somebody have a function or library I can use to list the functions (with argument lists) and classes (with methods and member variables) within a module?
I...
I am looking at the soaplib python module (it comes with standard ubuntu 9.04). I have used xmlrpclib extensively in the last years but now I am curious about soap. writing servers with soaplib is acceptably easy, I assume writing clients should be even easier.
in my impatience I can't find a way to make use of introspection. do I re...
In Perl, there is a UNIVERSAL::can method you can call on any class or object to determine if its able to do something:
sub FooBar::foo {}
print "Yup!\n" if FooBar->can('foo'); #prints "Yup!"
Say I have a base class pointer in C++ that can be any of a number of different derived classes, is there an easy way to accomplish something si...
Given a class Foo (whether it is a new-style class or not), how do you generate all the base classes - anywhere in the inheritance hierarchy - it issubclass of?
...
Is there a way to dynamically create properties at runtime in VB .NET using introspection?
e.g. Suppose I had a class
Public Class Foo
Public Property Bar() As String
get
...
end get
set(ByVal value As String)
...
end set
End Class
Is there a way to create property Bar at runtime?
T...
There must be an easy way to do this, but I can't find it.
What command can I run within Tcl to get it to introspect and report the version of itself that is running?
...
Taken from a previous post with some modifications to respond to sepp2k's comment about namespaces, I have implemented String#to_class method. I'm sharing the code here and I do believe that it could be refactored someway specially the "i" counter. Your comments are appreciated.
class String
def to_class
chain = self.split "::"...
Hi,
besides from using a completely integrated IDE with debugger for python (like with Eclipse), is there any little tool for achieving this:
when running a program, i want to be able to hook somewhere into it (similar to inserting a print statement) and call a window with an object inspector (a tree view)
after closing the window, t...
Is there anyway to do something like this:
class A:
def foo(self):
if isinstance(caller, B):
print "B can't call methods in A"
else:
print "Foobar"
class B:
def foo(self, ref): ref.foo()
class C:
def foo(self, ref): ref.foo()
a = A();
B().foo(a) # Outputs "B can't call methods in A...
How would I generate automatic bindings for a C project that is built using CMake?
I want to generate bindings for Python, Java, .NET, PHP, Perl, TCL, Ruby and Octave automatically.
...
I'd like to be able to add a runtime object inspector to my iPhone app, mostly for debugging purposes.
This would let me do something like:
[inspector addObject:someObject];
and in my app, a view would appear that would let me browse and change the public properties of the object in question.
Possibly it would work with a subset o...
Is there any way to get the name of an object in Python? For instance:
my_list = [x, y, z] # x, y, z have been previously defined
for bla in my_list:
print "handling object ", name(bla) # <--- what would go instead of `name`?
# do something to bla
Edit: Some context:
What I'm actually doing is creating a list of functions t...
Does anyone have any references for building a full Object/Class reflection system in C++ ?
Ive seen some crazy macro / template solutions however ive never found a system which solves everything to a level im comfortable with.
Thanks!
...
I'm trying to introspect a postgres 8.3 database to retrieve details of its
foreign keys. Imagine I have the following schema:
CREATE TABLE "a" (
"id" SERIAL PRIMARY KEY
);
CREATE TABLE "b" (
"one" integer,
"two" integer,
"a_id" integer REFERENCES "a",
PRIMARY KEY ("one", "two")
);
CREATE TABLE "c" (
"id" SERIAL PRIMARY KEY,
"...
Helo,
I am pretty new to Ruby (using 1.8.6) and need to know whether the following functionality is available automatically and if not, which would be the best method to implement it.
I have class Car.
And have two objects:
car_a and car_b
Is there any way I could do a compare and find what properties differ in one of the objects a...
This is the first example we meet when we face with decorators. But I'm not able to realize what exactly I would like.
A simple decorator named LOG. It should work like this:
@LOG
def f(a, b=2, *c, **d):
pass
And the result should be something like:
f(1, pippo=4, paperino='luca')
===== Enter f =====
a = 1
b = 2
pippo = 4
paperin...
I have a variable x in python. How can i find the string 'x' from the variable. Here is my attempt:
def var(v,c):
for key in c.keys():
if c[key] == v:
return key
def f():
x = '321'
print 'Local var %s = %s'%(var(x,locals()),x)
x = '123'
print 'Global var %s = %s'%(var(x,locals()),x)
f()
The results are:
Global va...
Given an object, how do I tell if it's a class, and a subclass of a given class Foo?
e.g.
class Bar(Foo):
pass
isinstance(Bar(), Foo) # => True
issubclass(Bar, Foo) # <--- how do I do that?
...
I've got a struct with some members that I want to be able to get and set from a string. Given that C++ doesn't have any introspection I figure I need some creative solution with macros, the stringize operator and maybe boost::bind. I don't need full serialization or introspection, more an 'introspection-lite'
I'd like to have somethin...