methods

Method in Objective-C that points to an object

I have created a few sprites using a spriteclass and I have loaded them into an array. In my app, I loop over the array checking for particular conditions (position, etc.). I want to create an explosion method that I can pass one of these objects to and then using the pointer pull the position of the object on the screen and show an expl...

Calling a method group ....

I have a method group that contains elements such as: class Foobar { public static DataSet C(out string SpName) { SpName = "p_C"; return null; } public static DataSet C() { string SpName; C(out SpName); return DataAccess.CallSp( SpName); } } And what I want to do is B...

How to avoid ambiguity when calling Java from Matlab?

I just discovered that when calling Java from Matlab object.method(arg1,...,argn) is equivalent to method(object, arg1,...,argn) The problem here is I also have a method.m that does some translation from Java to Matlab (eg. convert String[] to cell of strings). My method.m looks like function result = method(object, arg1,...argn)...

Ruby - Getting Array of non-ancestral methods in class

Hello. I want to create a class that has one method that calls all other methods that are not in the super class. Is there a way I can use obj.methods to only get the non-ancestral methods? Or is there another way to do it entirely. Thank you ...

C# Nested Try Catch statements or methods?

Simple best practice question. Should you nest try catch statements or just use methods. For instance, if you have a method that opens a file does work and closes the file, you would have the open and close outside the try catch, or rather the close in the finally block. Now if your open method fails, the method would assert right? So...

JSF MethodExpression isn't triggering my backing bean action

Hello everyone! I have the problem that my code isn't triggering the action in my backing bean. The code is as follows: HtmlCommandButton replyCommentButton = new HtmlCommandButton(); replyCommentButton.setId("replyCommentButton" + commentCounter); replyCommentButton.setValue("Create reply"); String action = "#{Handler.action_replyToCom...

Is it possible to create method call dispatcher in C++ ?

Consider a following code: struct X { void MethodX() { ... } }; struct Y { void MethodY() { ... } }; void test () { X x; Y y; Dispatcher d; d.Register("x", x, &X::MethodX); d.Register("y", y, &Y::MethodY); d.Call("x"); d.Call("y"); } The question is how to implement Dispatcher. I don't mind X and Y may ...

Is it possible to get the name method of that calls another method?

This is what I am talking about: Public Shared Sub Test1() Test2() End Sub Public Shared Sub Test2() MsgBox(Test2.LastMethod) ' Test1 End Sub I would imagine if this is possible, System.Reflection will be utilized? Any thoughts? ...

Java inheritance - added methods

Hi all, I want to have a base class, BaseConnect, which contains an OutputStream and children classes ObjectStreamConnect and DataStreamConnect. In my BaseConnect class I have OutputStream os; And in my Two children classes I have the constructors that do "os = ObjectOutputStream(...)" or "os = DataOutputStream(...)", respectively. ...

Method Syntax in Objective C

Can someone explain this method declaration syntax for me? In this function, the number of rows of a UIPickerView (slot machine UI on the iPhone) is being returned. From my understanding, the Method is called 'pickerView', and returns an NSInteger. It passes in a pointer to the UIPickerview called 'pickerView' ... first, why is th...

refactoring question

Given a method public static string[] Foo(System.IO.Stream stream) { XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("Element"); xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); ...

requiring the presence of static methods in C#

Given a group of objects that have a common set of properties and methods in support of given domain logic, is there a way of enforcing the presence of certain static methods on these objects? I have concluded that implementing an interface does not achieve this (methods are instance only) and that static methods can not be marked overr...

How to sign in to a service using PHP

I want to sign in to a service (site) using PHP (without using its API) If the service login was with a and the method is 'GET', I would use Service.com/signin.php?username=xxxx&password=xxxx Now, the has a POST method how can I do so?? Thanks!! ...

Exiting a method in C#

In C++ if I want to exit a method without returning anything I can do; // A completely useless method static public double function(int a){ if(a==1){ cout << "Error !"; exit(1); } else return (double)a; } How can I do the equivalent in C# ? ...

Rewriting C++ methods in C

How can I make equivalents to these methods in C? I read somewhere that they could be "replaced with functions that take a structure pointer as the first parameter," but I'm not sure how to do this, if that is the right thing to do. struct SCustomKeys { struct SCustomKey Save[10]; struct SCustomKey Load[10]; struct SCustomK...

Append new JavaDoc to existing from super method

I have generated an Interface which is very well documented. Every method does have his own JavaDoc. The clases which implement this Interface can have little differents in their logic. How can i add JavaDoc to the existing JavaDoc from the super class. The key word /** * {@inheritDoc} */ only set the javaDoc of the super class to...

Refactoring Model Methods in Ruby On Rails

Hi All, A common idiom that my camp uses in rails is as follows: def right_things(all_things, value) things = [] for thing in all_things things << thing if thing.attribute == value end return things end how can I make this better/faster/stronger? thx -C ...

enqueue() method adds one element to the queue: how to implement in C++?

I'm having a hard time trying to implement this method since array subscripts in C++ start with zero. The method add one element to the queue. You can use f (front) and r (rear) pointers and a sequential list of size n. If you find that additional variables are needed fell free. Thanks. Thats my try but I know its wrong: void QueueAr::...

How do I pass multiple parameters in Objective-C?

I have read several of the post about Objective-C method syntax but I guess I don't understand multiple names for a method. I'm trying to create a method called getBusStops with NSString and NSTimeInterval parameters and a return type of NSMutableArray. This is how I have constructed the method but it obviously gets errors at runtime: ...

Dynamic use of a class method defined in a Cython extension module

I would like to use the C implementation of a class method (generated from Cython) if it is present, or use its Python equivalent if the C extension is not present. I first tried this: class A(object): try: import c_ext method = c_ext.optimized_method except ImportError: def method(self): retu...