class

How to get properties Names from object parameter?

i write some utility class but how to get name ? Can that send parameter Name to Mehod not use object.Name? class AutoConfig_Control { public List<string> ls; public AutoConfig_Control(List<string> lv) { ls = lv; } public void Add(object t) { ...

Using an ActionListener in one class to start a timer in another class.

I have a class (simulation) which creates an instance of another class (GUI). Inside the class GUI there is a button (start) which has an actionlistener attached to it. I need this actionlistener to start a timer in simulation but I can't figure out how to do it. Code in Class Simulation: public class Simulation{ private static JFram...

Access an instance from Terminal

Can't figure this out. In Terminal, I import a module which instantiates a class, which I haven't figured out how to access. Of course, I can always instantiate in Terminal: Server=Data.ServerData() Then I can get a result: Server.Property().DefaultChart However, I want to skip that step getting the result directly from the insta...

Python classes special methods

Could someone please give me a complete list of those special methods that you can put in classes, e.g. a couple are __len__ and __add__, but what are the rest? Thanks. ...

template class, implementation code causing linking issues

I currently have a program where my main code is in a file main.cpp. Main.cpp includes a header file "class.h" that declares a class that is used within main.cpp. Also in main.cpp I have function declarations that declare the functions I use within main.cpp. The code for these functions is in a separate .cpp file fucntions.cpp. Like ma...

Using Backgroundworker in a class and generate events for client application

i have designed a class for posting data to server, which is a time consuming task so that i have used background worker in my application. instead of repeatedly using backgroundworker in my application, i decided to add it to my class and generate two events PostWorkerReportProgress, PostWorkerComplted for my application. how can i do t...

Naming convention for fields and accessors in C++

What naming convention should I follow for class members? Right now, I’m prefixing all fields with an underscore, and using the regular name for the accessor method, e.g.: int _age and int age() { return _age; } Any preferred approaches? ...

SubSonic - Class Library Project?

In the SubSonic docs it lists: o By default, the Tool generates insert and update code that uses System.Web.HttpContext.Current.User.Identity.Name and System.Threading.Thread.CurrentPrincipal.Identity.Name. Some generated methods may also make use of System.Web classes. If you don’t want to have to add a reference to System.Web in yo...

flash as3 - Can't have classes of the same name in different swfs?

Say I have 3 different swfs: dog.swf, cat.swf, mouse.swf, and each has their corresponding fla file. In the fla files I have movie clips like "head" and "tail", which are exported for Actionscript with names like Head and Tail, and each just contains an image. The problem comes when I have a main swf that loads and unloads these animal ...

One 'compressed' file of classes vs multiple class files in PHP

Is there any gain to combining all of the classes for a project into one massive 'compressed' file (spaces and comments removed) vs loading each class as they are required (other than all of the classes are there so you don't have to require/include them, isn't that what we have __autoload for?)? It seems to me that loading each class a...

Proper way for count empty variables

Hi, I use kohana and when you try to fetch data from database it returns class variables(like $user->firstname) as a database data. User table have a 12 columns and i fetch 8 columns but at this point some of columuns maybe empty(like $user->phone). How can i found empty column number ?(Proper way..) Thanks A Lot ...

How can I retrieve the class of an element using jQuery/javascript?

Hi, I have a bunch of inputs like this <input id="someId" type="button" class="SomeClass" onclick="determineClass(this.id, event)" /> From javascript I would like to get the class, it's different for each input. function determineClass(id, e) { var elementClass = //Somehow get the class here } It can be using jQuery or just pl...

How do you mix old-style and new-style Python classes?

I've seen a few questions on this topic, but I haven't been able to find a definitive answer. I would like to know the proper way to use old-style classes in a new Python code base. Let's say for example that I have two fixed classes, A and B. If I want to subclass A and B, and convert to new-style classes (A2 and B2), this works. Howe...

should I name all my abstract classes AbstractFoo

Is it good practice to make sure that all abstract classes have names prefixed with "Abstract"? ...

Make Javascript variable global w/ MooTools

I'm using mootools-1.2.3 at the moment and I'm having trouble getting a variable to be accessible outside of a function. I need to define the variable in the domready function, because otherwise the DOM hasn't been loaded and selector functions will not work (I can't place the script at the end of the HTML I don't have control of when t...

When would you want to nest classes in C#?

Specifically, can anyone give me concrete examples of when or when not to use nested classes? I've known about this feature since forever, but never had a reason to use it. Thanks. ...

Can I call a static method inside another method?

fundamental question: How can I call a static method inside another method. Please help!! public static class Class1 { public static string RenderCompareStatus() { bool isFound = Class1.Found(id); } private static bool Found(string id) { } //Error message: does not contain definition for Found ...

django class view with decorator and sessions

I'm trying to convert some of my django views over from function based views to class based views and I've run into a small problem. My OO is kind of weak and I think the problem is that I've lost track of where things are going. I have a custom login decorator that I need on the views so I have... First I have the View class from thi...

Cross referencing included headers in c++ program

Hello, I am curious about a scenario set up like the following example: Here is code that would be placed in a file called Header1.h: #ifndef HEADER1_H #define HEADER1_H #include "Header2.h" class Class1 { Class2 class2Instance; }; #endif Here is code that would be placed in a file called Header2.h: #ifndef HEADER2_H #define HE...

C++ Class or Struct compatiblity with C struct

Is it possible to write a C++ class or struct that is fully compatible with C struct. From compatibility I mean size of the object and memory locations of the variables. I know that its evil to use *(point*)&pnt or even (float*)&pnt (on a different case where variables are floats) but consider that its really required for the performance...