class

Listing values of unknown enum

Say we have a Class object. Name it cls. Now cls.isEnum() returns true What a joy!!! Could I please have the values listed to me? (one sugar, no milk) ...

How can I pass a Class as parameter and return a generic collection in Java?

I am designing a simple Data Access Object for my Java application. I have a few classes (records) that represents a single row in tables like User and Fruit. I would like to have a single method for getting all records of a specific type. For the moment I have it like this: public List<User> getAllUsers() { ... } public List<Fruit>...

How to pass a class into another class to a codebehind?

How to pass a class into another class to a codebehind? When I debug and check the myCategoryObj in the Default.aspx page, I can see the object is in the debug. What am I doing wrong? I know I could create the object in the Default.aspx but I should not have to I should be able to call the Business Logic Layer and ask for an object ...

When does an F# type need to be initialised using new?

Given a class such as: type MyClass() = member this.Greet(x) = printfn "Hello %s" x is it appropriate to initialize instances using let x = new MyClass() or without the new? Also, when is the use of a new constructor more useful than a do binding with parameters supplied to the type definition? ...

PHP Includes in Apache Password Protected Directories

(THIS IS A DUPLICATE, I FORGOT A TAG, PLEASE FORGIVE) I'm writing a small CMS for a client using my own little framework and am running into one issue (not 100% sure it's an issue, but I'm sensing it will be). So, for example, I have a News.php class that handles all of my Blog updates (CMS user input) and output (display of blog data ...

PHP - Using a constant's value to reference a data member.

Hello, I am trying to access one class object's data member by using a constant. I was wondering if this is possible with a syntax similar to what I am using? When I attempt to do this in the following script I get this error: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM class Certificate { const BALANCE = 'cert_ba...

OO PHP Class method renamed to variables?

Hello fellow PHP geeks, I'm sort of in a weird situation... One of which I've never come into before (It's maybe due to my break from PHP to .Net). Using the framework CodeIgniter. Well here's the situation... I've got a User class which acts as the user object containing username/password/email etc... (shown below): <?php if ( ! def...

TreeView Multibinding with multiple classes

I was reading this post StackOverFlowPost but I think I need more than that. Here is my situation. I am trying to fill a TreeView with items from a class with two different types ObservableCollection's. Here is the class definition: public class User : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged...

function to define current class in js

What I want to do is to have a function that executes to define a "current" class to an <li> tag, depending on the page name. For example, if the page is named index.php, I want the function to determine if the link within the <li> tag is the same name as the page (index.php). I'm sorry I'm not the best at explaining this. Here's an exam...

How to structure a utility/companion project in a multi-project solution

Let's say I have a Visual Studio solution with a Web project, a BLL project, and a DAL project. I'm trying to follow the repository pattern keeping my SQL code in the DAL with an interface that is referenced by the BLL. I have a handful of common solutions for things such as error handling, usage logging, and other things that can be c...

Match a PHP class with a Regular Expression

I wanna catch Php classes from a file: class a { function test() { } } class b extends a { function test() { } } and the result matches must be class a { function test() { } } and class b extends a { function test() { } } ...

Mutually recursive classes

How do I implement mutually recursive classes in C++? Something like: /* * Recursion.h * */ #ifndef RECURSION_H_ #define RECURSION_H_ class Class1 { Class2* Class2_ptr; public: void Class1_method() { //... (*Class2_ptr).Class2_method(); //... } }; class Class2 { Class1* Class1_ptr; public: void C...

What is a php5 classes approach to this?

Hi there, I am programming in an old fashion - still using functions and not classes. For example, something basic I do when creating a basic template for a site is put the header and footer in a function like so in a file called functions.php <?php //header function outline_start() { echo ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1...

Getting and placing content within html tag by its class using php

Is it possible to get and place content within an html tag by its class name? For Example: <div class='edit'> Wow! I'm the Content. </div> Is it possible to get that value, edit and place it back or a new value to that div etc? If it's possible... will it work if it has multiple classes? Like: <div class='span-20 edit'> Wow! I'm the ...

Is PHP classes an effective solution for listing content?

Hi there I would like to list my portfolio on our website, and I wrote a class, Client for setting and getting parameters about each client's basics, i.e.: the client's name, website, is it featured, is it published, what items did we do for them, etc. It's fairly primitive, but am I correct in assuming it's better to create an object ...

PHP - How to share / pass variables across different methods in a PHP Class

I am trying to set a value from a method of a class and trying to get it in another method. The example code is as below. I think the below kind of set/get works in a Java class. Googled out but still could not find a relevant solution. Searched: http://www.google.co.in/search?hl=en&amp;client=firefox-a&amp;rls=org.mozilla%3Aen-US%3Aof...

can we assign an Exception Class object to the reference of Object class object

why this is will not work, can any one give the exact answer for this one.... public class Manager { public static void main(String args[]) { try{ Object obj=new A(); //it will generate ClassNotFoundException object System.out.println("currently the reference obj is pointer to the ...

What happens with Unused Class Properties

I am interested to know what happens with unused properties of a class when an object is instantiated? Are there performance hits for having additional unused properties? What about complex properties that are accessing the database, but I'm not using them, are they still being loaded? ...

What exactly does "static" mean when declaring "global" variables in Java?

I've been running into this problem many times and I never bothered to learn why its happening and learn what "static" actually means. I just applied the change that Eclipse suggested and moved on. public class Member { // Global Variables int iNumVertices; int iNumEdges; public static void main(String[] args) { // do stuff ...

virtual class in abstract class

Hello :) i would like to ask, if it's posible to make something like this: i have base class (parent) A and three other classes (childs) B C D in class A, i have virtual functions, that's ok. but what if i need a virtual class ? class A { public: virtual int func1()=0; virtual int func2()=0; virtual class AB; // !!!!??? }...