class

Display lookup value based on foreign-key in bindingsource

Hi All, I am looking for "best-practices" to display the value of foreign-key in a BindingSource. Sample data: PetID---PetName---PetTypeID 1---Tom---1 2---Jerry---2 PetTypeID---PetType 1---Cat 2---Mouse I have a Pet class and Pet form. The following code is on the Pet form to return data from the database as a Pet collection and ...

Fatal error: Call to undefined method stdClass

I get an error that says Fatal error: Call to undefined method stdClass::mysql_con() in ........../.../includes/script/import.php on line 68. Line 68 corresponds to: if(!$ip2c->mysql_con()) I do have a require_once() statement at the beginning of my script What could be the problem here? Thanks ...

What's the ampersand for when used after class name like ostream& operator <<(...)?

I know about all about pointers and the ampersand means "address of" but what's it mean in this situation? Also, when overloading operators, why is it common declare the parameters with const? ...

something i missed here, style in PHP table row works partly!

no border shows up when setting style in the table row below, inside the while loop? why? Background color setting works fine, but not this... NO BORDER SHOWS UP... // Build Result String $display_table = "<table>"; while($row = mysql_fetch_array($qry_result)){ $display_table .= "<tr style='border-top-width: thin; border-top-style:...

Preempting __del__ hmmm

Hi SO's I need to preempt __del__ and I want to know what is the right way to do this. Basically my question in code is this.. class A: def __init__(self): self.log = logging.getLogger() self.log.debug("In init") self.closed = False def close(self): self.log.debug("Doing some magic") se...

Templates for AS3 (like c++)

How do I define C++-like templates in AS3?; I have a map class (2d array) that I want to re-use across projects but the cell data is a different class depending on the project or implementation; There are a bunch of other reasons regarding sharing code accross different implementations, but I'd hope for somthing like: map = new MyMap<M...

C# - To use Partial Classes, or Seperate Ones?

Which way is best practice and the best programming approach, Partial Classes or Individual classes? ...

How to point to CSS default class using the class attribute

Is there a way to point to the default CSS class of an object? For example, depending if a user is logged in I want to specify a different CSS class to control the style of a header. $css_class = ""; if($logged_in) $css_class = "success" echo "[h1 class=".$css_class."] My Title [/h1]" If the user is logged in, the css class is ...

php5 extend main class and use statics

why I can't do like this? <?php class core { public static $db; function __construct() { $this->db = new mysql('host', 'user', 'pw', 'db'); } } class stat extends core { public static function log() { core::$db->query("insert into mytable values(now())"); } } // do something stat::log(); ?> ...

Call pure virtual function from parent class

Hello, I'm very new to c++, but I think I understand what is going on. The parent class is trying to call the pure virtual member function in the parent class. I thought that by overriding the virtual function in the child class, it would be called instead. What am I doing wrong? Provided for me in parent.h class Parent { public:...

Should I refactor static nested classes in Java into separate classes?

I have inherited code which contains static nested classes as: public class Foo { // Foo fields and functions // ... private static class SGroup { private static Map<Integer, SGroup> idMap = new HashMap<Integer, SGroup>(); public SGroup(int id, String type) { // ... } } } From reading SO (e.g. http://...

Does C# have an equivalent of Java static nested class?

I am converting Java into C# and have the following code (see discussion in Java Context about its use). One approach might be to create a separate file/class but is there a C# idom which preserves the intention in the Java code? public class Foo { // Foo fields and functions // ... private static class SGroup { ...

Complexity class

Assume that methods m1 and m2 are static void and compute the same result by processing an argument of type Object[]. Empirically we find that m1 -> T(N) = 100N and m2 -> T(N) = 10Nlog2N where the times are in microseconds. For what size inputs is it better to use m1 and m2? So I would use m1 for big numbers while I would use m2 for sma...

ASP.NET Application - Architecture and Class Diagrams

Hi, I am new to ASP.NET Development. Could anyone please refer a document/tutorial/link which gives a sample code, architecture, class and sequence diagrams for 3 / 4 / n tier based simple ASP.NET application/example? It would be of great help to me. Many Thanks, Regards. Aarti. ...

is it allowed to create a php class inside another class

Hello, I was wondering if it is allowed to create a class inside another class. It's actually the database class or, do I have to create it outside and then pass it in threw the constructor? but then I have created it without knowing if I would need it example: class some{ if(.....){ include SITE_ROOT . 'applicatie/' . 'db.class.p...

some kind off variable problem within php class

Hello, I have this in my class When the second function is called php errors with wrong datatype and only variables can be past by reference. I don't know what they mean by that This code comes from php.net If the same code is outside the class it executes fine What am I doing wrong here, if I am working within a class? $extensiesA...

Wrapping C++ class API for C consumption

Hi there, I have a set of related C++ classes which must be wrapped and exported from a DLL in such a way that it can be easily consumed by C / FFI libraries. I'm looking for some "best practices" for doing this. For example, how to create and free objects, how to handle base classes, alternative solutions, etc... Some basic guidelines...

What term is used to describe when two classes depend on each other?

I've got the following two classes in C#: public class MyFirstClass : IMyFirstClass { MySecondClass mySecondClass; public MyFirstClass(IMySecondClass mySecondClass) { this.mySecondClass = mySecondClass; } public MyFirstClass() : this(new MySecondClass()){} } public class MySecondClass : IMySecondClass { ...

C# / .NET : when structures are better than classes?

Duplicate of: When to use struct in C#? Are there practical reasons to use structures instead of some classes in Microsoft .NET 2.0/3.5 ? "What is the difference between structures and classes?" - this is probably the most popular question on intrviews for ".NET developer" vacancies. The only answer that interviewer considers to be rig...

PHP runtime class modification

So I want to be able to add/remove class methods at runtime. Before you tell me that's horrible pratice in oop, it might be, but I don't really care. The reason I want to be able to do this is because I want the application to be very modular, so some plugin could extend some base class and add methods to it without killing the the main ...