class

Actionscript Adding Custom Class To .fla

i'm missing something fundamental here. i have a very simple custom class that draws a circle and a checkbox, and only allows dragging of that circle sprite if the checkbox is checked. a checkbox component is manually added to the library in my .fla. from my .fla project's actions panel: var ball:DragBall = new DragBall(); addChild(b...

External class-calling

Hi guys i have a bit of a problem with a few classes, and i would be very grateful if someone can help me out. So i have: Already compiled executable (for whom i don't have the source) A class in that program that i want to call The program doesn't have export for the class, and that's my problem i don't have definition for this clas...

Python Vector Class

I'm coming from a C# background where this stuff is super easy—trying to translate into Python for Maya. There's gotta' be a better way to do this. Basically, I'm looking to create a Vector class that will simply have x, y and z coordinates, but it would be ideal if this class returned a tuple with all 3 coordinates and if you could edi...

Python instances and attributes: is this a bug or i got it totally wrong?

Suppose you have something like this: class intlist: def __init__(self,l = []): self.l = l def add(self,a): self.l.append(a) def appender(a): obj = intlist() obj.add(a) print obj.l if __name__ == "__main__": for i in range(5): appender(i) ...

How can I reverse ruby's include function.

I'll explain what i'm looking for in code as thats probably the most succinct: module Mixin def method puts "Foo" end end class Whatever include Mixin end w = Whatever.new w.method => "Foo" # some magic here w2 = Whatever.new w.method => NoMethodError I had tried just undefining the Mixin module using remove_const, but t...

How can I make a class recognize that an interface found in a separate file exists

Hi, I've made an interface called ApprovalEvent in a separate file with the namespace myproject... I've also made a class called PurchaseOrder... it's also in the same namespace, just in a separate file. Whenever I try to make PurchaseOrder implement ApprovalEvent it always says that ApprovalEvent is undefined... How can I make the cla...

Excluding some tags from the Cufon Font system

Hi everybody, I'm using Cufon to load some nice fonts with javascript. And, as I have many tags, I use the following instruction to replace all the tags: Cufon.replace('*', { fontFamily: 'MyFont' }); But, I recently decided to exclude some tag classes from the replacement. Is there an instruction like: Cufon.exclude('TheClassToExclu...

How can I "replace" a module included via ruby include function

As a follow up to http://stackoverflow.com/questions/2403057/how-can-i-reverse-rubys-include-function, which was well answered but turned out my simplification of the real problem mean't that the solution was not applicable. I'm now faced with this (names changed to protect identities!): module OldFormHelpers def foo puts "foo" ...

PHP multiuser login class or script

I am looking for a simple but secure login script with mySQL PHP: sessions, MD5 that I can use with my exsisting database. Cookies to store password + password recovery by email. Change login/pass. I do not need registering, I register the user myself with temp login/pass. table agents agent1 agent2 table albums album1, owner: age...

Why is the new Tuple type in .Net 4.0 a reference type (class) and not a value type (struct)

Does anyone know the answer and/or have an oppinion about it? Since tuples would normally not be very large I would assume it would make more sense to use structs than classes for these. What say you? ...

A Simple State Machine using a Static class in C# to notify other subscribers via Events

I've been trying to write a simple Static-class State Machine for my application to notify other controls and code when the system state changes. And I think I almost have it, but I'm running into a small issue that I'm not sure how to work around. Here's the code: // An enum denoting the 3 States public enum Status { Error = -1, Work...

How do I make a new Moose class and instantiate an object of that class at runtime?

After creating a metaclass using Moose::Meta::Class->create, how do I instantiate a real Moose class with that class as a metaclass? (I need to create the metaclass also because I also want to apply some roles to it.) ...

FindBugs and CheckForNull on classes vs. interfaces

Is there any way to let FindBugs check and warn me if a CheckForNull annotation is present on the implementation of a method in a class, but not on the declaration of the method in the interface? import javax.annotation.CheckForNull; interface Foo { public String getBar(); } class FooImpl implements Foo { @CheckForNull @...

php classes exception handling question

There's an open book quiz for a job application I'm doing, and it's obviously highlighted a shortcoming in my php knowledge. Note, I'm not asking for the answer directly, I'm asking to be shown what I'm misunderstanding/lacking in how to answer it. The question is: 3. Finish the following class to print "Person->name has been zapped" ...

Django - ManyToOne relation to a child class

Hi! Is there a way to declare this case so that it works? I hope the code is self-explanatory. class A(Model): many_to_one = models.ForeignKey(B) (...) class B(A): (...) ...

Dynamically manage two jar files with the same package and class names

I have two jar files from a client, one of which is used for a testing and another for final versions. Currently I put them in different folders and modify the library path when deploying our code, but it would be nice to be able to load both jar files and switch between them dynamically at runtime. Is this possible? ...

Finding the PHP File (at run time) where a Class was Defined

Is there any reflection/introspection/magic in PHP that will let you find the PHP file where a particular class (or function) was defined? In other words, I have the name of a PHP class, or an instantiated object. I want to pass this to something (function, Reflection class, etc.) that would return the file system path where the class ...

C# class scanning

Hi all, In Java there are methods to go about scanning the classpath/all classes/within a package and enumerating the classes therein. e.g. spring component scanning uses something like this to scan all classes and find those with an interesting annotation. If there any similar technique for C# and if so what are the APIs to use? ...

Is there some trick to override a class dynamically in PHP?

I have two class named test in two different files,a.php and b.php for instance,the logic is like this: include('a.php'); $a = new test(); if($somcondition_is_met) { include('b.php'); $b = new test(); } Is there some trick to avoid Fatal error: Cannot redeclare class ? ...

Parent Object in php

Hi guys, is there a way to traverse an object to get the parent object data? With "parent object" I don't mean the parent class, but literally object. Here an example, in a javascripty world :-) : $parent->test = "hello world!"; $parent->child = new B(); It would be great If I could access all the data from parent in the child obje...