class

How do i take two dict like class and wrap them together?

I want to take HttpContext.Current.Request and HttpContext.Current.Session and wrap them together into one class. Basically i want to write col["key"]; and have it check one of these for the key and if it doesnt exist to check the other. AFAIK they don't share an interface (i looked around using "Go To Definition" but i am pretty bad)....

Architecture advice for a website.

I'm looking for a bit of advice with regards to the structure of an application I'm tasked with. I need to have a series of webforms to store some data, most of the data is the same but each form would have some differeing data depending on the form used. Would a base class then a series of classes inheriting from this for the specific...

In a large Application is there any way to distinguish user-defined classes with built-in classes?

Hi. In a large Application is there any way to distinguish user-defined classes with built-in classes without checking ? ...

Page generation from PHP class

I'm actually creating websites for fun and some of my friends told me that I could be more efficient if I could create the output of the page with a php class that would represent the whole page. I was wondering how you people would do it. Thanks ...

Decorator to mark a method to be executed no more than once even if called several times

I will go straight to the example: class Foo: @execonce def initialize(self): print 'Called' >>> f1 = Foo() >>> f1.initialize() Called >>> f1.initialize() >>> f2 = Foo() >>> f2.initialize() Called >>> f2.initialize() >>> I tried to define execonce but could not write one that works with methods. PS: I cannot define the code ...

is this possible in C++?

to create an instance of another class from a class even if the class I want to have an instance of is declared next of the class I am creating an instance from. Just like in C# and Java. Thank you ...

Multiple Python classes in a single file

Possible Duplicate: How many Python classes should I put in one file? Coming from a C++ background I've grown accustomed to organizing my classes such that, for the most part, there's a 1:1 ratio between classes and files. By making it so that a single file contains a single class I find the code more navigable. As I introduce...

Is the T class in generic Class<T> assignable from another class?

Edit Since there were many downvotes and people who didn't understand what I'm asking for, I'll rephrase: How do I find out at runtime what is the class that foo was generified from? public boolean doesClassImplementList(Class<?> genericClass) { // help me fill this in // this method should return true if genericClass implements Li...

How to declare static variables in Delphi 2009?

Hello, I googled,I binged,I already have seen the other "duplicates" here,but none of them work in Delphi 2009 updated up to update 4. Like in C#,I want to make a static variable in on line or as short as possible.In the end it works like a global variable,but its sorted. What's the shortest way to do this in delphi 2009? EDIT I fol...

C++: instantiate class from name?

Hi, imagine I have a bunch of C++ related classes (all extending the same base class and providing the same constructor) that I declared in a common header file (which I include), and their implementations in some other files (which I compile and link statically as part of the build of my program). I would like to be able to instantia...

I need to collect an array of classes to call their static variables in php

First thing i want to say that it's not an easy question to explain, so please be patient if it seems confusing. I have a set of classes like this class Product { public static $static_type = 'product'; public static $static_table = 'product_table'; public function __construct($params) { //do some } } and then there are t...

Forward "Pre-declaring" a Class in C++

Hi all! I have a situaion in which I want to declare a class member function returning a type that depends on the class itself. Let me give you an example: class Substring { private: string the_substring_; public: // (...) static SubstringTree getAllSubstring(string main_string, int min_size); }; And Su...

PHP classes error

Hello. I have three files: one called sql.php witch has a class db that I use to ease the get results operation from MySQL; one called session.class.php that has class session (extending class db) witch I use to make my basic operations as functions... like check_login function witch I use to check if user is logged in; and another one c...

Should PHP use objects as basic data types?

I recently had an idea to create my own String class to make using PHP's functions easier. Instead of strlen($str) I write $str->length(). Makes it easier to remember parameter orders in certain functions, like substr. I ran some timing scripts on it and found that it's about 5 times slower than using the regular functions. I haven't te...

AS3: streamlining a 'universal loader'

In Flash Actionscript 3, when you need to load text, you use a class called 'URLLoader', and when you need to load an image (or .swf) you use a class called 'Loader.' As far as I know, loading a .bmp with URLLoader is as useless as loading an .xml into a Loader - it doesn't compute. I'm making a class that handles a queue of external as...

ruby alternative to class << thing

Hi there, I want to rewrite several methods of HighLine to customise my console and at the moment my code looks like this: cmd = ask("#{@prompt_label} #{@prompt_separator} ", @tab_completion_candidates) do |q| q.readline = true # rewriting the Question class to make it do what we want class ...

new version for the classes I've use in my application

Hi there 2 months ago I was writing a web-application which use some classes to draw some charts. I've modified little those classes in order to fit with my needs. Now I wish to use a new(and official) version of that class, but also to have my modifications available. The problem is that I don't remember exactly all the modification ...

Assigning string to class redirects it to property

I have a class named Car with property Name. Now every time I like to change Name of my Car I must write Car1.Name = "Porka Turbo". Now what I would like to acomplish is 5 characters less to write like this: Car1 = "Porka Turbo" It should work like this: if I assign a class derrived from Car class it should make regular class assignme...

Can I use generics to populate List(of t) with custom classes?

I have several different lists I want to call. They all have the same format for the class: id, value, description, order. Instead of creating a bunch a classes to return the all of the many lists, I wanted to use generics and just TELL it what kind of list to return. However, I can not figure out how to populate the classes. Here are 2...

Hide a base class method from derived class, but still visible outside of assembly

This is a question about tidyness. The project is already working, I'm satisfied with the design but I have a couple of loose ends that I'd like to tie up. My project has a plugin architecture. The main body of the program dispatches work to the plugins that each reside in their own AppDomain. The plugins are described with an interfa...