class

python: defining registry in base class

I'm implementing enumeration using a base class that defines a variety of methods. The actual enumerations are subclasses of that, with no additional methods or attributes. (Each subclass is populated with its own values using the constructor defined in the base class). I use a registry (a class attribute that stores all the instances o...

php global variables

I have a global variable $config, now i have a class and i want to use a value from config as a default argument for a class method like function f(var=$config['val']){} will this assignment work? ...

How to call stage objects from a non document class?

Hi, The problem I'm facing is that I'm trying to manipulate (in this particular case add eventListeners) objects (in this case some MovieClips) on the stage from a class that isn't the document class. 1120: Access of undefined property trans. Now I know that it's probably a scope thing and I probably can't access stage objects direct...

Does PHP closing tag destructs an instantiated class (object)?

<?php class Student { public $name = "Benjamin"; } $name = new Student(); ?> <p>Hello, there. My name is <?php $name->name ?></p> The above code doesn't work as intended (printing the name within "p" tags). But the below code, of course, does work: <?php class Student { public $name = "Benjamin"; } $name = new Student(); echo '<...

class member function in function?

So i have this class that includes some custom functions named class.php I have another file called config.php that includes require('engine.class.php'); $engine = new engine; config.php also requires functions.php to run like: require('functions.php'); i have a function in functions.php that uses $engine eg: function login($usern...

How to get the name of the calling class (in PHP).

define('anActionType', 1); $actionTypes = array(anActionType => 'anActionType'); class core { public $callbacks = array(); public $plugins = array(); public function __construct() { $this->plugins[] = new admin(); $this->plugins[] = new client(); } } abstract class plugin { public function registerCall...

Can I make a public member variable private in a derived class?

I want to do make a public member in a base class private in a derived class, like this: class A { public: int x; int y; }; class B : public A { // x is still public private: // y is now private using y; }; But apparently "using" can't be used that way. Is there any way to do this in C++? (I can't use private...

Mootools add a class to 'a' href="something"

The situation is that I want to add a class 'display-none' to li eliment which has a child eliment 'a' <li class="mostread"> <a href="/intranet/Admin/Error-Pages/404.html" class="mostread">404</a> </li> i.e., if li class mostread has child element a href="/intranet/Admin/Error-Pages/404.html" and class mostread then add class 'di...

find occurences of a class and if there is only one then hide with Jquery

I'm trying to hide a button depending on how many occurrences of a certain class there are. I am dynamically putting data into a page and for each dynamic div i put in i assign it the class "propdata" I need to count how many occurrences there are of "propdata" and if there is only one occurrence i need to hide the button with a class o...

Python error "NameError: global name 'self' is not defined" when calling another method in same class

Hello all. I get a weird error: Traceback (most recent call last): File "/remote/us01home15/ldagan/python/add_parallel_definition.py", line 36, in <module> new_netlist.lines=orig_netlist.add_parallel_extention(cell_name,parallel,int(level)) File "/remote/us01home15/ldagan/python/hspice_netlist.py", line 70, in add_parallel_extention new...

Being observable

What does it mean: Object's observable state? I was reading yesterday in "Exceptional C++" Solution to item 43 and there is a fragment: private: void InvalidateArea() { area = -1; } Even though this function modifies the object's internal state, it should be const. Why? Because this function does not modify the object's observabl...

Mac OS X version of Texture2D.m, .h available?

Hi all, Apple's Texture2D class is a very useful bit of kit for iOS developers. Q. Is there a Mac OS X version of this class available? (I've googled but can only find iOS implementations, mostly through Cocos2D projects.) Cheers. ...

How safe or bad is using BasePage for opening and closing SQL connection?

Hi, I have BasePage.cs class which is being used by other .cs files instead of System.Web.UI.Page (public partial class page : BasePage). I am using it for opening and closing SQL connections to make sure every SQL connection gets closed. Code looks like this { public class BasePage: System.Web.UI.Page { public SqlCon...

Easy way to pass DB object into class that is extended numerous times

Hey guys, Consider the following PHP code: <?php require_once("myDBclass.php"); class a { private $tablename; private $column; function __construct($tableName, $column) { $this->tableName = $tablename; $this->column = $column; } function insert() { global $db; $db->query("IN...

Hiding inner classes - What am I missing???

Hi all, Really hope someone can point me in the right direction as I have no hair left anymore... I am developing a simple SDK using VB.NET in VS 2010 and I have a class (OuterClass) that is inheriting another class (InnerClass). There are obviously properties and methods in the InnerClass that are accesible from the OuterClass. ...

Forward Declaration vs Include

Consider the following two scenarios (Edited just to complete the whole question and make it clearer) Case 1: (doesnt compile as rightly mentioned below) //B.h #ifndef B_H #define B_H #include "B.h" class A; class B { A obj; public: void printA_thruB(); }; #endif //B.cpp #include "B.h" #include <...

what happened in inheritance of same class name holded classes in different packages

package a; class hello{ } package b; import a.*; class hello extends hello{ } please tell me what is the result?? ...

Find classes within Jar

Hi , I have a jar file and I want to know which all classes are within it. Is there any way I can do that? ...

how hasnext() works in collection in java

program: public class SortedSet1 { public static void main(String[] args) { List ac= new ArrayList(); c.add(ac); ac.add(0,"hai"); ac.add(1,"hw"); ac.add(2,"ai"); ac.add(3,"hi"); ac.add("hai"); Collections.sort(ac); Iterator it=ac.iterator(); k=0; while(it.hasNext()) { Sy...

New Activity nullpointerexception Problem

Hello, I have a noob problem. Here is my situation: I want to start a new activity from the main activity. The code to launch the new activity is found in a separate class file. I seem to be passing the wrong arguments and I am ending up in a nullpointerexception when trying to launch the new activity. The new activity launches fine whe...