methods

C++ Callbacks using Boost Functions and C++ Class Methods

Is there a non-hacky (i.e. no assembly, ...) way to use boost functions to create callbacks with non-static class methods? Currently for static methods: list<function<void (LuaState&)> > _callbacks; I was thinking something along the lines of list<tuple<function<void (void *, LuaState&)>, void*> _callbacks; but boost functions doe...

objective c - call object-returning method without using return value

I know its fine to call a method as if it was void even though it has a return value (like printf), but what about this? [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(method) userInfo:nil repeats:NO]; Can I just have that floating there without using the object it returns? That's like calling [NSObject all...

Python Data Descriptor With Pass-through __set__ command

I'm having a bit of an issue solving a problem I'm looking at. I have a specialized set of functions which are going to be in use across a program, which are basically dynamic callables which can replace functions and methods. Due to the need to have them work properly to emulate the functionality of methods, these functions override _...

C# - Execute a static method in a new process

Hi All, I wanted a help in executing a static method asynchronously as well as in it's own process so that even if the client application that kicked-off this execution is closed, the method will continue it's execution. One option to do this is create a console application and execute this console application as a new process. However...

Using the same decorator (with arguments) with functions and methods.

I have been trying to create a decorator that can be used with both functions and methods in python. This on it's own is not that hard, but when creating a decorator that takes arguments, it seems to be. class methods(object): def __init__(self, *_methods): self.methods = _methods def __call__(self, func): def...

How can I get a list of methods that are originally *defined* in a class in php?

I'm trying to get a list of methods that were actually defined in a definition for a given class (not just inherited from another class). For example: class A { function bob() { } } class B extends A { function rainbrew() { } } class C extends B { function bob() { } } echo print_r(get_defined_class_methods("A"), true)."<br>\n"; ...

Most awkward/misleading method in Java Base API ?

I was recently trying to convert a string literal into a boolean, when the method "boolean Boolean.getBoolean(String name)" popped out of the auto-complete window. There was also another method ("boolean Boolean.parseBoolean(String s)") appearing right after, which lead me to search to find out what were the differences between these two...

Method vs Property in C# - what's the difference

Possible Duplicate: Properties vs Methods In method you can type some code and in properties too. For example I have a property Name. When class name changes I would like to get some data from database and change state of my object. I can add this code to set part of my property. Other solution is to change set part to private ...

How does jQuerys .animate method work (JavaScript)?

As the title says, how does it work? Looking through the source is a nightmare because it's all using complicated arrays, but I don't really see code which does anything. Any ideas? ...

Reference for the C methods used in iPhone development

Is there a good reference somewhere with all the C functions that can be used by default in iPhone development (I guess they lie in the Foundation framework)? I mean functions like: arc4random(), cos(), sinf(), hypot(), sqrt(), sqrtf() etc... They are so many considering their variations too (sin(), sinf()) and googling every single tim...

Cannot refer to a non-final variable inside an inner class defined in a different method

Edited: I need to change the values of several variables as they run several times thorugh a timer. I need to keep updating the values with every iteration through the timer. I cannot set the values to final as that will prevent me from updating the values however I am getting the error I describe in the initial question below: I had pr...

iPhone dev - UIViewController title, tabBarItem, tag

I have a UITabBarController that manages 5 View Controllers. I create their tab bar items in their "init" methods so that they will be displayed before the view is loaded. I'm just wondering what way I should do it, because there seems to be so many ways. For example, for my DatePickerViewController: - (id)init { if((self = [super i...

Passing Argument To Method that Requires "ref System.Array"

I'm using a third party library. One of the methods requires passing an array via ref that will be populated with some info. Here's the definition for the method: int GetPositionList(ref Array arrayPos) How do I construct arrayPos so that this method will work? In the library's not so complete documentation it defines the method as...

How to call GetEnumerator on arbitrary type?

I'm writing a control that should be able to display any list of data. What I wanted to do, was to mimic the for-in construct in that I check for a public GetEnumerator function that contain a Current property and a MoveNext method. I've determined the following: I can check the existance of a method by simply calling MethodAddress on...

C# - writing method blocks...

Hi, this is a general question regarding method block structures. Does anyone have an opinion on what is a better way to design methods given the 2 alternatives below? private void Method1() { if (!A) { return; } if (!B) { return; } if (!C) { return; } // DO WORK....... ...

How to Implement a Base Class with a Method and yet force the Derived Class to Override it?

Having something like this this : public abstract class AAA { protected abstract virtual string ToString() // Error { // Base Stuff } } public abstract class BBB : AAA { public override string ToString() { // Use base.ToString(); // More Stuff } } I read another post (http://stackoverflow.com/questions/6133...

understanding methods in objective-c

for example we use this method in the tableview - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 16; } i want to learn we don't call this method in anywhere but application reads this value how is it being? there are a lot of methods like this we did not call. ...

Is it possible to send an Object's Method to a Function?

I am wondering if it is possible (and what the syntax would be) to send an object's method to a function. Example: Object "myObject" has two methods "method1" and "method2" I would like to have a function along the lines of: public bool myFunc(var methodOnObject) { [code here] var returnVal = [run methodOnObject here] [code...

Priority when choosing overloaded template functions in C++

I have the following problem: class Base { }; class Derived : public Base { }; class Different { }; class X { public: template <typename T> static const char *func(T *data) { // Do something generic... return "Generic"; } static const char *func(Base *data) { // Do something specific... return "Specific";...

How virtual is this?

Hi, can you explain me why: int main (int argc, char * const argv[]) { Parent* p = new Child(); p->Method(); return 0; } prints "Child::Method()", and this: int main (int argc, char * const argv[]) { Parent p = *(new Child()); p.Method(); return 0; } prints "Parent::Method()"? Classes: class Parent { publ...