methods

Members vs method arguments access in C++

Can I have a method which takes arguments that are denoted with the same names as the members of the holding class? I tried to use this: class Foo { public: int x, y; void set_values(int x, int y) { x = x; y = y; }; }; ... but it doesn't se...

Break apart long commandline testing method

Hello all :) I've got a large (read: nightmare) method which has grown over the years to support my project's ever growing list of commandline arguments. I mean several pages of readme docs for brief blurbs per argument. As I've added each feature, I've simply "registered" a way of handling that argument by adding a few lines to that m...

content page class method calling from master page class

I have a public method in my content page class, I want to call this method from master page class Thanks ...

Java Methods - Taking a method AS AN ARGUMENT

I've come across some code that I can't share here but it declares a method WITHIN the paramter list of another method. I didnt even know that was possible. I dont really understand why its doing that. Can someone please explain to me some possible uses that you as a programmer would have for doing that? (Note: Since I can't show the cod...

How to invoke an overloaded generic methods in IronRuby?

Hi, :) How can I invoke overloaded generic method in IronRuby? I have a .net class with the following methods. (Take note that the methods are static) Factory.cs ---- public static T CreateService<T>() public static T CreateService<T>(string serviceName) ironruby_sample.rb ---- service = Factory.create_service[ISomeService] => prod...

Does an overloaded __get need to manage all member variables?

I am creating a __get() function for a class to control access to my private member variables. Do I need to design the function to handle all possible member value reads or can I not write it for members that are public? Also, I am assuming that classes that inherit this class will use my __get() function to access private members. cl...

A general short guideline for passing method parameters by ref or by value ( C#) ?

Something like: if the value of the variable after the method call has to be returned : if can be instantiated before the method call use ref if does not need to be instantiated before the call use out if the value of the variable is used for returning , deciding or calculating other values from the method call do not use ref neither...

Python-like list comprehension in Java

Since Java doesn't allow passing methods as parameters, what trick do you use to implement Python like list comprehension in Java ? I have a list (ArrayList) of Strings. I need to transform each element by using a function so that I get another list. I have several functions which take a String as input and return another String as outp...

Get code file version diff showing methods (names) impacted

I want to get a diff between two versions of a code file (of the Java/C#) variety - and from that get a list of methods (names) impacted. Has this been implemented? I presume this would require an AST Analysis of the lines that come back from the diff. The point of this would be to refine checkstyle/findbugs to just work on the method...

Factory for Callback methods - Python TKinter

Writing a test app to emulate PIO lines, I have a very simple Python/Tk GUI app. Using the numeric Keys 1 to 8 to simulate PIO pins 1 to 8. Press the key down = PIO High, release the Key = PIO goes low. What I need it for is not the problem. I kind of went down a rabbit hole trying to use a factory to create the key press call back funct...

how do you pass a variable' value inside prototype's $() utility method?

function insertChildDiv(parentId) { var ChildComment = new Element('div', {'class':'padding'}); ChildComment.update('testing'); $().insert(ChildComment); } i want the value of parentId inside the $() in the line $().insert(ChildComment); i already tried $('parentId').insert(ChildComment); but it evaluates the parentId as ...

cluster monetizing methods

Hi there If you'll be put into the situation to find a client for a big cluster, where did you start your search? I know that research centers can benefit from the big computing power of a cluster, but in those crisis times, a new client is more difficult to find. Can you give me some samples of clients which are buying computing power...

How do I return the last primary key of the last added item in java?

Hi all. Have a linking (or ref) table which has a dual primary key. Need to return the last primary key which was auto generated from the current connection in a selected table. This is in java. The database is in MS Access if that makes a difference. Sorry for the rushed description, but our team is working to a tight schedule. Any l...

C# Where to put general methods?

In my application I have a method to check a variable is a number or not. This method is called more than once in my code. The method is called from the codebehind pages. Like this method I have more methods which i cannot place within a single class (like Staff). Where should I put this kind of methods? ...

When to check function/method parameters?

Hi SO-lers, when writing small functions I often have the case that some parameters are given to a function which itself only passes them to different small functions to serve its purpose. For example (C#-ish Syntax): public void FunctionA(object param) { DoA(param); DoB(param); DoC(param); // etc. } private void DoA(...

Ruby functions vs methods

In the Ruby Programming Language, Chapter 6 (second paragraph) they state: Many languages distinguish between functions, which have no associated object, and methods, which are invoked on a receiver object. Because Ruby is a purely object oriented language, all methods are true methods and are associated with at least one...

How can I find all the methods that call a given method in Java?

I need to get a list of all caller methods for a method of interest for me in Java. Is there a tool that can help me with this? Edit: I forgot to mention that I need to do this from a program. I'm usig Java Pathfinder and I want to run it an all the methods that call my method of interest. ...

c# Method looping and control.

Hi guys,I have a method that I would like to run over and over again.I would like to be able to start and stop this process. I have been using this pattern for some socket work and I am wondering what improvements I can make? public delegate void VoidMethod(); public class MethodLooper { private VoidMethod methodToLoop; privat...

Javascript method

Hi, I am making a favorite list where you can add items through javascript and remove them again. The values are stored in cookies to remember the list when the user returns. The problem I have is that the method to remove the items from the list doesn't get run, unless there has been a postback first. My code to remove items look like t...

Python: Doubt about the difference beetween "__method__" and "method"

So im currently doing good with Python I think, but still have some issues that are getting to my nervs, for example the difference beetween the __method__, method and _method__ or something. Until know I read severall explanation about their difference but the idea didnt get really clear to me. So what would be their difference? Is the...