objects

Is there a technical difference between the terms "length" and "size" (in programming, of course)?

In Java in particular, on Strings, you call string.length(), whereas in Lists you call list.size(). Is there a technical difference between the two terms, seeing as a String is really just a list of chars? Any comments appreciated. ...

Is there any way to know which symbols are exported in a object file?

Hi I'm working in a Linux environment and I have to link to a object file already compiled which offers me some services (services.o) and I know some of them, but I'd like to know which are all of the exported symbols of it. Is there any way to accomplish this not having the sources? If so, how? Thanks you very much. ...

Get all models having implemented a certain method

I have many models created with the standard rails model generator. Some of the models have then got a method called foo(). Is there a simple way to figure out all the class names of the generated models having the foo() method implemented ? I mean programmaticaly, from a rails controller, not from the console grepping the sourcecode....

skip certain objects in xml feed using php

I am using php xpath to get the values from the below xml feed and php the function. <FOUND> <IMAGES> <IMAGE> <SMALL>images/small.jpg</SMALL> <MED>images/med.jpg</MED> <LARGE>images/large.jpg</LARGE> <EXTRAL>images/extra.jpg</EXTRAL> </IMAGE> <IMAGE> <SMALL>images1/small.jpg</SMALL> ...

Remove duplicates from an array of objects in javascript

I have an object that contains an array of objects. things = new Object(); things.thing = new Array(); things.thing.push({place:"here",name:"stuff"}); things.thing.push({place:"there",name:"morestuff"}); things.thing.push({place:"there",name:"morestuff"}); I'm wondering what is the best method to remove duplicate objects from an arr...

Ways to accidentally create temporary objects in C++?

Years ago I believed that C was absolutely pure compared to C++ because the compiler couldn't generate any code that you couldn't predict. I now believe counter examples include the volatile keyword and memory barriers (in multiprocessor programming or device drivers for memory-mapped hardware devices, where plain assembly language woul...

Sending information between two Windows Froms in C#

This might be a novice question. :). Consider the following scenario. Suppose we have two windows forms that are already "loaded" (i.e You can see both the forms) Form 1 contains a textbox and a "submit" button while the form 2 contains a text lable. The user can enter a string in the textbox and press ...

Describing class relationships in ruby

I've never done any straight ruby coding - only worked with the Rails framework. I am not sure how to describe the relationships between Classes, other than inheritance relationships. For example, a School object may have many Student objects. I would like to be able to make calls like "myschool.student[2].first_name" and "mystudent.sc...

Java rules for casting

When can a certain object be cast into another object? Does the casted object have to be a subtype of the other object? I'm trying to figure out the rules... Edit: I realized that I didn't explain my issue at all: basically I am casting an object to an interface type. However, at run-time, I get a java.lang.ClassCastException. What n...

How to create object property from variable value in javascript?

Hi, I want to add new property to 'myObj', name it 'string1' and give it a value of 'string2', but when I do it it returns 'undefined: var myObj = new Object; var a = 'string1'; var b = 'string2'; myObj.a = b; alert(myObj.string1); //returns 'undefined' alert(myObj.a); //returns 'string2' In other words: How to create an object prope...

In PHP, what is the difference between :: and -> when referencing a class?

Possible Duplicate: PHP: self vs this I'm working on some code and the previous author seems to intermingle the two. example: class DB { // Some functions } Outside the class he references it like so: DB::somefunction(); and also like this: $db = new DB; $db->somefunction(); What's the difference between the two ...

How to expose custom object (with sub objects) in web service?

I'm kinda new to web services and want to make sure I am doing things correctly. I have a custom object which has sub objects as well. (let's say Company object, sub object is collection of Employee objects) I want the web service to return a collection of Company objects. Do I make the service return a Dataset and custom generate a d...

Object declaration in iPhone tableView

Hi, When i try to initialize an object inside the tableView:cellForRowAtIndexPath the simulator crashes. The code i used is Claimant *tempClaimant = [[Claimant alloc] init]; tempClaimant = [appDelegate.arrRetailClaims objectAtIndex:0]; NSLog(@"Claimant Name is: %@",tempClaimant.ClaimantName); Is there anything wrong with this. The s...

How to get a value based on another value from a object/array in php

Hi there. My first question here, after enjoying lots og other peoples questions and answers. Thanks for that :) Im trying to work with vimeo's api, and im getting a response I can't figure out to use as I intend. I think its simple for some of you guys, but can't wrap my head around it. I got a bunch of video id's that I need to get t...

Persistent Data with Javascript

Hi, I have an application that has a "parent" window. In the parent window there are menu items, like the following (using PHP here): // sample link echo "<li><a href=\"#\" onclick=openurl('covershift.php');>Shift Coverage</a></\ li>"; // logout link echo "<li><a href=\"#\" onclick=openurl('logout');>Logout</a></li>"; Each link open...

Efficient way of locating and/or selecting graphic object in a fixed grid

I have a panel that is filled with a large number of circles (Ellipse2D). The circles are stored in a 2 dimensional array (rows and columns). My goal is to be able to "paint" the circles as I drag the mouse over them. I will eventually want to use selection shapes that will change the color of all the circles contained within the selec...

ExpressionBuilder return any type of object

The code below works fine for primitive expressions (no surprise there) public class SiteContextExpressionBuilder : ExpressionBuilder { public override CodeExpression GetCodeExpression(BoundPropertyEntry entry, object parsedData, ExpressionBuilderContext context) { PropertyInfo property = typeof(SiteContext).GetProperty(entry.E...

PHP Object Question

Unfortunately I cannot provide any code examples, however I will try and create an example. My question is about Objects and memory allocation in PHP. If I have an object, lets say: $object = new Class(); Then I do something like $object2 = $object; What is this actualy doing? I know there is a clone function, but thats not what I...

How to sort an array of objects based on a the length of a nested array in javascript

I have an array of objects in javascript, each of which in turn has an array: { category: [ { name: "Cat1", elements : [ { name: name, id: id } ] }, { name: "Cat2", elements : [ { name: name, id: id }, { name: name, id: id }, { name: name, id: id } ] ...

Should I assign a value to a variable when I declare it in Java?

I have a code with the following sequence of lines: Socket echoSocket = null; ... something ... echoSocket = new Socket("taranis", 7); I do not understand why we want to have a first line. Well I know that Java is unable to define a type of the variable from its value. It's why first we need to tell that echoSocket is variable which h...