object

Website for prototyping OO class diagrams

Do any web 2.0 like websites exist for prototyping object oriented class diagrams? ...

Initializing objects on the fly

I have a vector called players and a class called Player. And what I'm trying to do is to write: players.push_back(Player(name, Weapon(bullets))); So I want to be able to create players in a loop. But I see an error message says "no matching function for call Player::Player..." Then I've changed that to: Weapon w(bullets); Player p(...

Measuring the time to create and destroy a simple object

From Effective Java 2nd Edition Item 7: Avoid Finalizers "Oh, and one more thing: there is a severe performance penalty for using finalizers. On my machine, the time to create and destroy a simple object is about 5.6 ns. Adding a finalizer increases the time to 2,400 ns. In other words, it is about 430 times slower to create and destroy...

Using a database class in my user class

In my project I have a database class that I use to handle all the MySQL stuff. It connects to a database, runs queries, catches errors and closes the connection. Now I need to create a members area on my site, and I was going to build a users class that would handle registration, logging in, password/username changes/resets and logging...

load Javascript object from file

Hi there, I asked a question in this thread Stackoverflow, and it works perfect. So tnx to all the users who gave me a reply. But now I have a other question. I would like to have the object in a seperate file, so I only need to update the file in stead of the JS file (otherwise it will be very big). I'm using JQUERY. I now looks like...

How do I make JavaScript to set these element values?

I have two fields that need to multiply each other and fill a 3rd form's value. Here's the HTML: <input type="text" name="estimate[concrete][price]" value="" onBlur="calc_concreteprice(document.forms.mainform);" /> per SF <strong>times</strong> <input type="text" name="estimate[concrete][sqft]" value="" onBlur="calc_concreteprice(...

Receiving name of the element as an object

This is my JavaScript code: <script> function change(name){ var element = document.all.name.value; } </script> It returns an error. How to pass to the function the element's name in order to change its value? ...

Order object simplexml_load_file by field of this.

Hi i have a problems with simplexml_load_file, i'm not pretty sure how to do to order my array by a $item->padre. I need to do foreach and order by $item->padre.=, i don't know how to do this. function create_sitemap($sitemap){ $xml = file_exists('sitemap.xml') ? $xml = simplexml_load_file('sitemap.xml'): exit('Failed to open sitema...

Scala passing type parameters to object

In Scala v 2.7.7 I have a file with class Something[T] extends Other object Something extends OtherConstructor[Something] This throws the error: class Something takes type parameters object Something extends OtherConstructor[Something] { However, I can't do this object Something[T] extends OtherConstructor[Something[T]] I...

Behavior of object in set operations

I'm trying to create a custom object that behaves properly in set operations. I've generally got it working, but I want to make sure I fully understand the implications. In particular, I'm interested in the behavior when there is additional data in the object that is not included in the equal / hash methods. It seems that in the 'inters...

Transferring objects between two independed applications (C#)

Hi, is it possible to transfer a object from one application to another (in C#)? I'm working with a CAD API. The initialization of that API takes a few seconds (10 - 15). Would be nice if I could initialize the object only once in App1 and call it up from App2 whenever I need it. Any ideas? Thanks! ...

PHP intersection between array and object

I have an object, let's say it's like this: class Foo { var $b, $a, $r; function __construct($B, $A, $R) { $this->b = $B; $this->a = $A; $this->r = $R; } } $f = new Foo(1, 2, 3); I want to get an arbitrary slice of this object's properties as an array. $desiredProperties = array('b', 'r'); $outp...

Order SimpleXMLElement by element

Hi everyone I need to order a SimpleXMLElement by a node called padre like this. $xml = new SimpleXMLElement('sitemap.xml',null,true); sort($xml, "padre" ); foreach($xml as $url ) { echo "loc}' title='".rescue_name($url->loc)."'>".rescue_name($url->loc)." {$url->padre}"; } I don't know why is not work...

maximum size of object

Hi what is maximum size of data that can a object hold ? thanx ...

Methods in Ruby: objects or not?

Inspired by this discussion, after some googling I wasn't able to find an answer to a pretty simple question regarding methods in Ruby: are methods objects or not? There are different opinions here and there, and I would really like to hear, let's say, an in-depth explanation. I'm aware of Object#method method, which takes a method nam...

Accessing a dictionary value by custom object value in Python?

So I have a square that's made up of a series of points. At every point there is a corresponding value. What I want to do is build a dictionary like this: class Point: def __init__(self, x, y): self._x = x self._y = y square = {} for x in range(0, 5): for y in range(0, 5): point = Point(x,y...

AS3: Array of objects parsed from XML remains with zero length

I'm trying to parse an XML file and create an object array from its data. The data is converted to MediaAlbum classes (class of my own). The XML is parsed correctly and the object is loaded, but when I instantiate it, the Albums array is of zero length, even when the data is loaded correctly. I don't really know what the problem could b...

python : how to access object attribute given string corresponding to name of that attribute ?

class test(): attr1 = int attr2 = int t = test() x = "attr1" I want to set/get value of attribute of t corresponding to x. How do i do that ? Thanks in advance. ...

JPA query many to one association

I want to build the following pseudo query Select a From APDU a where a.group.id= :id group is a field in APDU class of the type APDUGroup.class. I just want to get a list of APDUs based on APDUGroup's id. How do i do that using a standard JPA query? UPDATE Yes, I have tried the above query and tried other variations for hours befo...

Why ruby object has two to_s and inspect methods that do the same thing? Or, so it seems.

The p calls inspect, and puts/print calls to_s for representing its object. If I run class Graph def initialize @nodeArray = Array.new @wireArray = Array.new end def to_s # called with print / puts "Graph : #{@nodeArray.size}" end def inspect # called with p "G" end end if __FILE__ == $0 gr = Graph.new ...