I am not sure if the memory address of an object keeps beeing the same over its lifetime. Does it? Or does it change sometimes during the object's existence?
Hi,
I would like know how this feature is implemented in VS - I understand it holds some sort of weak-reference to the object in the debugged-application's memory, but how exactly is it accomplished?
I know simply tracking the address (as in native code) wouldn't work, because the GC might move the object about, invalidating the address.
Thanks.
I'm hoping that Ruby's message-passing infrastructure means there's some clever trick for this...
How do I determine the calling object -- which object called the method I'm currently in?
If I have an example such as the following:
describe "A flux capacitor" do
it "should flux a lot" do
# how can I access the string object "A flux capacitor" in here???
...
end
end
How can I access the described string object "A flux capacitor"?
I've tried a few permutations of 'described_type' and 'described_class'
Such as:
self.described_type.to_s
But these always return nothing. What am I doing wrong?
Thanks,
-Bill
I was just wondering if it is more correctly to as a label of objects in UML sequence diagram instead of object name (which is irrelevant in my opinion and less informative than class name) provide class name. Another thing, while returning information instead of listing all objects names would it be a better solution to just write collection;
Diagram with object names:
Diagram with class names:
As it's clearly visible from the second diagram that it is much more informative than the first one, and I think it is more practical.
I have what I would consider a small sized iPhone app that uses SQLite.
There is a singleton domain object which gets data from a SQLite database.
Is it better to create and open the SQLite connection for each request, or to open the DB once and hold on to it for the duration of the app.
The app's reason for being is the domain object so other objects will not need the DB.
What's the fastest way to count the number of keys/properties of an object? It it possible to do this without iterating over the object? i.e. without doing
var count = 0;
for (k in myobj) if (myobj.hasOwnProperty(k)) count++;
Firefox provides a magic __count__ property, but this isn't available in other implementations.
Can anyone tell me if there are any clients (browsers) that define a functioning Object.prototype.hasOwnProperty
that do NOT define a Function.prototype.call?
That is, must I use belt and suspenders to qualify clients for a certain level of scripting,
or will hasOwnProperty do for both?
if(Object.hasOwnProperty && Function.call){
// add script
}
Is support for either of these properties a reliable subset of support for the other?
I need to get a dictionary of properties and their values from an object declared with the dynamic keyword in .NET 4? It seems using reflection for this will not work.
Example:
dynamic s = new ExpandoObject();
s.Path = "/Home";
s.Name = "Home";
// How do I enumerate the Path and Name properties and get their values?
IDictionary<string, object> propertyValues = ???
When using the visual studio 2008 debugger with c# i can right-click on a variable and choose "Make Object ID" which allows me to watch that object (via it's ID) regardless of whether it is in the current stack frame or not.
When the debugger is in VB code, (doesnt matter if it's run from a c# unit test or a vb unit test) That option isn't there.
Where did VB put this feature? Or does it simply not support it like so many other helpful c# features?
What's the best way to get the current PowerShell Cmdlet from another object? If I create a helper object that is not a Cmdlet but will be called by Cmdlets, the helper methods may want to call WriteVerbose, WriteDebug etc. What's the best way to get access to that? Is there a static PowerShell method that will return the current Cmdlet or do I need to have the Cmdlet pass itself to the helper?
Hello! I would like to set up a proxy object in the application NIB file. The problem is that the NIB file is the main application NIB that gets loaded automatically by the application and therefore I cannot set up the UINibProxiedObjectsKey dictionary as described in the documentation. Is there a way to set up a proxy object in the main application NIB? Or can I tap into the code that loads the main application NIB?
I'm considering creating a simple remote debugging application for Javascript. Actually, I want to provide an object to Firebug Lite and let it do all the job.
So, can I get an object from one page, serialize it, send it to server and then to another browser and finally see the same results in Firebug Lite (on that other client) as I would see on the first browser (with doing "console.dir(obj)")? Is it possible to do?
Supose you have something like:
x = "something"
b = x
l = [b]
How can you delete the object only having one reference, say x?
del x won't do the trick; the object is still reachable from b, for example.
There is a certain page on my website where I want to prevent the same user from visiting it twice in a row. To prevent this, I plan to create a Lock object (from Python's threading library). However, I would need to store that across sessions. Is there anything I should watch out for when trying to store a Lock object in a session (specifically a Beaker session)?
I have a Flash object that loads fine in a static sample HTML but doesnt inside the application.
I saw something interesting in firebug. When the page loads the object is loaded two times. In the first one I get a Partial Response status but the content-type of the package is right. In the second time the whole package is transfered but the content-type is wrong!
I am using apache 2.2.14.
Hi,
Can I use Linq-to-xml to persist my object state without having to use/know Xpath & XSD Syntax?
ie. really looking for simple but flexible way to persist a graph of object data (e.g. have say 2 or 3 classes with associations) - if Linq-to-xml were as simple as saying "persist this graph to XML", and then you could also query it via Linq, or load it into memory again/change/then re-save to the xml file.
In this link: http://css-tricks.com/snippets/jquery/jquery-plugin-template/ it has a line of code that says
// Add a reverse reference to the DOM object
base.$el.data("yourPluginName", base);
what does the "reverse reference to the DOM object" mean?
I have an 'optional' parameter on a method that is a KeyValuePair. I wanted an overload that passes null to the core method for this parameter, but in the core method, when I want to check if the KeyValuePair is null, I get the following error:
Operator '!=' cannot be applied to operands of type System.Collections.Generic.KeyValuePair<string,object>' and '<null>.
How can I not be allowed to check if an object is null?
I have the following variable that accepts a file name:
var xtr = new XmlTextReader(xmlFileName)
{
WhitespaceHandling = WhitespaceHandling.None
};
var xd = new XmlDocument();
xd.Load(xtr);
I would like to change it so that I can pass in an object. I don't want to have to serialize the object to file first.
Is this possible?
How can I return a java.util.concurrent.Future object with a Receipt object and only use the @javax.ejb.Asynchronous annotation?
And do I need any extra configuration to let Spring handle ejb annotations?
I don't want to write any concurrency logic myself.
Here's my attempt that doesn't work:
@Asynchronous
public Future<Receipt> execute(Job job) {
Receipt receipt = timeConsumingWork(job);
return receipt;
}
I have an object which has both a copy constructor and assignment operator defined. It is enclosed inside a shared pointer.
I want to make another shared pointer that contains a copy of the original shared pointer (i.e. new shared pointer to a new memory location, which however, has the same data as the original object).
Thanks for any assistance.
With the new ConcurrentBag<T> in .NET 4, how do you remove a certain, specific object from it when only TryTake() and TryPeek() are available?
I'm thinking of using TryTake() and then just adding the resulting object back into the list if I don't want to remove it, but I feel like I might be missing something. Is this the correct way?
In my code, is there a shorthand that I can use to assign a variable the value of a object's property ONLY if the object isn't null?
string username = SomeUserObject.Username; // fails if null
I know I can do a check like if(SomeUserObject != null) but I think I saw a shorthand for this kind of test.
I tried:
string username = SomeUserObject ?? "" : SomeUserObject.Username;
But that doesn't work.