invocation

The best way to invoke methods in Python class declarations?

Say I am declaring a class C and a few of the declarations are very similar. I'd like to use a function f to reduce code repetition for these declarations. It's possible to just declare and use f as usual: >>> class C(object): ... def f(num): ... return '<' + str(num) + '>' ... v = f(9) ... w = f(42) ... >>> C.v...

Invoking a Linux process from Windows and receiving stdout.

I have a legacy application in our company built on... ahem; Classic VB (VB 6). It has got a optimizer(CPLEX MIP Solver) component running on a Linux server and is developed in Java. If we want to provide a Windows UI to invoke the optimizer instance on a remote linux server; how should I implement it? The optimizer will pump out messa...

How to do dynamic object creation and method invocation in .NET 3.5

How does the code looks that would create an object of class: string myClass = "MyClass"; Of the above type, and then call string myMethod = "MyMethod"; On that object? ...

Why this kind of function invocation is wrong in JavaScript?

I'd like to create an anonymous function and then invoke it immediately. 1) This will bring a syntax error. Why? function () { alert("hello"); }(); 2) wrap the function definition with () and it works. (function () { alert("hello"); })(); 3) or, assign the anonymous function to a variable. It works. var dummy = function()...

Is there a way to invoke a Python function with the wrong number of arguments without invoking a TypeError?

When you invoke a function with the wrong number of arguments, or with a keyword argument that isn't in its definition, you get a TypeError. I'd like a piece of code to take a callback and invoke it with variable arguments, based on what the callback supports. One way of doing it would be to, for a callback cb, use cb.__code__.cb_argcoun...

Simple JavaScript function with immediate invocation does not work... why?

Can anybody explain why this works: var sayHello = function (name) { alert("Hello there " + name + "!"); }("Mike"); While this does not: function sayHello (name) { alert("Hello there " + name + "!"); }("Mike"); Mike Peat ...

Which overload will get selected for null in Java?

Hello, If I write this line in Java: JOptionPane.showInputDialog(null, "Write something"); Which method will be called? showInputDialog(Component parent, Object message) showInputDialog(Object message, Object initialSelectionValue) I can test it. But in other cases similar to this, I want to know what happens. Martijn ...

Options for invoking methods dynamically in C#

I've seen quite a few questions related to how do I invoke a method like this and that. What I haven't found is a listing of the different options of how to invoke a method via reflection or any other means in csharp. Can someone explain in detail the different ways of dynamically invoking a method in csharp? From reflection to emitting...

AIR application talking to Java

I have situation when I need to communicate with Java process somehow. Java handling all DB works AIR just UI. It would be very nice to have AFM protocol implementation over sockets. Ideally approach with RemoteObject already existing in framework but working over other medium that HTTP wiuld be the best! Does anybody knows if such thing...

call method at runtime

I am wondering if it is possible to load a .net DLL at runtime, view the methods available and execute one at runtime. If this is possible could you point me in the right direction ...

WSIFException, no schema elements found

Currently I am working on this framework WSIF, this line keep retrun me WSIFException: no shema elements found. Any idea? operation.executeRequestResponseOperation(input, output, fault); \ ...

how does the following code work

Currently I'm trying to invoke it like this: class Test { public static void test() { System.out.println("hi"); } public static void main(String[] args) { Test t = null; t.test(); } } The output of the code is hi ...

Overloaded methods priority

Hello I have a base-class called Element. Some other classes (like Label and Image) both extend this class. I now have a dispatching class having the following methods: public class Dispatcher { public static AbstractPropertyEditor<Label> createEditor(Label e) { ... } public static AbstractPropertyEditor<Element> crea...

Direct invocation vs indirect invocation in C

I am new to C and I was reading about how pointers "point" to the address of another variable. So I have tried indirect invocation and direct invocation and received the same results (as any C/C++ developer could have predicted). This is what I did: int cost; int *cost_ptr; int main() { cost_ptr = &cost; //...

JNI cached jclass global reference variables being garbage collected?

I'm working in the JNI Invocation API, calling into Java from C. I have some upfront initialization to cache 30+ Java classes into global references. The results of FindClass are passed into NewGlobalRef to acquire a global reference to the class. I'm caching these class variables to reuse them later. I have 30+ global references to ...

[PHP] Weird problem with dynamic method invocation

Hi everyone, this time, I'm facing a really weird problem. I've the following code: $xml = simplexml_load_file($this->interception_file); foreach($xml->children() as $class) { $path = str_replace('__CLASS_DIR__',CLASS_DIR,$class['path']); if(!is_file($path)) { throw new Exception('Bad configuration: file '.$path.' not f...

Safe to pass objects to C functions when working in JNI Invocation API?

I am coding up something using the JNI Invocation API. A C program starts up a JVM and makes calls into it. The JNIenv pointer is global to the C file. I have numerous C functions which need to perform the same operation on a given class of jobject. So I wrote helper functions which take a jobject and process it, returning the needed...

What is the best way to reactivate an app running in the tray?

I have a delphi app that runs minimized to a tray icon. When the tray icon is double clicked the app opens a non-modal user interface form. I have added logic to the app to detect whether it is already running. If it isn't running, it starts up and miminizes itself to the tray. If it is already running, I want it to pass control to...

J2ME - Midlet invocation type awareness

How can a MIDlet ascertain whether it has been manually invoked or automatically? Thanks! ...

JNI object references obtained through the Invocation API: local or global?

I'm using the JNI invocation API, which starts a JVM within a C program; in this situation, you get a JNIEnv pointer which remains valid until you explicitly destroy the JVM. Does the local/global distinction still apply here? What's the meaning of a local reference to a newly created object, since the JNIEnv remains in scope all the tim...