class

PHP UML Class diagrams plugin for eclipse?

I've searched but the questions so far seem to be Java/C# orientated. I was wondering if there was a class diagram GUI for eclipse - or it could be standalone - that better describe PHP classes? It seems that the ones i've used so far assume you are writing for Java or C#. Cheers for any pointers ...

Any good class diagram editors out there for Java (not UML)

I'm looking for an editor that can create class diagrams, similar to the typical UML class diagram, but specifically for java (so using java terminology; instead of terms like "generalization, realization etc", we use the java equivalents "interface, abstract class, extends etc"). I've looked into UML several times, but each time I've be...

add a decorate function to a class

I have a decorated function (simplified version): class Memoize: def __init__(self, function): self.function = function self.memoized = {} def __call__(self, *args, **kwds): hash = args try: return self.memoized[hash] except KeyError: self.memoized[hash] = self.func...

How to make sql query dynamic?

Hello, I am using this pagination class and was looking for a way to make the sql query more dynamic instead of having it hardcoded. I have a 3 <li> elements that I want to be filter buttons, meaning when a user clicks on one of these elements I want It to send the id so I can use it in a sql query. So for the $sql = "select * from ex...

Cannot access Class methods from previous windows form - C#

I am writing an app, still, where I need to test some devices every minute for 30 minutes. It made sense to use a timer set to kick off every 60 secs and do whats required in the event handler. However, I need the app to wait for the 30 mins until I have finished with the timer since the following code alters the state of the devices I ...

Superfluous python parameters

I've noticed a discrepancy in the way that python parameters are called. In every other language I've dealt with, you either have foo() meaning either no parameters, or as many parameters as you like, or foo(arg1, arg2,...,argn) where you pass in the same number of parameters to define the function and call it. In python howev...

How can I declare classes that refer to each other?

It's been a long time since I've done C++ and I'm running into some trouble with classes referencing each other. Right now I have something like: a.h class a { public: a(); bool skeletonfunc(b temp); }; b.h class b { public: b(); bool skeletonfunc(a temp); }; Since each one needs a reference to the other, I've...

Declaring an enum within a class

In the following code snippet, the Color enum is declared within the Car class in order to limit the scope of the enum and to try not to "pollute" the global namespace. class Car { public: enum Color { RED, BLUE, WHITE }; void SetColor( Car::Color color ) { _color = color; } Car::Color Get...

Python class design - Splitting up big classes into multiple ones to group functionality

OK I've got 2 really big classes > 1k lines each that I currently have split up into multiple ones. They then get recombined using multiple inheritance. Now I'm wondering, if there is any cleaner/better more pythonic way of doing this. Completely factoring them out would result in endless amounts of self.otherself.do_something calls, whi...

call method in a subclass of UIView

Hey, I've got a UIViewController and an own class, a subclass of UIView. In my ViewController I make a instance of the uiview. If I tap the uiview a function gets called within it and an overlay appears. TO get rid of that overlay later the user has to tap somewhere on the screen(besides the instance of my class) How do I tell my clas...

Calling function using 'new' is less expensive than without it?

Given this very familiar model of prototypal construction: function Rectangle(w,h) { this.width = w; this.height = h; } Rectangle.prototype.area = function() { return this.width * this.height; }; Can anyone explain why calling new Rectangle(2,3) is consistently 10x FASTER than calling Rectangle(2,3) without the 'new' keyw...

[Using $this when not in object context in] php error

I have solved this problem, I just need to know what to do. I get the above error because I just realised that the class is being run as class::function($values) instead of class->function($values). Does anyone know how to convert this function to instantiate the class then run the function with values? private function _load($values=n...

Trying to get sql query to be dynamic with jquery

Hello, I am trying to create a dynamic sql query, in which the users clicks a button(link) and the id of that link is sent to the sql query. I would like to accomplish this using jquery. But, being very new to both jquery and PHP, I am finding it very difficult to get this to work properly. Firstly, I should mention that I am using this...

Java Generics: set List of superclass using List of subclass

If I have a method in MyClass such as setSuperClassList(List<Superclass>) ...should I be able to do this: new MyClass().setSuperClassList(new ArrayList<Subclass>()) It appears this won't compile. Why? ...

Clear all class variables between instances

This is probably a stupid question, but what's the best way to clear class variables between instances? I know I could reset each variable individually in the constructor; but is there a way to do this in bulk? Or am I doing something totally wrong that requires a different approach? Thanks for helping ... class User(): def _...

Expected ')' before '*' token

So this is more of a syntax problem. I keep getting the error "Expected ')' before '*' token" on the line: #include "CDocumentObserver.h" #include "CViewPlayerDlg.h" /* * Class: CViewPlayer * */ class CViewPlayer : public wxWindow, public CDocumentObserver { public: CViewPlayer(CViewPlayerDlg *dlg); //here ...

Defining a variable in a class and using it in functions

I am trying to learn PHP classes so I can begin coding more OOP projects. To help me learn I am building a class that uses the Rapidshare API. Here's my class: <?php class RS { public $baseUrl = 'http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub='; function apiCall($params) { echo $baseUrl; } } ?> $params will...

In what scenario would one need to use PHPs magic function toString()

Why would a programmer need to use the function? How would the same results have been achieved in php 4? ...

AS3 - Can I know if a class implements an interface (or is a subclass of another class) ?

With this code function someFunction(classParam:Class):Boolean { // how to know if classParam implements some interface? } i.e. Comparing classParam with IEventDispatcher interface: someFunction(EventDispatcher) // returns true someFunction(Object) // returns false I know it can't be done with is operator. But, is there a way ...

How do I enumerate a list of interfaces that are directly defined on an inheriting class?

Updated question given Andrew Hare's correct answer: Given the following C# classes: public class Bar : Foo, IDisposable { // implementation of Bar and IDisposable } public class Foo : IEnumerable<int> { // implementation of Foo and all its inherited interfaces } I want a method like the following that doesn't fail on the as...