object

Can I set a property on an object that is only declared on the instance type, when I don't know the type?

Let me explain. I have a List into which I am adding various ASP.NET controls. I then wish to loop through the list and set a CssClass, however not every Control supports the property CssClass. What I would like to do is test if the underlying instance type supports the CssClass property and set it, but I'm not sure how to do the conver...

C++ Object, Member's Memory Position Offset

Is there a better method to establish the positional offset of an object's data member than the following? class object { int a; char b; int c; }; object * o = new object(); int offset = (unsigned char *)&(object->c) - (unsigned char *)o; delete o; ...

How to extra generic parameter after where statement?

I have an abstract class as follow: class BaseReturnType { } class DerivedReturnType : BaseReturnType { } abstract class BaseClass<T> where T : BaseReturnType { public abstract T PolymorphicMethod(); } class DerivedClass : BaseClass<DerivedReturnType> { public override DerivedReturnType Polymorp...

Accepted practice for converting an Object to and from a String in Java ?

What is the commonly accepted method for converting arbitrary objects to and from their String representations, assuming that the exact class of the object is known ? In other words, I need to implement some methods similar to the following: public interface Converter { /** * Convert this object to its String representation. ...

Error in the view page when I am doing updating the product

Hello All, I am getting an error when I am upadting the product ,the error is coming in the view page .it is "Object reference is not set to an instance of an object". Please tell me why is the error coming. category_id: <%= Html.TextBox("category_id", Model.category_id ) %> <%= Html.Val...

how to Intialize the object as a static only for one session

I am working with ASP.net 3.5 MVC application. I have one assembly which has ClassA. I have another assembly which creates the object of ClassA Now the question is , how to Intialize the object as a static only for one session. The object will be static across the session. New Instance of the object should be created only when new sess...

PHP5: const vs static

In PHP5, what is the difference between using const and static? When is each appropriate? And what role does public, protected and private play - if any. ...

Getting an instance name inside class __init__()

While building a new class object in python, I want to be able to create a default value based on the instance name of the class without passing in an extra argument. How can I accomplish this? Here's the basic pseudo-code I'm trying for: class SomeObject(): defined_name = u"" def __init__(self, def_name=None): if def_n...

Populating an Object from the DB -- Where do you stop?

When getting an object from the DB, should the object's properties also be loaded? There seems to be these approaches. Create well-formed, fully-loaded objects. Pro: No need to check if a property has been loaded; it has. Pass it around and don’t worry about parts of the object not being there. Con: Where do you stop? If an object h...

What is the difference between identity and equality in OOP?

What is the difference between identity and equality in OOP? ...

Sort collection of object in rails ?

I know I can use something like User.sort {|a, b| a.attribute <=> b.attribute} or User.find and order, but is it a way like comparable interface in Java, so every time I called sort on User object it will do sort on the predefined attributes. Thanks, ...

what is an abstract data type in object oriented programming?

What is an abstract data type in object oriented programming? I gone through wiki, but I didn't get cleared. Please make me clear. ...

what is meant by Business,System,Interface,Persistence classes?

what is meant by Business,System,Interface,Persistence classes? Explain me with some examples? ...

p2q_EmbedFlash using remotely hosted Flash files

I've embedded a virtual tour on one of my client sites. The site is hosted by Slicehost, and as you can see the load times for the Flash movies are very slow, so my idea was to serve the swf files from Amazon S3 Europe. To test it, I have all swfs uploaded to the same directory / bucket on Amazon, while the index.html and p2q_embed_ob...

Getting object as a result from func/proc in Delphi

What is the best practice for returning simple objects from functions / procedures in delphi? eg. 2 kinds of code: pass created object as reference, populate object in Proc, destroy it afterwards procedure Proc(var Obj: TMyObject); begin // populate Obj end; O := TMyObject.Create; try Proc(O); // manipulate populated object fin...

Convert Object to String iPhone SDK

Hello, I have got something strange: This Code does NOT Work: cell.imvstatus.image = [UIImage imageNamed:[[tutorials objectAtIndex:indexPath.row] objectForKey:@"image"] ]; This code works: cell.imvstatus.image = [UIImage imageNamed:@"ROR.png" ]; And in the object there is the value "ROR.png" Whats the problem at the above one? How c...

PHP function checking if you can create an object of a certain type?

It would take too long to explain why I need this, but I was wondering if there was a PHP function to check if a type of object was recognized. In other words, a function that would check if $dog = new Dog(); would cause an error, because Dog didn't exist. Thanks for you help. ...

Is <object> old fashioned?

Something like below,which is complicated to figure out what it exactly means: 9.<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="945" height="102"> 10. 11. <param name="movie" value="66.swf" /> 12. 13. <param...

C# - Not saving right in Array - why will it save the first one but not the rest?

This is a homework problem - so I would appreciate if you could tell me what I am doing wrong and how to fix it, resp. how to optimize my programing techniques :). Thanks! I built this to save the employee in the array - it will save the first one right but when it saves the others it shows up blank - right out of the constructor. Why...

Java: accessing transient object fields inside class

Accessing private transient object fields from any method in class must be controlled with some code. What is the best practice? private transient MyClass object = null; internal get method: private MyClass getObject() { if (object == null) object = new MyClass(); return object; } // use... getObject().someWhat(); o...