object

C#: Can an _object_ override a class' method?

Hi, I have a sample class: class SampleClass { public virtual string SomeProperty{get; set;} public virtual void SomeMethod() { // code } } I can Inherit from it and override SomeProperty and SomeMethod like this: class ChildClass:SampleClass { public override string SomeProperty{get; set;} public override void S...

Not object although var_dump() says otherwise?

Hello, I have a problem. When I create controller, I load model (AccountModel) to class variable "Model" and check if user is logged in: function __construct() { parent::__construct(); $this->loadModel("AccountModel", "Model"); $account = $this->getUserAccount(); ... } Fatal error occurs in getUserAccount(): ...

Read-only properties in C# 3.0 object initialization

If I have the following code: public class MyClass { public string myName { get; private set; } public string myId { get; set; } } A private compiler-generated variable is created for the setter. I want the setter not to be accessible for object initialization only. But, how do I get to initially set the myName variable? Rea...

how to upcast object array to another type of object array in C#?

I want to upcast object array to different array of different object type like below object[] objects; // assuming that it is non-empty CLassA[] newObjects = objects as ClassA[]; // assuming that object to ClassA is valid upcasting is there any way other than upcasting each element individually? ...

Java: Why can't I cast this to an Object?

This is bizarre... I thought every object in java had Object as an ancestor. I have a ClassA that extends my ClassB and implements Runnable. After creating ClassA I cannot cast it to an Object. Assume getClassA returns a ClassA instance. I am doing Object obj = getClassA(); I also tried Object obj = (Object) getClassA(); I get...

Hyperlink over embedded SVG

I have a page with an object tag that contains a SVG. Is there an easy method to make it clickable (in order to show a larger version in a popup when clicked)? ...

VBA point variable to range

Hi I want to point to a cell as a range in VBA. I've tried using: Dim range range = Sheet("sheet").Range("A1") But this just returns the value in the range. What I actually want is the range object so I can manipulate it, e.g. by setting range.Value = "Hello" Any ideas? ...

Insert Java Object In Sql Server

Hi! How Can I Insert/Retrive A Java Object Into/From Sql Server? THX ...

retrieve 2d array from an object and bind to GridView

Hey Guys, I have a function that returns a 2 dimensional array. Due to the nature of the program I MUST declare it as an object. Like this object o1 = function(x); //note the function returns something similar to this {string[x,y]}; ultimately I want to bind this data to a GridView. If the array is one dimensional...the followi...

Send java object to a rest WebService

Hi, I'm searching a nice way to send a java object to my rest web service. It's possible or not ? For sample I wan't to send an "User" Object to my rest : public Class User{ private String name; private String surname; public getName(){ return name; } public setName(String name){ [...] } It's possi...

Find out if a method exists in a static class.

I want to check is a function exists in a library that I am creating, which is static. I've seen function and method_exists, but haven't found a way that allows me to call them in a relative context. Here is a better example: class myClass{ function test1() { if(method_exists("myClass", "test1")) { echo "Hi"; ...

Why is reassigning Object.prototype not working?

Why this is not working? // this one works as I expected, when objSayHello() Object.prototype.objSayHello = function(){alert('Hello,from OBJECT prototype')}; // NOT working ! Object.prototype ={objSayHello: function(){alert('Hello,from OBJECT prototype')}}; objSayHello(); ...

Python object creation

Hello, I am pretty new to Python world and trying to learn it. This is what I am trying to achieve: I want to create a Car class, its constructor checks for the input to set the object carName as the input. I try to do this by using the java logic but I seem to fail :) class Car(): carName = "" #how can I define a non assigned vari...

c# loop fails when adding object to list!

hey, this i have a loop that adds gathered strings and ints into an object, and then adds that object into a list. I need it to check if there is already an object with a property == to the one i'm about to assign, and then depending on which the property is, I either want to change one of its properties, or still add a new object. I'll ...

.NET Secure Memory Structures

I know the .NET library offers a way of storing a string in a protected/secure manner = SecureString. My question is, if I would like to store a byte array, what would be the best, most secure container to hold this? ...

c# call object by unique property

I have a class Referrals. When you create an object in the class, it checks that the input strings are unique (and therefore never allows duplicate objects). But when I find that input string str1 is equal to that of a previously created object, instead of creating a new object or just returning false, i want to change a property of the ...

Assign a type to an object at runtime in vb.net or c#

I have an object, o, and a type, T. I'd like to use reflection to change object o to type T at runtime without instantiating it. The equivalent at compile time would be: Dim p as Point = Nothing I know how to use Activator.CreateInstance to create an instance at run time that is equivalent to: Dim p as New Point() But i don't want...

R object identification

I am often ending up with a function producing output for which I don't understand the output data type. I'm expecting a list and it ends up being a list of lists or a data frame or something else. What's a good method or workflow for figuring out the output data type when first using a function? ...

F#: I cannot return unit in a do clause and still have side effects

I'm writing a simple ini file parser and I'm having a little problem with the initialization of the object in the "do" clause. It wants me to return a unit but i can't get the blankity function to do the side effects if I try to pipe into an "ignore" or if i return "()" directly. This code works as a separate function because I can igno...

How can I make a custom exception object evaluate to false in an if condition?

Hey there SO, I was just wondering if there was any way to make my object return false if placed in an if statement. The reason is I'm making a custom exception class. I would like to be able to do something along the lines of class Dog{ public function lookAround() { if(seeDog()) { return bark; ...