class

Ruby forwarding method calls

I have an instance of a master class which generates instances of a subclass, these subclasses need to forward some method calls back to the master instance. At the moment I have code looking something like this, but it feels like I should be able to do the same thing more efficiently (maybe with method_missing?) class Master def ini...

AS3 Demo cant make it work

Hi guys, Im trying to use this example code from: http://www.michelvandersteege.nl/blog/archives/266 function splitRGB(img:DisplayObjectContainer):Object { var bmd:BitmapData = new BitmapData(img.width, img.height); bmd.draw(img); var r:BitmapData = new BitmapData(bmd.width, bmd.height, true, 0xFF000000); var g:BitmapData = new...

how to match var/id to class

Hi. I'm new to jquery and, in addition, I think I'm having a brain freeze. I have a number of links with different ids. I want to match the clicked link with a div with the corresponding class so the div will show/hide/toggle as appropriate. I have: <script type="text/javascript"> $(document).ready(function() { $('.folioBox').hide();...

Initialize a Variable Again.

That may sound a little confusing. Basically, I have a function CCard newCard() { /* Used to store the string variables intermittantly */ std::stringstream ssPIN, ssBN; int picker1, picker2; int pin, bankNum; /* Choose 5 random variables, store them in stream */ for( int loop = 0; loop < 5; ++loop ) { ...

What's a common practice of completing abstract class?

You have a class, that perfectly fits to be an abstract, but this class cannot work normally without data supplied from derived class. It's not convenient to pass all data to constructor because not all of it may be needed, and many of them can be dynamic (result from child function). What are the best practices to compose such structur...

importing class and its function from another file

Hi everyone, I am having little problem with importing classes in python. My work flow goes like this index.py class Template: def header(): def body(): def form(): def footer(): display.py I want to call function header(), body() and footer () in my display.py page. Will anyone make me clear ab...

Generic Class VB.NET

hi guys, I am stuck with a problem about generic classes. I am confused how I call the constructor with parameters. My interface: Public Interface IDBObject Sub [Get](ByRef DataRow As DataRow) Property UIN() As Integer End Interface My Child Class: Public Class User Implements IDBObject Public Sub [Get](ByRef DataR...

Accessing a Windows App Object from another Class using C#.NET

Hi, I have a simple windows application where I have a window with some buttons and labels together with a couple of other classes. My problem is that I have some methods in the classes in which I would like to update some labels in the main form. How is it possible to access the labels directly from the classes? thanks EDIT: A littl...

Importing a class in a JSP file

I wrote some code as a Java Servlet and I am now trying to convert it to a JSP. I wrote a class in a separate file which I was using, and I can't figure out how to get the JSP file to recognize the class. I guess it has something to do with importing. I gave the class a package (package mypackagename;) name and I tried using <%@ page imp...

Is there a way to tell if a class was compiled for java6?

How can I do to tell if a java class was compiled for use on a java 6 vm? Is there an easy way? ...

accessing parent class inherited variable in subclass in PHP

I have made a class in php which is goind to be inherited by another class in the other folder. when i put echo $this->protectedvariableofclass; //in subclass function it gives no value remember my base class is stored \class\user.php sublass is stored as \model\model_user.php Please help me out Thanks in advance Base Class in \class\...

How to find CPU-intensive class in Java?

I have a big program in Java that uses multithreading. In some cases, the program starts using 100% of three cores of my eight core system. In normal use, the program use all cores at 1-2%. How can I find the class that's overloading cores? ...

Rails: i have a class method and i want to modify something of the instance

Rails: i have a class method and i want to modify something of the instance something like this: class Test < Main template :box def test # here I want to access the template name, that is box end end class Main def initialize end def self.template(name) # here I have to save somehow the template name ...

Can i access outer class objects in inner class

I have three classes like this. class A { public class innerB { //Do something } public class innerC { //trying to access objB here directly or indirectly over here. //I dont have to create an object of innerB, but to access the object created by A //i.e. innerB ...

Get information from a higher class?

I don't know really how to word the question so please bear with me... I have 3 classes: Server, Database, and Table. Each class has a "Name" property. How I want it to work is that each server can have multiple databases and each database can have multiple tables. So in the Server class I have this property. Private _databases As List...

AS3, Flex : update an Object at Event.ENTER_FRAME the correct way

Hi there! What is the best practice for updating an object at Event.ENTER_FRAME? here's the code: addEventListener(Event.ENTER_FRAME, enter_frame); protected function enter_frame(event:Event):void { //update the object in the exernal class Extrn.updaterMethode(anObject); // some logic if(foo==bar) { // get a property from t...

iPhone: Helpful Classes or extended Subclasses (Categories) which should have been in the SDK

This is more a community sharing post than a real question. In my iPhone OS projects I'm always importing a helper class with helpful methods which I can use for about every project. So I thought it might be a good idea, if everyone shares some of their favorite methods, which should have been in everyones toolcase. I'll start with an ...

Learning OOP in PHP, trying to refactor my code. Can't connect to database anymore.

Thought I understood how classes work, then I tried this code: class user { var $dbcon; var $dbinfo; var $con; var $error; function dbConnect() { $this->dbinfo['server'] = "localhost"; $this->dbinfo['database'] = "foolish_faith"; $this->dbinfo['user'] = "user"; $this->dbinfo['password'] = "password...

How to create PHP method linking?

I've seen other objects that do this: $obj->method1()->method2(); How do I do that? Is each function just modifying the pointer of an object or returning a pointer? I don't know the proper term for this style -- if anyone could help me with that, it would be great. ...

Best practice for referring to classes in CSS

If you have an HTML page with a class in an element, for instance <div class="myClass"> would it be best to refer to it in the CSS as .myClass or div.myClass? Thanks in advance! ...