methods

Objective-c: requesting aid in understanding how to use files/objects effectively.

Hello. I am sorry to bother so late, but i am very much a bundle of nerves. I have tried to understand how to use the information in the couple of objective-c and objective-c game design books I have purchased, but unfortunately, the information is laid out in a way which I dont really comprehend. I would like to state my query and is...

Methods in classes in C#

Hi, I have a number of different clases located in a class library in my project. I am using Quartz.NET (a scheduling system) to schedule and load jobs, and the actual job execution is done in these class libraries. I plan to have many types of job types, and each one will have their own class for execution in the class library. An issu...

PHP warning magic method set() class.XMLHttpRequest.php

i have a php script that runs perfectly but i get 2 errors: Warning: The magic method __set() must have public visibility and cannot be static in C:\wamp\www\class.XMLHttpRequest.php on line 63 Warning: The magic method __get() must have public visibility and cannot be static in C:\wamp\www\class.XMLHttpRequest.php on line 89...

what do an undefined method [] mean in rails?

Hi, I get the following error: undefined method `[]' for nil:NilClass The related snippet in line 50: 47: <%=h @contact.date_entered.to_date %></br> 48: Next event: 49: <% next_delayed_todo = @contact.next_delayed_todo %> 50: <% unless next_delayed_todo[:event].nil? %> 52: <%= next_delayed_todo[:event].title %> </br> ...

Instantiating two objects inside a method for use as 'return values'

I've got the following class: public class Matriz { ... static public void create(Matriz a, Matriz b) { ... a=new Matriz(someValue,anotherValue); b=new Matriz(someValue,anotherValue); ... } } And in my main method: public static void main(String[] args) { Matriz a=null,b=null; Matriz.create(a,b); ...

XSL output method text including whitespaces in xsl

Hi, I am creating some xsl to transform my xml into text (which will be csv eventually). I am using VS2008. When I use the editor to create the xsl, the transformed output is indented as per my xsl. However, if I edit the xsl and remove the formatted whitespaces it outputs correctly - but doing it like this is a nightmare to work wit...

Is this the right way to create and call a class for an iphone application?

I have this class loader.h #import <Foundation/Foundation.h> @class Reachability; @interface loader : NSObject { } - (void)startLoading; @end loader.m #import "loader.h" #import "Reachability.h" @implementation loader - (void)startLoading{ NSLog(@"Check network"); } @end Is the code bellow the correct way to include the above c...

How to add methods to a rails polymorphic association?

So, if I have a polymorphic association throughout my application, is there a way to add methods to it? For instance, if :post, :photo and :user are all associated to :rankings with a polymorphic association named :rankable, can I somehow create methods on :rankable that would then be inherited by :post, :photo or :user? My guess is th...

Nested Classes C++ static inner methods (Xml parsing and trying to populate vector with values)

So this is what I am trying to accomplish. I am trying to use a sax parser to parse some XML. it looks like I need to call all their methods as statics. So if I want to pass a value back from say startElement it is static void startElement. Which brings me to my example code. I have been pulling my hair on how to update a value in a Nes...

C#: Analyze "unsafe" method invokes

How (actual with which instuments like ReSharper) in VS10 developer can find "unsafe" method invokes - i.e. invokes, which unattainable by call stack in no one safe block (try-catch) ? class A { public static vois f() { try { ... B.DoSome(); // safe call, exceptions handled } ...

php oop extends problem

i have the following classes. class base { private function __construct(){ //check if foo method exists //$this->foo(); // if it exists } public static function singleton(){ if(!isset(self::$singleton)){ self::$singleton = new base(); } return self::$singleton; } } ...

How to share an object between two class methods

I created an object in the method viewDidLoad:. In another method that I create, I want to access this object. One way to do it is to declare the object in the h file. Another way to do it is to pass it as a parameter. Are there any other ways? ...

Python: Why Lists do not have a find method?

I was trying to write an answer to this question and was quite surprised to find out that there is no find method for lists, lists have only the index method (strings have find and index). Can anyone tell me the rationale behind that? Why strings have both? ...

Methods query in ruby on rails - undefined method `read' for ...

As part of learning ruby/rails, I'm trying to implement http://github.com/professionalnerd/simple-private-messages into my application from scratch, instead of just installing the plugin. (I know, causing myself trouble but it's a good learning experience.) I created the model, and the associations seem ok and I can create new messages ...

Sorting an NSMutableArray containing matching "pairs" of values.

I'd prefer not to change the way anArray is designed because it is also used elsewhere as a dataSource for a UITableView. The odd number values are "user names", and the even number values are their matching "dates". (The "pairs" must remain together.) How would I sort "by user name"? How would I sort "by date"? Should I be using s...

How are methods used?

I know how to use a method and that is solves some task but I do not get what exactly are they good for. Every pages says "it is a block of code...blabla", but I have not seen any simple explanation that says what are the methods good for and why are so important. I would be very grateful if someone could give me clear answer. Thank you!...

__getattr__ equivalent for methods

When an attribute is not found object.__getattr__ is called. Is there an equivalent way to intercept undefined methods? ...

Ruby Get Array From Objects Returned in a Block

In Ruby, on certain occasions (ruby/gosu/texplay) I'v seen code like the following used: image.paint { circle 20, 20 pixel 10, 10 } Would it be possible for me to write a similar function that can be used like so?: my_function { "one" "two" "three" } that would return and array: ["one", "two", "three"] p.s...

Should I subclass the NSMutableArray class

I have an NSMutableArray object that I want to add custom methods to. I tried subclassing NSMutableArray but then I get an error saying "method only defined for abstract class" when trying to get the number of objects with the count method. Why is the count method not inherited? I read somewhere else that I will have to import some NSMu...

Statements only in methods, but what about declarations?

On MSDN I found: In C#, every executed instruction is done so in the context of a method. But I also read that an int A=5; statement can be in the class body. It seems it's not in a method body, so why this is possible? It is probably just term confusion but I would like to know. ...