class

calling variables from external JFrames

I have a Java game i'm creating and each window is a seperate JFrame with its own components. How would I get about calling variables from other .java programs? Not quite sure how to do that. ...

Database class in PHP; only has one function - question about practices and whether it's a good idea

So I have this database class in PHP and I only have 1 function in it (other than __construct and __destruct. Let me explain further... I had originally written it so when I connected to a database I would just call my function connect_to_db() which returned a mysqli object. I then used this objects functions (->query(), ->prepare(), -...

Raising an event from inner class to be handled at outer class, How to Do ?

I have a class A, B class A { public class B { public event EventHandler handleClick; public void eventraising(object sender, EventArgs e) { if (handleClick != null) handleClick(this, e); } } //handle raised event...

Extending TextItem Class in Flex 4

I am trying to extend the TextItem class in Flex 4 but I keep getting the following error: Could not resolve <custom:txtIdNumber> to a component implementation. My txtIdNumber.as is as follows package custom { import spark.components.TextInput; public class txtIdNumber extends TextInput { public function txtIdNumber...

Two-way inclusion of classes & template instances

Hi all, I'm having a problem when trying to compile these two classes (Army and General) in their own header files: #ifndef ARMY_H #define ARMY_H #include "definitions.h" #include "UnitBase.h" #include "UnitList.h" #include "General.h" class Army { public: Army(UnitList& list); ~Army(void); UnitBase& operator[](con...

Is it good convention for a class to perform functions on itself?

I've always been taught that if you are doing something to an object, that should be an external thing, so one would Save(Class) rather than having the object save itself: Class.Save(). I've noticed that in the .Net libraries, it is common to have a class modify itself as with String.Format() or sort itself as with List.Sort(). My qu...

In Ruby, if "global_variables.class" returns "Array", how do you tell whether global_variables is an array or a method?

In Ruby, if global_variables.class returns Array, how do you tell whether global_variables is an array or a method? ...

C++ : Call a base class method automatically ?

Here we go, I'm trying to implement the command design pattern, but I'm stumbling accross a conceptual problem. Let's say you have a base class and a few subclasses like in the example bellow : class Command : public boost::noncopyable { virtual ResultType operator()()=0; //restores the model state as it was before command'...

Creating a list class with predefined class, which is not possible to create the list<t> class outside it.

Maybe a confusing title, what I'm after is a class, which only has certain amount of instantiations. Still confused? What I'm actually after is a list of star ratings(none, half, one, one and a half) etc. So I need a class (or maybe a struct?) which has two fields, value and string representation (for now anyway, leading to other fields...

Setting a variable in a class function, where can I use that variable

Hi all, If I have a class (like below) and in a function I set a variable (below:$this->example) but I havent declared the variable at the top of the class (e.g var $example;) where and how can I use this variable? I tried using it straight away in another function but it didn't work (I guess I could have made a mistake but it worked a...

PHP is giving error when calling a function inside a class?

Hi, i'm new related to creating php class's and objects... I'm trying to make a class to comunicate with our company api. When i'm calling a function to a variable, php hangs with error: Parse error: syntax error, unexpected T_VARIABLE in /var/www/(...)/microdualapi.class.php on line 168 Can anybody give me a light? :) The code is a...

C# PropertyGrid: Create Expandable item when value is null

I have class (ClassA) with some public properties. One of the properties (ClassBValue) is of a class type (ClassB) which has some public properties, too. Now I want to show ClassA objects in a PropertyGrid. I use the [TypeConverter(typeof(ExpandableObjectConverter))] Attribute for the ClassB property of ClassA. The problem is, that...

how to access a class through id using jquery?

I have an html as follows: <fieldset id="question1"> <legend class='legend'>...</legend> ... <input type="text" name="label_no1" id="label_no1" autocomplete="off"> </fieldset> On the java script, I'm cloning the fieldset, yet I want to access its element to change ids, and some of the text. I tried this and it did not work: $(...

Why type(classInstance) is returning 'instance'?

Hi! I have a method that accepts a parameter that can be of several types, and has to do one thing or other depending on the type, but if I check the type of said parameter, I don't get the 'real' type, I always get <type 'instance'>, and that is messing up with my comparisons. I have something like: from classes import Class1 from c...

I have written custom classes for IIS, v 6.X , and they don't seem to be working

I have written a couple of custom php classes that are deployed to IIS servers. They work fine on the development box but not on the staging server. I don't have much experience with IIS and am not sure if it's a config issue with IIS or a something to do with the php.ini file. Any hints would be appreciated. Sorry for being vague. ...

JavaScript "Toaster Popup" class works awesome in FireFox fails in IE...

SOLVED: SEE "CORRECTED SOLUTION" Area (below) --------------------------------- ORIGINAL TEXT --------------------------- I've created a JavaScript toaster popup to show info about an individual row. It works great in FireFox...but it goes down in flames in IE. ...suggestions and help appreciated. WHAT I THINK IS FAILING: I think I ...

In PHP 5 can I instantiate a class dynamically?

For example is something like this possible in PHP? class foo { public $something; } $class_name = "foo"; $f = new $class_name; ...

Error when using array_filter with static functions in class

i have a class like this class im_a_class { static function not_empty() {...} function render() { return array_filter($array,'self::not_empty') }; } this code works in php 5.3.0 but doesn't work in version 5.2.8. i had to put it out and use it like this function not_empty() {...} class im_a_class { function render() { return...

Getting strange error when attempting to convert Unmanaged C++ class to Managed C++ class (for use in .net)

Greetings, First off, I am not a C++ developer, so please forgive my shortcomings.... I am attempting to take another developer's C++ unmanaged code and re-work it so it can be called from a managed DLL from our c#.net application. Please keep in mind that I'm a .net developer, and I haven't touched C++ in like 12 years. And when I ...

How to create map with keys/values inside class body once (not each time functions from class are called)

I would like to create C++ class which would allow to return value by given key from map, and key by given value. I would like also to keep my predefined map in class content. Methods for getting value or key would be static. How to predefine map statically to prevent creating map each time I call getValue(str) function? class Mapping {...