I have a class that has an list<Book> in it, and those Book objects has many many properties.
How can I remove from that list every Book that his level value is different than, for example, 5?
Hi everybody,
I have tried to find a good introduction on chainable OOP objects in PHP, but without any good result yet.
How can something like this be done?
$this->className->add('1','value');
$this->className->type('string');
$this->classname->doStuff();
Or even: $this->className->add('1','value')->type('string')->doStuff();
Thanks a lot!
Hi, is it posible to have callable objects on ActionScript? For example:
class Foo extends EventDispatcher
{
Foo() { super(); }
call(world:String):String
{
return "Hello, " + world;
}
}
And later...
var foo:Foo = new Foo();
trace( foo("World!") ); // Will NOT work
I'm trying to sort a Vector in java but my Vector is not a vector of int, it is a vector of objects
the object is :
public MyObject()
{
numObj = 0;
price = new Price();
pax = new Pax();
}
so I have a Vector of MyObject and I want to order it by numObject, how do i do it, i'm new in java?
thank you so much for all your help
hello all , I am trying to create url routing with strongly typed objects for pages but I keep getting null object on the first line so it's crashing
//Getting the suitable executing Page
var display = BuildManager.CreateInstanceFromVirtualPath(_virtualPath,typeof(Page)) as IProfileHandler;
//Setting Page Parameters
display.MemberId = Convert.ToInt32(requestContext.RouteData.Values["ID"]);
//Return Page
return display;
public interface IProfileHandler : IHttpHandler
{
int MemberId
{
get;
set;
}
}
Let's say I have a custom object of Foo
Is there anyway I can sort through a list of these objects, like
list<of foo>.sort()
and also be able to sort this list with a passable parameter. which will influence the sort?
list<of foo>.sort(pValue)
I'm guessing I'll need to define two separate sorts, but I am not sure.
Hi!
I have the following code:
Criteria crit = sess.createCriteria(Product.class);
ProjectionList proList = Projections.projectionList();
proList.add(Projections.property("name"));
proList.add(Projections.property("price"));
crit.setProjection(proList);
But I also have User.class and I would like the name to be restricted on User.class and price from Product class.
How can I restrict different columns on different objects in Hibernate Search?
Hello,
I'm writing transpose function for 8x16bit vectors with SSE2 intrinsics. Since there are 8 arguments for that function (a matrix of 8x8x16bit size), I can't do anything but pass them by reference. Will that be optimized by the compiler (I mean, will these __m128i objects be passed in registers instead of stack)?
Code snippet:
inline void transpose (__m128i &a0, __m128i &a1, __m128i &a2, __m128i &a3,
__m128i &a4, __m128i &a5, __m128i &a6, __m128i &a7) {
....
}
Assuming we are running a compiled C++ binary:
Is passing around an int (e.g. function to function, or writing it into variables) slower than passing around structs/class objects like the following?
class myClass
{
int a;
int b;
char c;
vector d;
string e;
}
Let's say I have a custom object of Foo
Is there anyway I can sort through a list of these objects, like
list<of foo>.sort()
and also be able to sort this list with a passable parameter. which will influence the sort?
list<of foo>.sort(pValue)
I'm guessing I'll need to define two separate sorts, but I am not sure.
Thanks!
Got a problem,
I have an an array of objects inside a constructor of a class. I'm trying to use the array to relate to a property in the object but I can't relate to them.
lessonObjectsArray(0) = lessonObject1
lessonObjectsArray(1) = lessonObject2
lessonObjectsArray(2) = lessonObject3
the properties of the object "lessonObject1" are lessonName, videoLink, pdfLink
I thought it would be tbTest.text = lessonObjectsArray(0).lessonObject1.lessonName
just doesnt work
I have two objects of Zend_Date class and I want to calculate the difference between them in full calendar months.. How can I do this?
<?php
$d1 = new Zend_Date('1 Jan 2008');
$d2 = new Zend_Date('1 Feb 2010');
$months = $d1->sub($d2)->get(Zend_Date::MONTH);
assert($months == -25); // failure here
Thanks in advance!
Okay, I have what I think is a simple question.. or just a case of me being a C# beginner.
I have an array of custom objects (clsScriptItem) that I am populating from a database. Once the items are loaded, I want to back them up to "backup" array so I can revert the information back after changing the main array. However, when I use CopyTo to copy the array and then alter the original array, the backup array is also being altered... I though CopyTo merely copied values + structure from one array to another.
private void backupItems()
{
lastSavedItems = new clsScriptItem[items.Length];
items.CopyTo(lastSavedItems, 0);
//items[0].nexts[0] is 2
//lastSavedItems[0].nexts[0] is 2
items[0].nexts[0] = "-1";
//items[0].nexts[0] is -1
//lastSavedItems[0].nexts[0] is also -1
}
How do I backup this data without having the two arrays be 'linked'??
hey Folks,
Is there any way in ruby to get the memory address of objects..
say..
(i = 5) is that possible to get the mem address of that object 5..
I have been trying to get this over some time..,
Any answer would be really appreciated...
thanks,
Regards levirg
I cant seem to get any consistent info on this. Different sources appear to say different things and trhe venerable php.net iteslf (appears) not to explicitly state this - although I must admit, I only had a quick look.
In cases where I am passing around 'heavy' objects, I need to pass by reference, but I dont want to keep typing:
function foo(TypeName& $obj)
if I can get away with simply,
function foo(TypeName $obj)
So what does the standard say?
Accesing array objects in javascript
OBJ_ARRAY[j][i] = {
"x1": w * i,
"y1": h * j,
"x2": w * (i + 1),
"cell_color": "blue",
"y2": h * (j + 1),
"name": (i + 1 * (j * 10)) + 1,
"z-index": 10,
"status":isnotactive
}
I have this cell array and all its x1,y1 x2,y2 are generated dynamically.
for eg. if want to compare OBJ_ARRAY[5][5].x110 then alert
if(( OBJ_ARRAY[5][5].x1) > 10)) ;
{
alert("Done");
}
It does not work any idea how it can be fixed?
I am trying to make a program that generates bids automatically, then pack them into a vector and send them to the auctioneer.The simulator class, the simulator can then pass the bids to the auctioneer.How do I implement this communication.I thinking of sending the all vector conatiner of bids to the simulator.Can anyone demostrate a better way of sening vector objects from one class to another.
Hi there.
I have a ROXML object that looks like:
class Activity
include ROXML
xml_accessor :id
end
If I have an array of these objects and call .to_xml on the array, I receive an empty xml collection:
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<activities type=\"array\">\n</activities>\n"
Any idea why or how to fix this?
I'm running Rails 2.3.5 with the newest version of ROXML.
Thanks
Alright, im trying to understand this,
so a class is simply creating a template for an object.
class Bow
{
int arrows;
};
and an object is simply creating a specific item using the class template.
Bow::Bow(arrows)
{
arrows = 20;
}
also another question, public specifiers are used to make data members avaible in objects and private specifiers are used to make data memebers only avaialble inside the class?
I have to dynamically add a list of views (the views use RelativeLayout). Can I do this by specifying the view definition in xml and instantiate multiple objects off it? This gives the usual benefits of separating the view part from the code (for e.g., making it easy for the UI guys to alter things) or Is going the ArrayAdapter the suggested/only route?
Hi,
As the title says I have a list of Django objects and I want to get a list of primary keys. What is the best way of doing this?
I know I could do
my_list = []
for item in object_list:
my_list.append(item.pk)
but was wondering if there is Django or Python specific way of doing this better.
Thanks
During a recent interview I was asked why one would want to create mock objects. My answer went something like, "Take a database--if you're writing test code, you may not want that test hooked up live to the production database where actual operations will be performed."
Judging by response, my answer clearly was not what the interviewer was looking for. What's a better answer?