class

PHP Classes problem, class not found

I solved this question my own. The filename was wrong lolz. Hello everyone! I'm building a CMS like Drupal and Joomla. I'm working on the module feature (plugins), and I got the following error: Fatal error: Class 'settings' not found in C:\wamp\www\SYSTEM\view.php on line 22 Here is my code: start.php <?php //First of all, start ...

C#: Public Fields versus Automatic Properties

We're often told we should protect encapsulation by making getter and setter methods (properties in C#) for class fields, instead of exposing the fields to the outside world. But there are many times when a field is just there to hold a value and doesn't require any computation to get or set. For these we would all do this number: publ...

JavaScript "classes"

Are there any downsides to using a JavaScript "class" with this pattern? var FooClass = function() { var private = "a private variable"; this.public = "a public variable"; var privatefn = function() { ... }; this.publicfn = function() { ... }; }; var foo = new FooClass(); foo.public = "bar"; foo.publicfn(); ...

database query's from class object with php

Hello, My question is: Can I still do query's from within an object like this: $result = mysql_query ($q,$dbc) or trigger_error("Query: $q\n<br />MySQL Fout: " . mysql_error($dbc)); by passing the global dbconnection variable $dbc to the constructor or is there a better way? Or creating a singleton class for...

pass MySQL link to a class method

Here is my problem, i have a class with a ave method, i want to pass a Mysql DB link to it, so i create a new object from the class, and call the saveProperty method, and in my main file i created a MySQL connection and saved the link in a var called $db so when i call the method it's link this: saveProperty($db). but insted of saving t...

Any way to access array directly after method call?

Is there any way to do this in one line? $arr = $foo->getBarArray(); return $arr[0]; This throws an error: return $foo->getBarArray()[0]; ...

Objective-C @interface/pointer clarification.

Learning as always, was going along quite nicely, until I realized I had no idea what the differences meant between these. @class Player; @class Map; @interface View : NSView { Player* player_; Map* currentMap_; NSMutableArray *worldArray; NSMutableArray *itemArray; float cellHeight_; } @end Never mind, turns out...

Create an Eventhandler via class

I have an application with lots of ListBox controls. I was wondering if it would be possible to add the eventhandler for the onselectedindexchanged in the constructor of the Listbox? All listboxes will use the same method for this. I know I can add them manually but I was hoping for a solution that would change all the ones I currently...

C++ derive from a native type

In some C++ code, I use integers to store lots of changing data. To analyze my program, I want to log certain changes to some of the variables, such as how often a certain value is assigned to, and how often that assignment is redundant (the new value is the same as the old value.) If the type were a class Foo, I'd just derive a new Log...

php class method is preventing xml from working correctly

Hello, I have a problem that I cannot understand I am trying to make my webservice work from a class. I try'd to echo the xml from some function in a controllerclass, but that diddn't work. So, I moved the xml around to a place where it did work. That means that I placed it before the loader function is called. That's where it still w...

When to use static vs instantiated classes

PHP is my first programming language. I can't quite wrap my head around when to use static classes vs instantiated objects. I realize that you can duplicate and clone objects. However in all of my time using php any object or function always ended up as a single return (array, string, int) value or void. I understand concepts in books ...

Tools for creating Class Diagrams

Please suggest tools for creating Class Diagrams with the following criteria: It should be platform-independent because I use Linux and the file is expected to be edited by other members of the team using Windows/Mac Free, because there no such free tool, we should create one It would also be nice if you can include a screenshot of the...

How do I check If a Class already exists in Ruby

How do I check If a Class already exists in Ruby, My code is: puts "enter the name of the Class to see if it exists" nameofclass=gets.chomp eval (" #{nameofclass}...... Not sure what to write here") I was thinking of using: eval "#{nameofclass}ancestors. ....." ...

Define Implementation for abstract Object

I am looking for a way to do the following: A Project : Defines an abstract class that is called when some events happen (event handler if you will) Defines the engine that will fire the events using the event handler above B Project: Defines the implementation for the abstract class Runs the engine. How can i register the implementa...

a CSS class for Java

I'm about creating a java class for parsing and storing the content of a simple CSS stylesheet. This class will be used to paint a non-html object using the CSS selectors. My naive approach is to basically use a Map<String,Map<String,Object>> to store this stylesheet. Would it be any (clever) other way for storing this information ? ...

Reading settings from app.config or web.config in .net

I'm working on a C# class library that needs to be able to read settings the web.config or app.config file (depending on whether the DLL is referenced from an ASP.NET web application or a Windows Forms application). I've found that ConfigurationSettings.AppSettings.Get("MySetting") works, but that code has been marked as deprecated by M...

Defining multiple-type container classes in haskell, trouble binding variables.

Hello, I'm having trouble with classes in haskell. Basically, I have an algorithm (a weird sort of graph-traversal algorithm) that takes as input, among other things, a container to store the already-seen nodes (I'm keen on avoiding monads, so let's move on. :)). The thing is, the function takes the container as a parameter, and calls j...

Do you use Data-aware classes?

I'm using VB6. Data-aware classes refers to classes whose DataBindingBehavior or DataSourceBehavior property is set. I learned this concept from MSDN and am wondering usually when should we use this technique of Data-aware classes? Or just like the Data Environment Designer which is just ignored by most developers? ...

OOP: retrieve 'fathers' attributes from the 'child' object.

Hi guys, here i am again ;) My problem atm is with nested php classes, i have, for example, a class like this one: class Father{ public $father_id; public $name; public $job; public $sons; public function __construct($id, $name, $job){ $this->father_id = $id; $this->name = $name; $this->job =...

How to tell whether a variable has been initialized in C#?

Hello, I know this is a dumb question and I guess it must have been asked before. However I am unable to find an answer to my question. Here is some sample code (which of course does not compile) to outline my problem: class test { int[] val1; string val2; static bool somefunction(test x, test y) { dosome...