class

Catchable error in php?

I have a really odd error: [04-Jun-2010 15:55:32] PHP Catchable fatal error: Object of class Type could not be converted to string in /home/prettykl/public_html/2010/includes/functions.php on line 140 This is the code and line 140 is the $sql line. if (!empty($type)) { $sql = "SELECT * FROM `types` WHERE `type` = '$t...

Wordpress sidebar classes

There any way i could add a class for the specific order of widget item? i.e. the class name would be widgetorder-1 (for the first appearing widget), widgetorder-2 (for the widget appearing in the 2nd order), etc. I looked into filters but wasn't sure how that worked. ...

PHP: How to get this string value?

I have an array with the following data: [steamid] => stdClass Object ( [0] => Shakyor ) How can I get the 'Shakyor' string from there? $array->$steamid doesn't work. $array->$steamid[0] doesn't work. $array->$steamid->0 is not legal markup obviously. ...

how to create a dynamic class at runtime in Java

hi, is it possible to create a new java file from existing java file after changing some of its attributes at runtime?? Suppose i have a java file pubic class Student{ private int rollNo; private String name; // getters and setters // constructor } is it possible to create something like this, provided that rollNo is...

Unsure how to come up with a good design

Hello there, I am having trouble coming up with a good design for a group of classes and was hoping that someone could give me some guidance on best practices. I have kept the classes and member functions generic to make the problem simpler. Essentially, I have three classes (lets call them A, B, and C) as follows: class A { public: ...

Reducing unnecessary same values in Class member variables ....

class A { public int a; public int c; } i will create 10 instances from A.Then i will create 15 instances from A again... go on. first 10 instance will have same value for a variable and next 15 instances will have again same value for a.But I don't mean that both group has same values for a .Problem is create same a value 10 times i...

Generate set/get methods for a c++ class

Is there any tool that generates set and get methods for a class automatically. Just I create classes very frequently and would like to have a tool which for each class-member wil generate the following functions automatically: Member_Type getMemberName() const; //in header file Member_Type getMemberName() const //in source file { ...

How to identify classes that implement an interface?

I have a VB6 EXE project with a large amount of classes - everything compiles to an EXE, there are not COM DLLs built. Some of the classes implement the IDataProcessing interface. How can I programmatically determine the classes that implement that interface? ...

Does the following indicate a bad design?

Hello, I was wondering whether you think the following code usually indicates a bad design ... class X { public: ... private: Y y; }; Class Y { public: Y( X& value ){ x = value; }; private: X& x; } (i.e. there is some sort of cyclic dependency between the classes X and Y). ...

Checking method visibility in PHP

Is there any way of checking if a class method has been declared as private or public? I'm working on a controller where the url is mapped to methods in the class, and I only want to trigger the methods if they are defined as public. ...

How can I use cout<<myclass?

myclass is a c++ class writed by me . and when I write myclass x; cout << x; // how to output is " 10 " or "20" like intger or float value ...

How to operate different class just one functionsone

class A {}; class B {}; class C {}; class D {}; //A+B , A+C, B+C , A+D, D+C namely all of these combinations will be possible just one functions ...

How do I call a variable from another class?

I have a class called 'Constants' that I am storing a String variable in. This class contains a few global variables used in my app. I want to be able to reference this class and call the variable (called profileId) in other Views of my app. I looked around and found a few examples, but am not sure how to do this. Currently my setup is...

Mootools - how to destroy a class instance

What I'm trying to do is create a class that I can quickly attach to links, that will fetch and display a thumbnail preview of the document being linked to. Now, I am focusing on ease of use and portability here, I want to simply add a mouseover event to links like this: <a href="some-document.pdf" onmouseover="new TestClass(this)">Tes...

syntax for calling virtual functions outside of the class?

Hi there, what is the syntax for defining virtual functions outside the class body? class random{ public: random(int i = 0); virtual ~random(){}; virtual void print() const; protected: int id; }; is it? virtual void random::print() { } ? ...

destructor and copy-constructor calling..(why does it get called at these times)

Hello there, I have the following code #include <iostream> using namespace std; class Object { public: Object(int id){ cout << "Construct(" << id << ")" << endl; m_id = id; } Object(const Object& obj){ cout << "Copy-construct(" << obj.m_id << ")" << endl; m_id = obj.m_id; } Object& oper...

Ruby Exception or Error?

I have noticed that in the Ruby exception hierarchy, there are "errors" such as ArgumentError and there are "exceptions" such as SignalException. Is there a certain practise of naming exceptions? thanks in advance, ell. ...

Auto-needed classes?

Suppose I have a class A and a class B. The .h of A, needs the .h of B, and the .h of B needs the .h of A. (need = #include). All .h have the guards: #ifndef _classX_ #define _classX_ ... ... #endif But if I compile the .cpp of A, then when it includes the .h of B, the B class cannot include the .h of A class because the A class has...

Best JDBC data source bean class

I see that some people use org.apache.commons.dbcp.BasicDataSource while other configurations have com.mchange.v2.c3p0.ComboPooledDataSource. Spring has its own: org.springframework.jdbc.datasource.DriverManagerDataSource There are probably even more. But which one is best? I have a JPA/Hibernate three tier application that needs co...

Load class based on SDK version

Is there any way I can load a class based on what version of the OS the phone is running? For example: I made an app which requires 1.6+ Android. Is there a way for me to load one class or the other based on what OS the phone is running? I'm asking this specifically for contacts. The database was changed from 1.6 to 2.0 and the old versi...