What would be some highly recommended books to get for a mid-level developer to learn advanced ASP.NET/C#/VB.NET techniques? Including, but not limited to, taking advantage of inheritance, when to use base pages, overriding base class methods, application architecture, interfaces, applying GOF design patterns in Web Applications, DAL, an...
I have an application which supports multiple types and versions of some devices. It can connect to these devices and retrieve various information.
Depending on the type of the device, I have (among other things) a class which can contain various properties. Some properties are common to all devices, some are unique to a particular devi...
We have a class Car defined like this in a car.rb file
class Car
end
then, we have another class Car defined in electric/car.rb
require "../car.rb"
module Electric
class Car < Car
end
end
Unfortunately, it seems that we can't inherit from the first class. Why is that?
...
Suppose I have the following types of data:
class Customer {
String id; // unique
OtherCustData someOtherData;
}
class Service {
String url; // unique
OtherServiceData someOtherData;
}
class LastConnection {
Date date;
OtherConnData someOtherData; // like request or response
}
Now I need to remember when each of the cust...
Here is a class that I used to have
class Something
# Defines the validates class methods, which is called upon instantiation
include Module
validates :name
validates :date
end
I now have several objects that are using the same functionalities, and worse, several object that are defining similar things, like this:
c...
This question has been asked in a C++ context but I'm curious about Java. The concerns about virtual methods don't apply (I think), but if you have this situation:
abstract class Pet
{
private String name;
public Pet setName(String name) { this.name = name; return this; }
}
class Cat extends Pet
{
public Cat catchMi...
Hi,
I am trying to create a general class, in which all my ASP.Net pages inherit from so I can share functions across multiple pages.
To do this I would create a new class which inherits from System.Web.UI.Page (the content pages need to inherit this), and then my content pages would inherit the newly create class.
My problem is that ...
Hi,
Is there a way to make a variable non-inheritable in python? Like in the following example: B is a subclass of A, but I want it to have its own SIZE value.
Could I get an Error to be raised (on __init__ or on getsize()) if B doesn't override SIZE?
class A:
SIZE = 5
def getsize(self): return self.SIZE
class B(A): pass
Edit...
In my quest to transition from a decade of C++ to Ruby, I find myself second guessing how to accomplish the simplest things. Given the classic shape derivation example below, I'm wondering if this is "The Ruby Way". While I believe there's nothing inherently wrong with the code below, I'm left feeling that I'm not harnessing the full p...
I am using multiple asynchronous air.URLLoader objects, and would like the events fired to be aware of the urlloader's "myId".
The objects i am downloading have ids per se, so i'd like to know in my event listener callback function from which download id the progress/finished/error event came.
code:
# loader
addonLoader = new air.URLLo...
Hello,
In Python, I would like to construct an instance of the Child's class directly from an instance of the Parent class. For example:
A = Parent(x, y, z)
B = Child(A)
This is a hack that I thought might work:
class Parent(object):
def __init__(self, x, y, z):
print "INITILIZING PARENT"
self.x = x
sel...
Let's say I have a model class called Project, but instead of this:
class Project < ActiveRecord::Base
I wanted to write this:
class Project < ORM
so that the specific ORM implementation is not present in my model class.
How would I need to write my ORM class so that the Project class above is able to act as a subclass of ActiveRe...
Now that Google App Engine natively supports Django 1.0, I updated with the following code:
from google.appengine.dist import use_library
use_library('django', '1.0')
I am now getting template errors relating to template inheritance.
For instance, if I have:
{% extends "../base.html" %}
Referring to a base.html in the parent direct...
Hi,
Currently I have the following classes:
class Article with properties id, title and body
class Question : Article with an extra PostedBy property
Then I have a table called Article with the above properties and a table called questions with an ID a foreign key articleID and a PostedBy. Both are in different schemas
I would like t...
I have an IRepository interface that inherits from IRepository<TObject>. I also have a SqlRepository class that inherits from SQLRepository<TObject>, which in turn implements IRepository<TObject>. Why can't I instantiate a instance of SqlRepository as an IRepository?
public class MyObject : IObject {
...
}
public interface IReposit...
I want to implement a function in the base class but I also want it to be overridden in the derived classes everytime. So it is more like "abstract function but with a body".
What am I looking for? Am I looking for the right thing?
...
Can anyone tell me how i can limit the choices for the Page model which i inherit from in the following code?
class CaseStudy(Page):
"""
An entry in a fancy picture flow widget for a case study page
"""
image = models.ForeignKey(Image, limit_choices_to={'is_active': True, 'category__code':'RP'})
def __unicode__(se...
I'm trying to override Object::Equals in C++ .NET but I'm running into some difficulties
virtual bool IState::Equals(Object^ o) override{
if (o->GetType() == IState::typeid){
IState^ s = (IState^) o;
if (s->type == this->type &&
s->target_state == this->target_state &&
s->current_state == this->current_sta...
I got a Base superclass and a bunch of derived classes, like Base::Number, Base::Color. I'd like to be able to use those child classes as if I they inherited from say Fixnum in the case of Number.
What's the best way to do this, while still having them respond appropriately to is_a? Base ?
So, I should be able to do
Number.new(5) + N...
So I understand you aren't supposed to to directly subclass Fixnum, Float or Integer, as they don't have a #new method. Using DelegateClass seems to work though, but is it the best way? Anyone know what the reason behind these classes not having #new is?
I need a class which behaves like a Fixnum, but has some extra methods, and I'd lik...