I have a situation where the deployment platform is Java 5 and the development happens with Eclipse under Java 6 where we have established a procedure of having a new workspace created when beginning work on a given project. One of the required steps is therefore setting the compiler level to Java 5, which is frequently forgotten.
We h...
Is there a straightforward way to find all the modules that are part of a python package? I've found this old discussion, which is not really conclusive, but I'd love to have a definite answer before I roll out my own solution based on os.listdir().
...
I have a class with properties that I would like to set values from a dictionary.
In other words, I would like to automate this:
objectInstace.val1 = [dict objectForKey:@"val1"];
objectInstace.val2 = [dict objectForKey:@"val2"];
with something like this (pseudo code):
for key, value in dict:
setattr(objectInstance, key, value)
...
I have a lot of callable objects and they all have the __doc__ string correctly filled out, but running help on them produces the help for the their class instead of help based on __doc__.
What I want to do is change it so that running help on them produces customized help that looks essentially like what you would get if they were actu...
Often in R, there are a dozen functions scattered across as many packages--all of which have the same purpose but of course differ in accuracy, performance, theoretical rigor, and so on.
How do you gather all of these in one place before you start your task?
So for instance: the generic plot function. Setting secondary ticks is much ea...
I have been trying to determine the type of a field in a class. I've seen all the introspection methods but haven't quite figured out how to do it. This is going to be used to generate xml/json from a java class. I've looked at a number of the questions here but haven't found exactly what I need.
Example:
class Person {
public fina...
Suppose I have a long javascript function such as
function test() {
var x;
var a;
...
...
...
...
...
}
is there any way I can ask the function itself to tell me what variables were defined so far.
function test() {
var x;
var a;
...
...
...
...
... // bit of code that would say to ...
Yes, I know it's considered lazy by the non-Pythonistas. The reason I ask is that documentation is still woefully lacking in many Scala libraries (e.g. Scala-dbc, but that's not all I'm looking at), and if I could see the attributes of an object/class at runtime, I could at least figure out what's available. Thanks.
...
Given a frame object, I need to get the corresponding module object. In other words, implement callers_module so this works:
import sys
from some_other_module import callers_module
assert sys.modules[__name__] is callers_module()
(That would be equivalent because I can generate a stack trace in the function for this test case. The i...
Can any one explain the use of Java reflection and introspection? When we need to use both?
...
If I have a python function like so:
def some_func(arg1, arg2, arg3=1, arg4=2):
Is there a way to determine which arguments were passed by keyword from inside the function?
EDIT
For those asking why I need this, I have no real reason, it came up in a conversation and curiosity got the better of me.
...
In Objective-C i can test wether a given class or instance responds to certain selectors. But how can query a class or instance for all its methods or properties of a class (e.g. a list of all methods or properties)?
Wether documented or not, it has to be possible as e.g. WebView can query a plugins scriptable object for all methods and...
How do I check if an object is an instance of a Named tuple?
...
>>> import_path('os.path.join')
<function join at 0x22d4050>
What is the simplest way to write import_path (in Python 2.6 and above)? Assume that the last component is always a callable in a module/package.
...
Is it possible to retrieve any class information from a frame object? I know how to get the file (frame.f_code.co_filename), function (frame.f_code.co_name) and line number (frame.f_lineno), but would like to be able to also get the name of the class of the active object instance of the frame (or None if not in an instance).
...
I'm writing some clojure code, and I'm relying on Joda time for time handling. The problem is that I don't know what to import and the documentation isn't terribly clear about it. Now I know that somebody here can probably give me the correct answer in less than 5 seconds, but I'd rather know how to figure this one out on my own (aside...
Disclaimer: I'm an SQL newb, just discovering the great possibilities of sqlite embedded in applications.
I'm designing a small database for an application that primarily handles data storage for plotting. Say I have several instrument data tables (one for each type of instrument) with a column for each data field, such as pressure, ...
Say I have the following class defined with the method foo:
class MyClass:
def foo(self):
print "My name is %s" % __name__
Now when I call foo() I expect/want to see this printed out
My name is foo
However I get
My name is __main__
And if I was to put the class definition into a module called FooBar I would g...
Is there a built in method, function, API, commonly accepted way, etc. to dump the contents of an instantiated object in Objective C, specifically in Apple's Cocoa/Cocoa-Touch environment?
I want to be able to do something like
MyType *the_thing = [[MyType alloc] init];
NSString *the_dump = [the_thing dump]; //pseudo code
NSLog("Dumped...
Is it possible to find out when a Stored Procedure was last accessed?
I tried the following:
SELECT *
FROM sys.dm_db_index_usage_stats
WHERE [database_id] = DB_ID()
AND [object_id] = OBJECT_ID('stored procedure name')
and it returns a blank resultset.
...