class

obtaining java source from class name

Is there any way to obtain the java source from a class name? For example: import java.io.File; . . . I want the java.io.File source. I'm working on a kind of parser and I need the source at execution. The problem is that I've to search recursively. For example: int function (User user){...} and User class is public User{ private...

How can I create an object inside a class?

How can I do this, as the most obvious way doesn't work: <?php class Inner { public $var; } class Outer { $test = new Inner; } ?> Yields: Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /f5/debate/public/test.php on line 10 ...

Python - use of 'self' - noob here going crazy trying to understand it.

I have a simple socket class: MySocketLib.py .. import socket class socklib(): def create_tcp_serversocket(self,port): serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serversocket.bind((socket.gethostname(), port)) serversocket.listen(5) return serversocket def send_msg(self, s...

C++ alter private member variable from static member function

I noticed while reading through my code that I have a static member function which alters a private member of its class through a pointer to an instance of said class. It compiles and functions without issue, but I just wanted to know whether or not it was kosher to edit a private variable in this way, from a member but static function,...

Programmatically choose the class to be instantiate

I am currently playing around with VB.Net using Visual Studio 2010 (.Net 4.0) and I need your help to create a collection class (let's call it 'cl_MyCollection') with a constructor that accepts two arguements: 1) An "SqlDataReader" object 2) Some means of pointing to a custom class I have created The scenario is; I have five database ...

Weird problem with a custom bindable class and a vector.

Hello.... I'm having a very weird problem with a vector in my application. Details... I have the following classes. Person,Player,PlayerController. Player extends Person. Person extends ObjectProxy in order to enable binding. So the Player class has the [Bindable] tag. The PlayerController class contains a remote object calling a ph...

Cross class communication without refering the instances C#

I have two classes that are instantiaded and loaded at runtime. I would like to check the resources of one without having to refer the instances as it can get messy if there are a lot of checks and classes. For example, if I have the two following classes and I want to call one from another. Class Item { private int id; priva...

How to add a public var in class in php?

Hello I currently have a error-system like this on my header.php: include('class.error.php'); Errsys::disable_default(); Errsys::enable_logging('errors.dat'); So, I'm not creating a new object via $asd = new Errsys;. How to add a variable to class, so it can be called like Errsys::variable or via any similar syntax inside or outside ...

How to resolve "static method ___ should be accessed in a static way" warnings

I'm going through the book Just Java 2 but am evidently missing something basic. These are two separate projects. I've generated a JAR for the second and added it to the first's build path. The correct areas are printed but the compiler generates these warnings. How would these be resolved? // -------------------------------------------...

C# using class object in multiple forms changes all variables within class

I have a MDI application. One of the forms needs to be able to have multiple instances of it open at the same time. Within this app I have a Program class. For each instance of the form I need to place a Program object into each form. This is working, however, everytime data is changed it changes all of the Program objects within all of ...

How to simulate multiple inheritance in C#

How can I do this: Class A : DependencyObject {} Class B : DependencyObject {} Class C : A , B {} ...

Public Property Definition

Hi guys, What are the benefits of defining a property for a object instead of giving direct access to the private variable? Instead of : public class A private _x as integer = 0 Public property X() as integer Get return _x End Get Set(ByVal value As integer) _x = value ...

How to create a read-only class property in Python?

Essentially I want to do something like this: class foo: x = 4 @property @classmethod def number(cls): return x Then I would like the following to work: >>> foo.number 4 Unfortunately, the above doesn't work. Instead of given me 4 it gives me <property object at 0x101786c58>. Is there any way to achieve ...

jQuery - get the first class only from a element

The element looks like this: <li class="blah active"> ... </li> jQuery.attr('class') will return both classes. How can I get only the 1st class ('blah' in this case) with jQuery? ...

codeigniter image manipulation question

Having a problem with image manipulation in codeigniter - it bombs when I get to $this->image_lib->resize(). I just can't see the error. Code: $imagemanip = array(); $imagemanip['image_library'] = 'gd2'; $imagemanip['source_image'] = '/resources/images/butera-fuma-dolce.jpg'; $imagemanip['new_image'] = '/resources/images/thumb_bute...

Class Design Question

I need help trying to figure out the proper design of my classes. I have a user class: class AppUser: _email - String _fullname - String _organizations - List of ???? _active - Boolean ------------------ getOrgs - Method Also, I have an Organizations class: class Organization: _name - String _domain -...

C++ Class Pointer Deletion (Segmentation Fault Issue)

SOLVED Well, it seems that I'm receiving a segmentation fault when I try deleting my class pointer. I've tried many things, but yet haven't got it to work. Anyways, here is my main.cpp: (this segmentation fault is occurring when I delete 'm') /* * Copyright(c)Fellixombc 2010 * * TextToSqlRs is free software: you can redistribut...

Get class type in shared objective-c method?

In Objective-C there is the Alloc/Init metaphor. They've also added a shared convenience method called 'new' that internally just calls both in succession. And if I create a subclass of NSObject called FooClass, FooClass picks up those shared methods, including 'new'. BUT... how the heck is that implemented?? It can't simply delegate...

split iphone objective-c code in to multiple files

I have written a few apps for the iphone now, but they are all written in what I consider to be a lazy, unstructured way. I have started a new project and have created several Objective-C classes (subclass of NSObject). the problem I have is getting the logic correct in my head. My structure is as follows viewController.h viewControll...

c++ forward declaration of pure virtual class

Hi, I have a forward deceleration problem. I had a normal class before, called GlobalCWND, it was instantiated and used in another class ProtocolContext. I forward declare the ProtocolContext class in Requestor.h. You can see the related part of the code of this 2 classes. ============Protocol Context======== class Requestor<Reques...