inheritance

How do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory

How do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory in code.py production=True if not production: try:web.render('mafbase.tmpl', None, True, 'mafbase') except:pass else: from templates import mafbase in templates/mafbase.tmpl and templates/mafbase.py try:web.r...

how to override the verbose name of a superclass model field in django

Let's say that I have a model Foo that inherits from SuperFoo: class SuperFoo(models.Model): name = models.CharField('name of SuperFoo instance', max_length=50) ... class Foo(SuperFoo): ... # do something that changes verbose_name of name field of SuperFoo In class Foo, I'd like to override the verbose_name of the name fi...

How to find what class(es) implements an interface (.Net)

The closest I could find to this question was this one: http://stackoverflow.com/questions/26733/getting-all-types-that-implement-an-interface-with-c-3-5 But that is for use in code, and to use it I'd have to change the code, recompile and run. I was wondering if there is a simpler way for me to just lookup all classes that implement a ...

Python Class Inheritance issue

I'm playing with Python Class inheritance and ran into a problem where the inherited __init__ is not being executed if called from the sub-class (code below) the result I get from Active Python is: >>> start Tom Sneed Sue Ann Traceback (most recent call last): File "C:\Python26\Lib\site-packages\pythonwin\pywin\framework\scriptutils...

RoR table inheritance?

Scenario: I have a users table in my application. I also have two subclasses of users, lets say contributors and viewers. Each user group must have an entirely different set of attributes but they both share certain user properties (login, password, name). What is the best way to implement this using Ruby on Rails? I think single ta...

Does Java have an "is kind of class" test method

I have a baseclass, Statement, which several other classes inherit from, named IfStatement, WhereStatement, etc... What is the best way to perform a test in an if statement to determine which sort of Statement class an instance is derived from? ...

Entity Framework inheritance: TPT, TPH or none?

Hi, I am currently reading about the possibility about using inheritance with Entity Framework. Sometimes I use a approch to type data records and I am not sure if I would use TPT or TPH or none... For example... I have a ecommerce shop which adds shipping, billing, and delivery address I have a address table: RecordID AddressTypeID...

Abstract vs Normal class inheritance performance

When you derive from a class and instance the subclass, the runtime also instances the super class, right? Since abstract classes can't be instanced, are they not created by the runtime when a subclass is instanced? If so, then abstract class inheritance would be faster than normal class instance? ...

javascript inheritance

I know there is a lot of similar questions are tons of great answers to this. I tried to look at the classical inheritance methods, or those closure methods etc. Somehow I consider they are more or less "hack" methods to me, as it doesn't really what the javascript is designed to do. (Welcome anybody correct me if I am wrong). OK, as lon...

VncSharp inheritance question...

Hi, I have been working on a project involving the .NET VNC Client VncSharp (VncSharp Website). When inheriting from the RemoteDesktop object, when I call the new object I get the exception... Value of 'null' is not valid for 'stream'. Even code as simple as below throws the exception... public class VncObject : RemoteDesktop { ...

NHibernate inheritance and split table

i have a table stracture which lends itself to table per subclass design. my "base" table has many common fields and each one of the children also has many fields that are unique for that entity. this works very well with joined-sublass where the common fields are added to the child entities through inheritance. the base is linked to the...

Postgres: Table inheritance: Enforcing unique constraints across partitions?

I have a table that I would like to partition, but I don't know how to deal with the uniqueness constraints. Is it possible to create a unique constraint across multiple child tables? ...

How to reuse the same variable, but for diferent types?

Hi guys, I have a little problems understand what's going on behind the scenes of the "type T" to get this right, I'm hopping that some of you can show me a light at the end of the tunnel :) I have a COM object that I assign almost the some things (properties) but I need to use this for all objects, and I want to do this once and only ...

Django model inheritance w/ custom inclusion_tags

I'm gonna try and simplify this as much as possible. Lets say i have the following: models.py class Person(models.Model): name = models.CharField(max_length=255) def getRealPerson(self): # is there a better way to do this? ret = None try: ret = self.worker except: try: ...

Single Table Inheritance routing?

I have single table inheritance working just fine for my app. I have two user subtypes (Athlete and Company) that inherit the super-type User. Let's say I am listing all users, and want a link to each user's profile from this list. I want to link to the athletes controller if the type is athlete and the companies controller if the type...

Entity Framework: Inheritance and Include

Assume the following hierarchy: class Department { EntityCollection<Employee> Employees; } class Employee { string Name; } class RemoteEmployee : Employee { Country Location; EntityReference<Country> CountryReference; } So, department contains a list of employees. There is a hierarchy of employee types, some types reference other e...

C# How do you use foreach on a base class using generics?

This question is as a result of trying Jon Skeet's answer to this question. So I have the following code based in the question and answer from the above question link. public abstract class DeliveryStrategy { } public class ParcelDelivery : DeliveryStrategy { } public class ShippingContainer : DeliveryStrategy { } public abstract cla...

Passing and processing List<> types containing objects of the same base type.

Consider the following classes: class TypeA; class TypeB : TypeA; class TypeC : TypeA; class TypeD : TypeA; and the following List<> types: List<TypeB> listTypeB; List<TypeC> listTypeC; List<TypeD> listTypeD; Now TypeA has a property Prop1 of type Object1 and I want to locate which list has stored within it an item with Prop1 of a ...

Rails Inheritance with relationships problem.

I am using single table inheritance in my project. Instead of explaining more, I'll give the code: # person_profile.rb class PersonProfile < ActiveRecord::Base belongs_to :Person end # company_profile.rb class CompanyProfile < ActiveRecord::Base belongs_to :Company end # person.rb class Person < User has_one :PersonProfile end ...

Forbidding access to Inherited winform controls

Hi! I am writing a BaseForm to be inherited. The BaseForm has some basic standard controls of my application. The problem is: I want allow inherited forms to use and change this controls, but not remove they from the form. The biggest problem is a TabControl which Tabs must be added by users Inherited Forms. If I set "Modifiers" prope...