class

Access static class variable of parent class in Python

I have someting like this class A: __a = 0 def __init__(self): A.__a = A.__a + 1 def a(self): return A.__a class B(A): def __init__(self): # how can I access / modify A.__a here? A.__a = A.__a + 1 # does not work def a(self): return A.__a Can I access the __a class variable in B? It's possible writing a ...

How to initialize one class from a library?

Hi, I have a few classes in the class library (separate assembly). I referenced it to my project and I want to initialize one specific class from that library. I know only its name. All of the classes implements one interface. And here comes the problem. My code so far: using MyLibrary; ... IMyInterface dll = Activator.CreateInstance("...

Using PHP variables inside of here documents inside of functions inside of a class

If the title hasn't scared you away yet, read on. I'm working on an ExpressionEngine website and I'm editing the member templates file. All templates that relate to member interaction are stored as functions inside of a class in one single file. Each of these functions is a simple here document, but many of them print code with paths ...

String method crashes program...

Alright so i have two identical string methods... string CreateCust() { string nameArray[] ={"Tom","Timo","Sally","Kelly","Bob","Thomas","Samantha","Maria"}; int d = rand() % (8 - 1 + 1) + 1; string e = nameArray[d]; return e; } string CreateFood() { string nameArray[] = {"spagetti", "ChickenSoup", "...

exhausting all the questions in a xml database

i am developing an App,its like a test series,dere r two version FULL & LITE,for FULL total number of question in d xml database is around 300,& for LITE version its 20,so wen d test starts for lite version,each time a user starts a test,10 questions r being generated randomly one after d oder wid no repeatation,& for full version,its li...

Does anyone have any experience using berkeley db with PHP?

I have to access and write to some berkeley db files that other applications share. I really haven't found anything out there about using this with PHP. It really doesn't seem very popular. Does anyone have any links or resources that I might be able to use to get things rolling? Thanks! ...

WCF - Proxy Generated Classes & partial classes; Project/Assembly infrastructure

Is it a good idea to introduce an additional partial class for a svcutil generated proxy class at the service layer? I am looking for some insight and thoughts concerning a proposed project structure along with the utilization of partial classes in an attempt transform entities to support backward compatibility in our service endpoints ...

basic c# architecture and class handling question

Ok guys, this is very basic stuff I think. I'm only getting familiar with C# and object oriented languages. So here is a basic project I'm developping : namespace MyProject { class MyProject { public Logger Logs = new Logger(); public WebServer Web = new WebServer(); static void Main() { ...

Using object variables inside other classes

I have an object whose functions I would like to call from with in another class for example class smo { int spoon = 10; smo() { } int get_spoon() { return spoon; } } class boat { boat() { } print_smo(Object test) { test.get_spoon(); } } it tells me that the function get.spoo...

Separating application from app library, shared libary, components, etc

I am creating an MVC application framework, using only libararies and components that I create myself (mainly a learning experience), but I'm not quite sure how to separate each kind of library from one another. We'll call my application Cat. Lets say I'm creating a library called Dog, which would sort of be like Zend and is full of di...

What is the purpose of the intial function in a PHP class which has the same name as the class?

So I am getting started with OO PHP, and after reviewing a variety of classes which I have downloaded from the internet, I have noticed that some - but not all of these classes have an intial function with the same name e.g. class MyClass{ function MyClass{ //function contents in here } function otherfunction{ //more stuff here } ...

PHP : How to ensure script does not fail if method does not exist?

I have a PHP script which calls methods from a class I have written. However due to the nature of the system there are occasions where the method called does not exist e.g $snippets = new Snippets(); echo $snippets->fakeMethod(); in the above example fakeMethod() does not exist and the script fails with a fatal error and stops altoge...

Python virtual classes: doing it right ?

I have been reading documentation describing class inheritance, abstract base classes and even python interfaces. But nothing seams to be exactly what I want. Namely, a simple way of building virtual classes. When the virtual class gets called, I would like it to instantiate some more specific class based on what the parameters it is giv...

How to delete an instance of a class ?

So, I have this project that creates multiple instances of a class, and list them. At some point, the instanced class is not needed anymore. How can I flush it ? So far, it doesn't happen, even when the class has nothing to do anymore (if it had been a single static class, the program would have shut down), it's still in my list, and i...

Where to use "var' in javascript programs

Possible Duplicate: Difference between using var and not using var in JavaScript Hello, I am a self learned developer. Always, i write javascripts without the var for variables. But some javascripts use var for variables. Both worked well for me. I am bit confused by this. Is Writing scripts with var a standard form or the...

How to parse e-mail into database?

Hello. Still sometime I'm desperately searching for some community of developers which is dealing with the parsing of incoming email and storing its structure in the database. Quoting Mail2db developers: Different from traditional mail archive, the Mail2db engine can convert email into real database records stored within a RDM...

Class member calls function template with callback function

I'm having trouble passing a callback function from within a class, when calling a template function. Here's a sample code: sortedlist.h #ifndef _sortedlist_h #define _sortedlist_h #include <vector> template <typename ElemType> class SortedList { public: SortedList(int (*compare)(ElemType a, ElemType b)); ~SortedList(); ...

Is dynamic class loading possible in delphi

I have a environment and I want to know that if I write code in this environment is it possible to save>compile and use that code? whats is more is that I want the environment to be able to call function in this code and for the code to be able to call function in the environment.. I think there was something called class loaders in ja...

Java problems reloading code using ClassLoader

Hi again. I recently made a post http://stackoverflow.com/questions/3079280/update-java-code-during-runtime and after a few hours fiddling around with different example codes and reading tutorials I have run into the following problem: By using a ClassLoader I have been able to change a local variabe from Class MyVar1 to Class MyVar2 du...

How to prevent a method of a class to be called before the class is ready ?

Still exploring C# ... so bare with me please. Here is my custom "logger" class, which helps me create logs file in my project. namespace MyProject { class Logger { private FileInfo fFile; private DirectoryInfo dDir; /// <summary>Add a new entry to the log file.</summary> /// <param name="sData">The line to add.</param...