How does the garbage collector determine whether an object is garbage? Does it refer to the stack to check the references to the space allocated in the heap?
In c# I can declare object o; then I can assign o=(float)5.0; or o="a string." Is there an equivalent for Objective-C? I tried to use id but it does not take primitive type like float or integer. Thanks for helping.
Given the following object graph:
{
"children": [
{
"child": {
"pets": [
{
"pet": {
"name": "fido"
}
},
{
"pet": {
"name": "fluffy"
}
}
]
}
},
{
"child": {
"pets": [
{
"pet": {
"name": "spike"
}
}
]
}
}
]
}
What would be a nice one-liner (or two) to collect the names of my grandchildren's pets? The result should be ["fido", "fluffy", "spike"]
I don't want to write custom methods for this... I'm looking for something like the way jQuery works in selecting dom nodes, where you can just give it a CSS-like path and it collects them up for you.
I would expect the expression path to look something like "children child pets pet name"
I am working on an App that intends to give an accurate measure of any object (building, desk, chair, people, etc.) Using the camera (either phone's or laptop) but I'm unsure as to how to do this without using a lot of resources, would someone mind giving me some options? I'm looking for a lightweight one that can be quickly processed by the computer/phone to give back the measures.
Is it possible to ignore the schema in object names when comparing databases using Visual Studio 2010 Schema Compare? For example, I'd like [dbo].[mysproc] and [mysproc] to be considered equivalent.
In Mac OS, Fire fox Version 3.6.3 is blocking XMLHttp Object in one machine but it didn't block in same set of OS and browser versions in other machine. Is there any way to enable or disable xmlhttp from browser?
Hi,
I am aware of this question already existing, but it has given me no luck.
I have an application which loads a physicial XML document via the following method:
jQuery.ajax( {
type: "GET",
url: fileName,
dataType: "xml",
success: function(data) {
etc...
I parse the XML and convert it into a string which is saved into a variable so that it can easily be stored in a database. How can I now convert the data in this variable back into an XML object so that it can be parsed as such?
I am using hibernate annotations. How to add methods to POJO object? For example i have "getChildNodes" method, associated with database, but i want also add recursive method "getAllChildNodes". I get "org.hibernate.PropertyNotFoundException: Could not find a setter for property progress in class" exception when i do it.
Using simple type like
class A {
public int X, Y;
}
with object intializers, one can write
var a = new A { X=0, Y=0 };
But the following is also accepted by the compiler:
var a = new A { X=0, Y=0, }; // notice the additional ','
Same for int[] v = new int[] { 1, 2, };
This looks a bit strange ... Did they forgot to reject the additional ',' in the compiler or is there a deeper meaning behind this?
I understand the purpose of the NULL constant in C/C++, and I understand that it needs to be represented some way internally.
My question is: Is there some fundamental reason why the 0-address would be an invalid memory-location for an object in C/C++? Or are we in theory "wasting" one byte of memory due to this reservation?
@ManyToOne
@JoinColumn(name = "play_template_id", table = "team_play_mapping" )
public Play getPlay() {
return play;
}
public void setPlay( Play play ) {
this.play = play;
}
By default, this is eager loading. Can I get it so that it will read the play object from a cache without making it lazy loading? Am I correct that eager loading will force it to do a join query and hence no caching?
Hey,
I am hiding a TextBoxin my aspx page like this:
myField.visible=false;
Now I have a DropDown as well which tries to access the TextBox on IndexChange. The problem is, it cant access the hiffen TextBox and I am getting document.form[0] is Null or Not an Object. How can I solve that? Is the some check for that in JavaScript?
Thanks :-)
In interview someone ask me @ Abstract class. I told him @ abstract class and i also told that we can not create object of this class. his next question is why? because it may or may not include abstract methods.
Say I have:
@property (nonatomic,retain) NSString *foo;
in some class.
And I call:
myclass.foo = [NSString stringWithString:@"string1"];
myclass.foo = [NSString stringWithString:@"string2"];
Should I have called [myclass.foo release] before setting it to "string2" to avoid a memory leak?
Or the fact that nothing is pointing to the first "string1" object anymore is good enough?
And in the dealloc method [foo release] will be called.
In Javascript, if an object has lots of properties that are functions:
var obj = { foo: function() { ... },
bar: function() { ... },
...
}
then how can you get an array of names of those functions? That is, an array
["foo", "bar", ... ]
thanks.
Say I have a simple object such as
class Something
{
public int SomeInt { get; set; }
}
I have read that using immutable objects are faster and a better means of using business objects? If this is so, should i strive to make all my objects as such:
class ImmutableSomething
{
public int SomeInt { get { return m_someInt; } }
private int m_someInt = 0;
public void ChangeSomeInt(int newValue)
{
m_someInt = newvalue;
}
}
What do you reckon?
I would like to use a component that exposes the datasource property, but instead of supplying the datasource with whole list of objects, I would like to use only simple object. Is there any way to do this ?
The mentioned component is DevExpress.XtraDataLayout.DataLayoutControl - this is fairly irrelevant to the question though.
I am new to mac, my question is what else text editors can be used to edit object c code except xcode. And which one is the best for productively editing source code?
I have a dict object. I dumped the data using this:
for alldata in data: # print all data to screen
print data[alldata]
Each field had brackets [] and 'None' values for NULLS and date.datetime for date values.
How do I dump this dict to MySQL table? Thank you!
Example: I have one persistent store coordinator which uses one single persistent store.
Now there are two managed object contexts, and both want to use the same persistent store. Could both simply use the same persistent store coordinator, or would I have to create two instances of NSPersistentStoreCoordinator? And if I had to, then: Would I also have to create two NSPersistentStore instances?
Since there is no way that you can make the flash object transparent, there needs to be some other means by which you can match the background. I thought of maybe creating a ActionScript/Javascript bridge, but I wonder if this is the route to take.
Do I have a better option?
This seems like a lot of work; to check for null each time an object is used.
I have been advised that it is a good idea to check for null pointers so you don't have to spend time looking for where segmentation faults occur.
Just wondering what the community here thinks?