class

Checking programmatically if a .class file extends particular class.

Hi, I have a problem I've been trying to solve for quite some hours. In an Eclipse plugin, I have an ArrayList that contains the full paths (as strings) of some java .class files. What I'd like to do is check if the classes that are included in the list extend a particular class. I thought about parsing the file, looking for what is afte...

Main() doesn't want to access a class variable

Why I can access to X variable from "method()" and not from Main() method? class Program { int X; // this is the variable I want access static void Main(string[] args) { int a; a = X; // this doesnt work, but why? } void metodo() { int b; ...

loading shared classes in application javaee5

I am trying to load some classes that are common to all the web applications of my ear in a java ee 5 application. I tried to do this by putting the classes (not jar) in a) directory called "lib" b) also specifying in application.xml's <module><java>lib/common.jar</java></module> and was not successful by either option a or b...

How to define a struct whose members can be accessed by any internal classes but can only be set by a particular (internal) class?

How to define a struct whose members can be accessed by any internal classes via properties but can only be set by a particular internal class? (If it is possible.) If it is not possible, is there a work-about to achieve the similar requirement? Edit 1: below Reason: I have a class A with two members _x and _arrB. _x can be read but ...

C++: declaring a class with functions, that handle string

Hello, I haven`t found answer to my question using search, though I thought it is simple and popular. Anyway, my question is: I have got a header file, which declares a class and functions in it. It looks like that: #ifndef SOME_CLASS_H #define SOME_CLASS_H #include <string> class mySomeClass { public: bool a_func(string & my...

calling class from an external module causes NameError, in IDLE it works fine

i have the following code in a module called code_database.py class Entry(): def enter_data(self): self.title = input('enter a title: ') print('enter the code, press ctrl-d to end: ') self.code = sys.stdin.readlines() self.tags = input('enter tags: ') def save_data(self): with open('entry...

PHP- share class variable with a child class.

This is a follow up from yesterday's scope question. stackoverflow.com/questions/3301377/class-scope-question-in-php Today I want to share the "$template_instance" variable with a child class. How is this accomplished? require_once("/classes/Conf.php"); require_once("/classes/Application.php"); class index extends Application { p...

Objective-C Custom Class with Struct tutorial.

Hello. I'm coming from AS3 to Obj-C, and classes are confusing me. I want to create a ball class as a test, with colour, radius etc. Looking through other people's code I've discovered they use structs to implement them, and this seems like a much nicer method. I've searched but am unable to find a really clear explanation of what st...

Why do I get an error trying to refer a nested class in Ruby?

Why there is an error in the following example? class ClassA class ClassB end class ClassC def test ClassB.new end end end p ClassA::ClassC.new.test # => #<ClassA::ClassB:0x0000010103f860> class ClassA class ClassD def test ClassB.new end end end p ClassA::ClassD.new.test # => #<ClassA::ClassB:...

PHP Static class initializer

I have an helper class with some static functions. all the functions in the class requires a 'heavy' initialization function to run once ( like it was a constructor.. ). is there a good practice ? the only thing i thought of is calling 'init' function , and breaking it's flow if it already run once (using static $initialized var). pro...

Why does my command line application error out on remote assembly when ran outside Visual Studio?

I have a very simple command line .net application. I have reference to a .dll assembly and everything works just great when I run the program inside Visual Studio. However when I try to double click the .exe file or run it manually via DOS or something it error out saying it doesn't have access or can't find my assembly reference. Wha...

How to show a hidden class for an element with javascript?

Hi there, I'm having trouble trying to show a hidden class that has already been applied to an element. I'm trying to use the show() method with the class and selected element, to no avail. Any help would be appreciated! HTML <label for="name" class="overlay required"><span>Name...</span></label> <input class="input-text" type="text" i...

If I define a method in Ruby, does it belong to any class?

I have feeling, that if one defines a method def test puts 'Hi' end then there is a class to which this method belongs to (i.e. Unknown#test). So one probably has a possibility to list all methods defined "outside" of other classes. Or there is another way to do such listing? ...

function called in function throwing undefined function error

using the object-oriented approach, i'm trying to call a public function in a function in the same class, but it throws an error: Call to undefined function h() php: class Name { . .. . public function h($s) { echo htmlspecialchars($s, ENT_QUOTES); } public function formatQuotes($row) { return "<p id...

If I define a class-method in Ruby Object class, how do I get the name of a child class calling this method?

Example def Object.const_missing(name) puts self.class end class A; end A::B # => Class How can I get A in Object#const_missing? ...

How do I use a standalone class in cakephp 1.3?

I have a standalone class I wrote in PHP for some very basic LDAP/AD functions. and I would like to use this class in a project I am working on in cakephp. It looks like in cakephp 1.2 I could just add the class as a vendor, however it looks like cakephp 1.3 removed support for vendors. So how would I go about calling a few function fro...

How do I get class-object from string "A::B::C" in Ruby?

The following example fails class A class B end end p Object.const_get 'A' # => A p Object.const_get 'A::B' # => NameError: wrong constant name A::B UPDATE Questions about the topic asked earlier: Cast between String and Classname Ruby String#to_class Get a class by name in Ruby? The last one gives a nice solution which can...

Creating an instance of a class, before class is defined?

Here's an example of my problem : class bar() : spam = foo() def test(self) : print self.spam.eggs pass class foo() : eggs = 50 The issue (I assume) is that I'm trying to create an instance of a class before the class is defined. The obvious solution is to re-order my classes, but I like to keep my classes...

How do include and call sample code methods in Objective-C?

iPhone/Mac "play a sound class": link text I find an awful lot of great objective-c classes and code samples here... and elsewhere. I successfully create the .h and .m files, but how do I call them from my existing code? Where do I put the @class or #import statements? How do I call the methods? What if I need to play 2-3 different...

Wordpress: Adding class selectors to the_tags(); output

How do I get the_tags() to output each tag so that it comes assigned with a unique class selector? So for example: the_tags() currently outputs something like this: <a href="http://myblog.com/tag/kittens" rel="tag">kittens</a> However, I'd like to output something like this: <a href="http://myblog.com/tag/kittens" rel="tag" class="ta...