class

Using link_to in a class in a Rails helper

I have a rails helper using the structore below, but when I use it I get the message undefined method 'link_to' The helper is arranged as: module MyHelper class Facet def render_for_search link_to("Value", params) end end class FacetList attr_accessor :facets def initialize #Create facets end...

C++ extern class definition

I'm reading some code that goes: extern class MyClass : BaseClass { ... } MyInstance; Does the extern refer to the class declaration or the instance? ...

Does visual documentation exist for the Zend Framework API ?

I was trying to get a good hold on Zend Framework API but it proved quite challenging with Modules, Models, Controllers, Views, Actions, ActionHelpers, ViewHelpers, Decorators, and addon libraries like ZendX_JQuery. That's excluding the 50+ other components ! So I thought a bit about visual (diagrammatic) API navigation. What I mean is ...

OOP: How would you set up an Artist, Album & Song relationship in OOP

I understand the basics of inheritance but this one is confusing me. How would you go about saying: An album object has one or more artist objects An album object has one or more song objects My current code only will only allow one song per object: class Song extends Album{} class Album extends Artist{} I'm sure i'm overlooking s...

Why am I getting this error? Error #1006: draw is not a function.

I have 2 classes with a draw function in them, my Background class and VideoDisplay class. I'm not done with the VideoDisplay class, but I put simple traces in it to test. I call both the Background and VideoDisplay the same way in my document class, but when I try to call the draw function of the VideoDisplay class I get this error: Er...

How to use boost::array with unknown size as object variable

I'd like to use boost::array as a class member, but I do not know the size at compile time. I thought of something like this, but it doesn't work: int main() { boost::array<int, 4> array = {{1,2,3,4}}; MyClass obj(array); } class MyClass { private: boost::array<int, std::size_t> array; public: template<s...

How can I add and remove a class on links using jQuery?

Let me give a better description of exactly what I'm wanting to do here. I'm using Wikispaces, and by default, when a user adds a new page link to the side navigation bar, wikispaces inserts either one of two classes: wiki_link or wiki_link_new. Here's what it looks like... <a href="/Map+Page" class="wiki_link">Map Page</a><br/> <a hr...

Calling Parent Class Methods

Question edited to better reflect my needs. Take the following example: class Base { public $Text = null; public function __construct() { $this->Text = new Base_Text(); } } class Base_Text extends Base { public $Is = null; public function __construct() { $this->Is = new Base_Text_Is(); ...

I need a good analogy to make sense of Class methods vs. instance methods

Im getting fairly confused as the book im reading is delving into the NSNumber class and talks about all the different methods you can call on it. I have a couple questions: 1.) Do you not have to call a typical alloc or init on foundation classes? 2.)in what cases would you use, say, numberWithChar: as opposed to initWithChar (i thin...

class.upload.php getting error

Hi i am using this class.upload.php for my project and i must say it is very helpful. However i am stuck with this error No correct uploaded source file. Can't carry on a process can anyone guide me how to solve the issue.Thanks here is the code where i think error lies..thanks <?php require_once('class.upload.php'); if((isset(...

How can I change the color of a UIWindow from a separate class?

I am trying to change the background color of a UIWindow when an action is sent to the class MyController. However the UIWindow resides in the AppDelegate class so I don't have access to the variable to modify it using window.backgroundColor = [UIColor theColor]; in MyController. Here is the code for MyController.m: @implementation M...

Web form generator PHP class - empty property on foreach

I am currently building PHP class that generates web form for flexibility and localization issues. I am having difficulty assigning a key and value for dropdown input; for some reason the foreach seems does not get array variable ($country_list). Here is my code that I am having difficulty. require_once('_include/country_list.php'); //...

python: how to refer to the class from within it ( like the recursive function)

For a recursive function we can do: def f(i): if i<0: return print i f(i-1) f(10) However is there a way to do the following thing? class A: # do something some_func(A) # ... ...

why is OOP hard for me?

I have trouble writing OOP in PHP... I understand the concept but I never create classes for my projects... mainly because it's often a small project and nothing complex. But when I read OOP, it seems more difficult to code than writing simple procedural statements. It also seems to take a lot of room as well with so many empty abstract ...

Problem with accessing variables/functions from subclass Objective C

Hi, I am having a problem with accessing public variable 'activity', which is a UIActivityIndicatorView type, see class declaration below in QuickStartViewController.h: @interface QuickStartViewController : UIViewController <ABPeoplePickerNavigationControllerDelegate> { @public IBOutlet UIActivityIndicatorView *activity; } @property (...

How can I avoid including class implementation files?

Instead of doing #include "MyClass.cpp" I would like to do #include "MyClass.h" I've read online that not doing so is considered bad practice. ...

Most powerful and unexpected benefit of Linq in .NET OOP/D?

Since learning about Linq and gaining experience in it, I find myself leaning on it more and more. It’s changing how I think about my classes. Some of these changes were expected (ex. Using collections more) but often unexpected (ex. Getting initial data for a class as an XElement and sometimes just keeping it there, processing it lazi...

Image processing class in PHP

I need to build a PHP photo processing class, I know there are MANY that already exist to the public but I need to build one to do just what I need done and nothing extra and nothing less. I need my class to do this... 1) I create a new instance of my class and I pass in either a URL of a photo, or the path to a local photo being up...

In C# does the "is" keyword always have to be followed by a class?

In Actionscript you can have a variable hold a reference to a class type and then compare an instance of a class to the variable with is. Example: var a:Foo = new Foo(); var type:Class = Foo; if(a is type){ //this is true //do something } Can you do something similar in C#? Or does the "is" keyword always have to be followed by ...

Reading data from hard drive into a class

Hello everyone, Every time i try to read a file form the hard drive and cast the data into a structure, i end up with problems of the data not casting properly. Is there a requirement with the reinterpret_cast() function that requires the number of bytes in a structure be a multiple of 4 bytes? If not, what am I doing wrong? If so, how ...