methods

How can I call a method given only its name?

I'm trying to have method void run( string method ) which would run method in that class. For example: class Foo { public: void run( string method ) { // this method calls method *method* from this class } void bar() { printf( "Function bar\n" ); } void foo2() { printf( "Function foo2\n" )...

Objective C communication between classes

Hi All. I have an AppController class that looks after view/control in my app in the usual way. There's a button on my app's main window in IB that causes AppController to instantiate a new window controller (accountPanelController) and show that secondary window: - (IBAction) showAccountPanel:(id) sender { //Is accountController ...

[iPhone,Obj-C] something:something:something Method Format?

-(void) alertView: ( UIAlertView *) alertView clickedButtonAtIndex: ( NSInteger ) buttonIndex { // do stuff // if you want the alert to close, just call [ alertView release ] } Can someone explain this method? I'm used to methods that are like "-(IBAction)buttonPress:(id)sender" but this one has three. What do ...

Write an Objective-C method, and a c function, when writing for the iPhone?

When using XCode for writing for the iphone SDK... like a simple function that accepts a text-string URL and visits the website, and returns the HTML... which is better? Use Objective-C and write a "method" that accepts an NSString and returns an NSString. or Use C and write a "function" that accepts a string and returns a string. Ho...

Use JavaScripts methods on C#

I'm download web page and parse javascript code, which have in code hash and java decode function... please I want to call javascript decode method from C# program... In web page I've : window.decoded_hashes = {}; window.decodehash = function(hash) { window.dec_hash(hash); return window.decoded_hashes[hash]; window.dec_hash = func...

What is the standard way to write a method declaration in Objective C?

I have a question about the first paramater in Objective-C -(NSInteger) totalSeconds:(NSInteger)h minutes:(NSInteger)m seconds:(NSInteger)s; I've noticed that it seems the first paramater is often 'pulled into' the message name itself and is not named. [totalSeconds:9 minutes:59 seconds:59] Is this kind of syntax acceptable: -...

Flash ShowMessage(Pos) or any other predefined window in Dialogs unit in Delphi for Post-WInXP OS

This is approach I found for Tray ... : http://www.programmersheaven.com/mb/delphikylix/257563/257563/how-can-i-make-a-system-tray-flash/ Does the same technique works for Dialogs ( as they are forms with addition params, in fact )? Or I can do it with way faster methods like getting handle / address / interface and overload or overdri...

[C#] Timers and Forms not closing when method called.

I have three seperate timers that call a method in each of their _Tick. This method works fine, as intended, but within it is an if statement which checks to see if two values are either < or > than a number: if ((x < y) || (x > z)) { } and within this statement, I want to stop those three times, show a message box and dispose the fo...

Override public method in subclass in a way that restricts public access while still allowing access from parent class?

I have a generic Collection class, with a variety of public getter methods. To get one item from the Collection, you call get(). There are also several methods that return multiple items: getMany(), getRange(), getAll(), find(), findAll(), query(), queryAny(), etc. Internally, all of these methods that return multiple items have a loo...

Performance advantages of using methods inside of classes verses data structures with libraries of functions?

Basically is the only advantage of object oriented languages the improved understanding of a programs purpose? Do the compilers of object oriented languages break apart the objects into structures and function libraries? ...

BOINC: Is there an easy example how to code a programm for it and how to implement it into their client/server system?

Hi, I did a numeric method as my diploma thesis and coded it in java. It needs a loot of computational time when done adequate. So I looked for an alternative and found BOINC. Unfortunally I didn't have time for doing my method in BOINC, because I'm an aerospace student and not a programmer and I decided to keep my priority on my java p...

Posible to make this Code smaller?

Hello everyone I have this Two Methods private function cacheAdd($id,$data) { $this->minicache->set($id,$data); } private function cacheGet($id) { return $this->minicache->get($id); } Each time if i want to check if the items are cached i have to do something like that: public function getFriendIds() { $info = $this->cach...

Pure virtual method called

I understand why calling a virtual function from a constructor is bad, but I'm not sure why defining a destructor would result in a "pure virtual method called" exception. The code uses const values to reduce the use of dynamic allocation - possibly also the culprit. #include <iostream> using namespace std; class ActionBase { public:...

Modifying an existing input method in Emacs for Faroese keyboard input

I was searching for at solution that could provide me a Faroese input method for use in Emacs 23.1.1. That is what I want. The faroese-keyboard input method does not exist in Emacs. It will be necessary to use a modified version of the Danish-keyboard. The Danish keyboard is mostly similar to Faroese keyboard. Only two keys differ, one ...

SELF keyword in Objective-C

In a project I'm creating, I have various classes. One of my classes has an instance of NSMutableArray that holds objects of another one of my classes. I thought I had a firm understanding on this topic, but somehow it got jumbled up in my mind again. When initializing an instance of this class, I have this initilize method: - (MMShowM...

Difference between Template Method (separation) and Strategy pattern?

Hi all. My teacher is a really good one and I tend to understand his points, but this one just goes over my head. He explains Template Method in two variants; - Unification: the standard variant, that is composed of an abstract class with some abstract methods defining the variant parts of the otherwise fixed algorithm. - Separation: his...

*Passing a Method into a Class

Hi all, I'm coding a small class that maximizes a given function F and returns the coordinates. For example in maximizing the 1-dimensional fitness function below I currently have: using System; public static class Program { public static double F(double x) { // for example return Math.Exp(0.4 * Math.Pow(x - 0.4...

can you return two arguments in objective-c?

Just wondering if you can return two arguments in an objective c method, for example I'd like to return a cartesian coordinate (x,y), basically two ints. is the only way to do this by creating a class and returning an instance? Is there some other way I'm not thinking of, kind of a beginner here. any syntactical help would also be appre...

Storing a Method as a Member Variable of a Class in C#

Hi, I have this as one of my members of the class 'KeyEvent': private delegate void eventmethod(); And the constructor: public KeyEvent(eventmethod D) { D(); } What I want to do is instead of calling D() there, I want to store that method (D) as a member variable of KeyEvent, so something like: stored_method = D();...

Refactoring methods in existing code base with huge number of parameters

I have inherited an existing code base where the "features" are as follows: huge monolithic classes with (literally) 100's of member variables and methods that go one for pages (er. screens) public and private methods with a large number of arguments. I am trying to clean up and refactor the code, to leave it a little better than how...