class

How to profile the memory consumption by a set of C++ classes?

I am trying to figure out the memory consumption by my (C++) program using gprof. The program does not have a gui, it is entirely cli based. Now, I am new to gprof, so I read a few tutorials, that taught me how to run gprof and spot time consumption. However, I need to find out the memory consumption by a specific set of classes. Say t...

Strange problem with the vector when calculating values to a member.

This is an updated follow-up from my last question: http://stackoverflow.com/questions/3494178/fatal-error-from-incrementing-loop I've finished the sorting algorithm, which seems to work fine. Now my problem is trying to calculate the health for each fighter(in the getHealth() function) based on levels in my vector to calculate correctly...

Struts2 get the text boxes (dynamic) to action class

I have struts page where the text boxes are with dynamic ID and wanted to get this values into Action class. Can someone please help me with the code plz. ...

How can variables be used by a set of classes?

Hello All I have a question which I cannot seem to fathom out, as fairly newish to c++. I have a class, in which a set of variables are declared in the .h file and then initialised in the .cpp file. These same variables are used by a set of 3 other classes - and the compiler has them as out of scope. I am not sure how to link the classes...

Creating Classes and Properties in AS3

I'm new to AS3. Learning how to create classes. Is comp = new HouseObjects creating a new class? Is comp creating an instance of the HouseObjects? I realize that this is inside public class TreeHouse. I'm thinking that HouseObjects, how I set it up is not a class...not sure what the correct way to set up classes and properties. Also I n...

C++ pattern to prohibit instantiation of a class outside a certain scope?

I have a System class that can return a pointer to an Editor class. The Editor class is instantiated within the System class and passed pointers to System's private variables. The Editor class essentially acts as an alternative interface to System's internal data structures. My question: Does a design pattern exist that allows me to pr...

Using OpenGL glutDisplayFunc within class

I've created a C++ class (myPixmap) to encapsulate the work performed by the OpenGL GLUT toolkit. The display() member function of the class contains most of the code required to set up GLUT. void myPixmap::display() { // open an OpenGL window if it hasn't already been opened if (!openedWindow) { // command-line ar...

Accessing inherited class variables in PHP

Hello, I have two classes. Looking to be able to grab a variable that is within a global object of a class. Class Order { public $number = "1234"; } Class Business { public $order; function __construct() { global $order; $order = new Order(); } } $b = new Business(); echo $b->order->number; In the cas...

Can member function arguments be of the same class type ?

//node.h class node { public: void sort(node n); }; I didn't try the code yet . But It's interesting to know if is this a valid case and Why ? Edit : This leads me to another question : Can I declare FOO inside a member function like this ? //FOO.h Class FOO { public: void sort(int n) ; void swap(int x...

Class only writable by "parent" class, but readable by other classes

I'm using C#, with which I don't have a lot of experience (I've mostly worked with java/php/javascript so far) What I want is a class in which I save some data, this data can only be written by one other class, but still be read by other classes in the program. Something like this: public class DataObtainer{ DataItem[] Items; public...

when I create an object of a class, does it execute ALL methods inside the class or just methods called?

I am curious, if I create a class of many methods (functions as PHP still call them) which many of them are not used and I create an object, does it create memory for all methods even if most methods aren't being used? I'm doing PHP OOP coding. ...

simplehtmldom class and image

Hello, I am using simplehtmldom class to get all images from a website, i am trying to get width and height of image returned by simplehtmldom, what i am trying to accomplish here is, if a image width less than 50px, i don't want the image to be displayed. I tried getimagesize(), however its often keep on timeout i think due to amou...

referencing one aspx.cs class in another aspx.cs class?

Does anyone know how to reuse the code from one aspx.cs class in another aspx page? ...

What kind of role does static class play in web application?

Hi all, if I have the following class, will I run into a problem if 100 people are requesting the page at the same time? If there is only one copy of UpdateUser, will all the requests have to queue up and wait for their turns? Thank you. public static UserManager { public static void UpdateUser(int UserID) { // this...

Associating properties to Class objects

I would like to define properties for classes, and be able to access them before I actually instantiate an object of that class. I'll give some context. My application handles a library of components. Each component is mapped to a Python class. Now I want to know what configuration a component needs, before actually instancing the class...

Using my database class with other classes in my project

I have a custom database class that I wrote myself, and I also have a user class and a site class. The MySQL class has methods like this: connect query clean fetch The user class: register login logout resetPass The site class: updateTopics addTopic addPost addReply etc. These classes need to interface with a database, which i...

HTML Multiple classes on button element

Hi, I got this button: <button type="submit" class="rfrsh-btn submit" name="saveFields" title="Oppdater" value="">&nbsp;</button> I understand that elements can have multiple classes: .rfrsh-btn { background-image:url(../../upload/rfrsh_nb_grey.png); ... } .submit { font-size: 0.85em; padding: 0; } This was work...

"Call to undefined method" when trying to pass handle as a constructor argument

I have a user class that I need to use my database with. To do this, I am passing the database handle as a constructor argument like so: index.php: <?php include('classes/user.class.php'); $db = new mysqli('localhost', 'root', '', 'testdb'); if ($mysqli->connect_error) { die('Database connection failed (' . $mysqli->connect_errno...

Proper usage of MySQLi

Can anyone instruct me on the proper way to use the MySQLi extension in PHP? I have always used procedural MySQL functions before and want to make the change but am finding the examples on PHP.net and other sites way too complicated. There seems to be multiple methods to do the same thing. I want to use it in the following method: funct...

Jquery class attribute navigation

I'm trying to build a very simple VPS control panel; i have the following code that lists every VPS i have on a particular server : ($active variable is a BOOLEAN giving the current state of the VPS) <ul id="vps"> <li <? if ($active): ?>class="active"<? endif;?> > <? if ($active): ?> <div class="status">running</div> <?else:?> ...