methods

Issues with closure and a method defined elsewhere.

I am pretty new at Javascript so I may not be using the exact terminology. Suppose that I define an object literal as such. var myObj = { someMethod:function() { //can we have access to "someValue" via closure? alert(someValue); } } And then we assign the function to another object like this. var myOtherObject = ...

Intercept method call in Objective-C

Can I intercept a method call in Objective-C? How? Edit: Mark Powell's answer gave me a partial solution, the -forwardInvocation method. But the documentation states that -forwardInvocation is only called when an object is sent a message for which it has no corresponding method. I'd like a method to be called under all circumstances, ev...

calling method in helper class exposed by wcf service class

In short: Trying to write a wcf service for a winform-app that invokes a stored procedure on a webserver. So far no problem - my service exposes the method "execStp(string nameOfStoredProcedure, stpParamList parameterList)" [OperationContract] int execStp(string stpName, srsWcfLib.Utilities.stpParamList paramList); where stp...

How can I pass a method acquired by reflection in C# to a method that accepts the method as a delegate?

Hi, I realize the title needs to be read more than once for understanding ... :) I implemented a custom attribute that i apply to methods in my classes. all methods i apply the attribute to have the same signature and thus i defined a delegate for them: public delegate void TestMethod(); I have a struct that accepts that delegate as ...

PHP Using a variable when calling a static method

Hi, I have three classes that all have a static function called 'create'. I would like to call the appropriate function dynamically based on the output from a form, but am having a little trouble with the syntax. Is there anyway to perform this? $class = $_POST['class']; $class::create(); Any advice would be greatly appreciated. ...

Are these regular Perl subroutine calls?

I'm still trying to get a hang of Perl's OOP features. I'm confused about something, if I have a subroutine call like: My::Package::sub_name($param1,$param2) will this get "My::Package" sent as the first parameter? I'd tend to say no, but I'm not sure. ...

How to invoke a method with a superclass.

I'm trying to invoke a method that takes a super class as a parameter with subclasses in the instance. public String methodtobeinvoked(Collection<String> collection); Now if invoke via List<String> list = new ArrayList(); String methodName = "methodtobeinvoked"; ... method = someObject.getMethod(methodName,new Object[]{list}); It w...

Python: Public methods calling their 'brother' private methods.

Hi, I have been writing Python code for only a couple of weeks, so I'm still figuring out the lay of the land. But let's say I have a method that MAY be called on by a 'user' on occasion as well as used HEAVILY internally (ie, the arguments have already been checked before the call). Here is what I am currently doing: #The method the '...

Clojure: extend Wicket panel and call to panel methods

Currently I'm trying to create sample Wicket page with Clojure (in existing wicket project). Code looks like this: (ns a.set.of.packages.dataview.info.EmptyNodeInfo2Panel (:import [a.set.of.packages.tree TreeModelBean] [a.set.of.packages.dataview.supplemental GenericHeaderPanel])) (gen-class :name a.set.of.packages.dat...

Function/Method Overloading C++: Data type confusion?

Hi, I'm having some trouble overloading methods in C++. As an example of the problem, I have a class with a number of methods being overloaded, and each method having one parameter with a different data type. My question: is there a particular order in the class these methods should appear in, to make sure the correct method is called d...

C#: where to put "save()" method?

I have a question, here is an example I have a Model class: Stock public class Stock{ //some properties, stock name, stock code; public String StockName{ get,set } public String StockCode{ get,set } } Also I have a service class StockService, which will load the data from database and crea...

Can you pass an 'expanded' array to a function in C# like in ruby?

In ruby you can do something like this: def method(a, b) ... end myMethod(*myArray) So if myArray had 2 items, it would be the equivalent of this: myMehtod(myArray[0], myArray[1]) So that in the method body, a == myArray[0] and b == myArray[1] Can you do this in C#? (So I can have a method declared with explicit arguments, instead...

Accessing Method from other Classes Objective-C

Looked for an answer for this question, but I haven't found a suitable one yet. I'm hoping you guys (and gals) can help me out! (This is for an iPhone app) Alright, I have a Mutliview application. Each view has it's own class, and everything is happy. However, the different classes sometimes call the same method. Up until now, I ha...

scala: 'def foo = {1}' vs 'def foo {1}'

what is going on in each of these forms of defining foo?: scala> def foo = {1} foo: Int scala> foo res2: Int = 1 But: scala> def foo {1} foo: Unit scala> foo scala> ...

Dynamic method return types in java

The following code does exactly what I want it to, but I am curious if there is a better way of going about it. This would be so much easier if Interfaces allowed static methods, or if Java methods could be generalized/parameterized to the extent they can in C#. I would much rather substitute the parameter "Class<TParsedClass> c" for "C...

Flash games hack, score is 49700?? How to improve flash games security?

I have 2 flash games (written in as3). Both the highscore value being hacked. The normal range of each game score is not more than 5000 (normal users, will only get 2000 - 3000 points). My current method of anti-hacking is: After finish the game, flash will use post parameters send: username=mike&score=2000&hash=md5(secret . username . ...

How to store callback methods?

i am trying to store some method callbacks but referring to it will keep the bound object alive, so i tried to keep a weakref to method but that doesn't seems to be possible? so Why can't i keep a weak ref. to method (see example below) What is the best way to keep method ref? any thing in standard lib? Or I will have to keep function...

C#: Problem calling method inside a string property setter

I have a string property that defines a filename for an xml file. When the user inputs this filename into the property, I have the setter calling a parseXml() function immediatly after setting 'fileName = value' to populate a dataTable with the data from the XML file so it displays in the designer. For some reason, when I have this fun...

java inheritance resolution in case of instance methods and variables

Hi As per java, instance method resolution is based on runtime types of the arguments. But while resolving instance variable it uses different approach as shown below. Output of program is .. Child Parent ParentNonStatic Here First output is based on runtime types of the argument but third output is not. can any on...

How can I get a method to call in a class while the user is in a view of another class?

I have an iPhone app based on a tabBar and tableViews. I want the user to be able to click on one tab and access options for filtering the data in the initial tableView. The problem I'm having is that while the user is selecting filter criteria, I want the main table (not visible) to update. The reason this is important is that I want t...