methods

PHP: What is the purpose of encapsulation?

I'm talking specifically about the public, private and protected keywords that can apply to properties and methods. I've looked everywhere and I know what they do and how to use them, but don't see how they would be practical when programming. Could somebody explain or give an example? ...

Can I say a Constructor is a Method?

I wonder if can I say that a constructor is a special case of a method? ...

.NET: Clone an Existing Method Dynamically with Reflection.Emit

There are plenty of threads on how to create a Method using Reflection.Emit but I cannot find any on Cloning or copying an Existing Method. I would like to copy an existing class and add a few more additional fields to it. I am having trouble copying the methods. I have read that you cannot simply take the IL Code from the body because...

php terminology: difference between getters and public methods?

My question is more about terminology then technicalities (or is it?). What's the difference between a getter method and a public method in a class? Are they one in the same or is there a distinction between them? I ask because I'm trying to learn best coding practices and this area seems grey to me. I was commenting my code out and n...

try to do a public method

i want to create a method to open a popup when i click on it and the title and the text would be automatic, something like this : public void Display(String test){ new AlertDialog.Builder(this).setTitle(getTitle()).setMessage(test).setNeutralButton("close", new DialogInterface.OnClickListener() { @Override ...

C# Pointers in a Method's arguments?

I wish to directly modify a variable's value outside of a method from inside it. Pointers are the way, correct? How? ...

Entity Framework 4 update and insert one function

I'm migrating from SubSonic to EF4. In SubSonic models had a function called Save, if the key of the model was 0 an insert was done, otherwise an update. Is there a way to make a generic Save function like in SubSonic? For exmaple using an extension method? ...

java function to determine height of an image with the given width?

im having an image(some dimensions) i set the width of some pixel position. i need a java method to calculate the height of the image to display properly... please help me.... urgent.. ...

Globalize an input variable in Java

I am trying to make a lottery game in Java and it uses method calls instead of while loops for looping purposes. However, I cannot get an input variable( such as int bet = input.nextInt()) to be recognized as a variable for other methods. I do not know how to globalize "bet" so it can be used by all the methods instead of just in the met...

Which interface should I implement to have parse method

Hi, I'm working with webservices. I have a java object defined for the request. I'd like to create a java object of this type from a String or a XmlObject. Which interface should I implement to use the method parse to do this? Thanks and regards ...

Method Naming Convention Question (most languages)

If I have a method that hides a button, I would probably call it HideButton If I have a method that shows a button, I would probably call it ShowButton But what do you guys call a ShowIfThisHideIfThat style method? Possible Choices: TestForButtonVisibility (this kind of sounds like it will return true/false but not actually do the wo...

codeigniter check for user session in every controller

Hey guys, I have this private session in one of my controllers that checks if a user is logged in: function _is_logged_in() { $user = $this->session->userdata('user_data'); if (!isset($user)) { return false; } else { return true; } } Problem is that I have more than one Controller. How can I use this function in those other...

Ftp multiple file transfer

How can I wait the end of an ftp transfer on my iPhone app, if I have to do many ftp transfers in sequence? I call the same method to make the transfers, changing the name of file. [Ftp receiveFtp:file1]; [Ftp receiveFtp:file2]; [Ftp receiveFtp:file3]; Here, for example, I should wait the end of the first method before calling the sec...

Java Constructor undefined?!

Ok, I am working on an assignment for school, and I set up my main class and also another class called Transaction. In my main class I have: Transaction t = new Transaction(); And Transaction is underlined: it says that the constructor undefined. WHY?! The Transaction class looks like this: public class Transaction { private String...

Who is doing investigations into measurement of functionality and usability?

I have developed some ideas about system construction, that are a little different to mainstream development. I am developing a demonstration/proof of concept project. So far, I have found that useful information about the completeness of a system can be gathered by taking an indirect view of the development. This indirect view is ba...

Why might Xcode think an instance method is a class method?

I am trying to compile some code where I have a class called Card. It has a method called -(void)setSuit: (NSString *)suit It is an instance method, but when I say [Card setSuit:@"Diamonds"] Xcode says: warning: "Card" may not respond to method +setSuit And my program doesn't work. I think that Xcode thinks setSuit is a class m...

Help with allowing a class to be customized by other developers

UPDATED: Added some sample code to help clarify. Hi, Feel like this shouldn't be that complicated, but I think I just don't know the proper name for what I'm trying to do. I'm dealing with an ASP.net project. The concept is pretty simple: I have a library that supplies some ecomm functions. One class in the libary contains functions a...

asp.net DataBinding - Method - From Code Behind

hi my dear friends : the below ASPX code is ok : <asp:Label ID="lblShowInRPV1" runat="server" Text="<%# Method() %>"></asp:Label> is it possible to pass some parameters (from aspx code) to Method()? in the other hand can u fix Below databinding for me ? (That Is Incorrect) <asp:Label ID="lblShowInRPV1" runat="server" ...

Static method can access caller object, bug or feature?

I was working on my application and discovered strange behaviour of methods that called statically but not defined as static that extends same class. Eventually this methods can access and alter caller protected variables and methods. Here is example of my code: <?php class object { private $version; protected $alteredBy = 'no...

Return multiple objects from a method in Objective-C

I have a method that takes an NSMutableArray as a parameter, and I would like it to return that array, another array that is created in the method, and an int created by the method. I realize this could be done by making an array that had all these objects in it, and returning that, then removing them from the array outside the method, ...