objects

How to set array length in c# dynamically

I am still new to C# and I've been struggling with various issues on arrays. I've got an array of metadata objects (name value pairs) and I would like to know how to create only the number of "InputProperty" objects that I truly need. In this loop I've arbitrarily set the number of elements to 20 and I try to bail out when the entry beco...

Objective C class definition confusion

I'm learning Objective-C through Cocoa (And loving it). I'm following a tutorial. Theres a class called Menu and the interface looks something like this. @interface Menu: MenuObject {} @end @interface MenuLayer : LayerObject {} -(void) someMethod:(id)sender -(void) someOtherMethod:(id)sender @end and the implementations follow the s...

Is it possible to create a class that represents another type in Python, when directly referenced?

So if I have a class like: CustomVal I want to be able to represent a literal value, so like setting it in the constructor: val = CustomVal ( 5 ) val.SomeDefaultIntMethod Basically I want the CustomVal to represent whatever is specified in the constructor. I am not talking about custom methods that know how to deal with CustomVal...

Newbie at XNA, general questions.

As the title points out, I'm relatively new at XNA. However, I've been given a trivial assignment by my boss to see if I can get it done. I have no doubt that I eventually will, but some pointers in the right direction would help. This isn't a homework assignment, and I'm just looking for a couple of tips and pointers so I don't have to...

objects and strings

Hello, I was trying to return a set of objects. But this code gives me the following error: Catchable fatal error: Object of class User could not be converted to string in ... public function fetchObject($psClassname ="",$paParams =array()){ $lrResource = $this->mrQueryResource; $liResult = null; while...

c# object equality for database persistance

I want to learn how others cope with the following scenario. This is not homework or an assignment of any kind. The example classes have been created to better illustrate my question however it does reflect a real life scenario which we would like feedback on. We retrieve all data from the database and place it into an object. A object...

rules with temporary objects and args by reference

say I have a class: class A { public: A() {} }; and a function: void x(const A & s) {} and I do: x(A()); could someone please explain to me the rules regarding passing temporary objects by reference? In terms of what the compiler allows, where you need const, if an implicit copy happens, etc. From playing around, it seems like...

How to access form objects from another cs file in C#

Hello, In the form.cs file I have two buttons,a memo and a timer.My question is: How do I access the timer or the memo from another cs file? I've tried to make the objects public,but it didn't work,please give me a source or a project,so I can see where I'm mistaken. Thanks! ...

Does Linq and projects like i4o make object oriented DBs a viable alternateive to relational DBs?

Given Linq and technologies like i4o is there any real reason why an object oriented database management system won't be a viable alternative to a relational database management system for new projects starting in the next 3 to 5 years? ...

How can I detect recursing package calls in Perl?

I have a Perl project were I just had a problem by making a circular package call. The code below demonstrates the problem. When this is executed, each package will call the other until all of the memory of the computer is consumed and it locks up. I agree that this is a bad design and that circular calls like this should not be mad...

Deleting Objects in JavaScript

I'm a bit confused with JavaScript's delete operator. Take the following piece of code: var obj = { helloText: "Hello World!" }; var foo = obj; delete obj; After this piece of code has been executed, obj is null, but foo still refers to an object exactly like obj. I'm guessing this object is the same object that foo pointed to. ...

How can I simply return objects in PDO?

Trying out PDO for the first time. $dbh = new PDO("mysql:host=$hostname;dbname=animals", $username, $password); $stmt = $dbh->query("SELECT * FROM animals"); $stmt->setFetchMode(PDO::FETCH_INTO, new animals); foreach($stmt as $animals) { echo $animals->name; } If i skip the setFetchMode() method, then I need to call $animals["na...

PHP: How do I access this object property?

I'm using a PHP class someone wrote to interface with the BaseCamp API. The particular call I'm doing is to retrieve the items in a todo list, which works fine. My problem is, I'm not sure how to access just the todo-items property of the object that is returned. Here's the var_dump of the returned object: object(stdClass)[6] public...

ASP.NET and objects

Hi, Let's say I have a class Person, with a string[] nickNames, where Person can have 0 or more nicknames stored. I want to create an asp.net page where a user can go and add/edit/delete nicknames. Question is- how to i persist the Person object between postbacks? I query the DB and create the object then display it on a form, but the...

C# class objects

Hello, I have a class that I am using below. And I am using this class for my windows application. However, when I call the method from my application ReadInConfig() it successfully reads and fills the datatable, and assigns the _sip_ip address. In my windows application I have the following. However, it doesn't give me the sip_ip that...

Getting different instances to communicate

Suppose I have two instances of the same class. The class has a pointer to some data, and I want the instances to exchange the pointers as part of some private function's algorithm, but without compromising the data to everybody else by giving a direct access to it through a public function. My first idea was to add a static variable o...

C#: How do i assign many variables with an integer(i) in for loop?

Hello, Imagine we have 5 string variables and we want to assign "Foo" to them during runtime. Instead of this string a1 = "Foo"; string a2 = "Foo"; string a3 = "Foo"; string a4 = "Foo"; string a5 = "Foo"; Can't we use something like this: for(int i = 0;i < 5;i++) { a+i = "Foo"; } Is it impossible to access them in a similiar ...

Passing arguments to the Class Constructor

How can I pass a arbitrary number of arguments to the class constructor using the Object() function defined below? <?php /* ./index.php */ function Object($object) { static $instance = array(); if (is_file('./' . $object . '.php') === true) { $class = basename($object); if (array_key_exists($class, $instance) =...

jQuery Form Handling

I have a product selection page where you choose a phone and a plan using radio buttons and I need jQuery to display the "current selection". For example I have 2 phones with two plans: Nokia N95 and Nokia N96, $35/month and $50/month Each of these 'options' has it's own radio button. When N95 and the $50/month plan are selected I need...

Getting Object Expected Error in Server Side Javascript Code

I am getting an error stating that an object is expected in the below code. Declarations... this.regions = {}; this.regions = ["US", "Europe", "Asia"]; this.regionalRankingKey = ["SP500", "GBE", "CNG"]; //this is the ranking model key for pulling up the rankings object. this.rankingTypes = ["gainers", "losers", "actives"]; this.reg...