object

JavaScript Object Method Chaining: useful?

So... messing around in JavaScript with an idea that's new to me, having methods of an Object return the Object of which they are methods; this then leads to chainability. My question, then: how can this be useful? I threw this together to test the fundamental workings: <script> MathChain = function() { this.pass = function() ...

What is the JavaScript equivalent of var_dump or print_r in PHP?

Hi, I would like to see the structure of object in JavaScript (for debugging). Is there anything similar to var_dump in PHP? Thanks ...

How can I "filter" JSON for unique key name/value pairs?

I've got some JSON data that is giving me a list of languages with info like lat/lng, etc. It also contains a group value that I'm using for icons--and I want to build a legend with it. The JSON looks something like this: {"markers":[{"language":"Hungarian","group":"a", "value":"yes"}, {"language":"English", "group":"a", "value":"yes"},...

How do I handle child lists and get new object lists in C# using LINQ?

I have a LINQ query which gives me a list with a number of child lists all with double values. I want to get a queryResult from this. How can I get the first, the last, the highest and the lowest double value? Should it be a new object and should the new return values be a list? ...

What is the best way to persist an object using forms in PHP?

I have a PHP application where I would like to certain objects to persist in the following manner: The object must not exist in the $_SESSION. Separate web browser windows must control separate instances of the object. The end-user must not be able to modify the object by changing the content of the $_REQUEST variable by hand (if this...

Best practice to serialize and deserialize .net objects across versions

Objects are serialized to a database using the .NET XML serializer. The object can change over time, and therefore multiple versions exist in the database at one time. Any suggestions for the best way to construct your code, so that you can still deserialize this object into the latest version. (interfaces / maps / manual serialization ...

how to declare a record inside an OCAML class

hello, I wanna declare a record inside a class as follows: class player (x, y)= object(self) type gun = {x:int; y:int; active:bool} val guns = Array.create 5 {x=0; y=0; active=false} .... but the compiler claim that this line is syntax error : type gun = {x:in .... when declared outside the class like this type : gun...

How do I sort an object within an array?

I have searched and found a couple of solutions on this site, that didn't work for me. My case is that I perform a XPath search (contains function) in the XML, and lists the results. I want those results listed alphabetically. The results are laying in an array, and looks like this: Array ( [0] => SimpleXMLElement Object ( ...

jquery sorting complex static object

i want to sort the keys or name of the method.. following is the object http://pastie.org/411854 ...

object[] from ReadOnlyCollection<T>

I have an object that I ended up with via a reflection call: object readOnlyCollectionObject = propertyInfo.GetValue(someEntity, null); I know this object is a generic ReadOnlycollection. It could be a ReadOnlyCollection<Cat>, ReadOnlyCollection<Dog>, etc. For argument sake, lets just say it is a ReadOnlyCollection<T>. Even though a D...

How do I set a flash object to open a url in a new window?

Hi Guys, I have this code: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="300" height="250"> <param name="movie" value="Spotify_premium_300x250.swf" /> <param name="quality" value="high" /> <embed src="Spotify_pre...

Advanced Search option Programatically Sharepoint Search

I am using object code model to retrieve search result from sharepoint search..Can any one suggest how do i put advanced search option for my search.Do object code model has the feature to perform advanced search. ...

c++: when to use pointers?

After reading some tutorials I came to the conclusion that one should always use pointers for objects. But I have also seen a few exceptions while reading some QT tutorials (http://zetcode.com/tutorials/qt4tutorial/painting/) where QPaint object is created on the stack. So now I am confused. When should I use pointers? ...

Best way to cache persistent data (e.g. code books) in Spring?

I have a series of code books in my database, and I am using plain JDBC calls to fetch them and store them in a collection. I would like to put these in some kind of a cache at application startup time in order to save time later. I don't need any fancy stuff like automatic object invalidation, TTL etc - the code books change rarely, so...

VB6 to C# interop: Cannot directly set a property of type 'object'

Given the following C# class: namespace ComTest { [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [Guid("A1D11BE5-40A1-4566-A1CA-418ABC76017C")] public interface IThing { [DispId(1)] void SetValue( object input ); [DispId(2)] object Value {get; set;} } [ComVisible(true)] publ...

Is it possible to use a c# object initializer with a factory method?

I have a class with a static factory method on it. I want to call the factory to retrieve an instance of the class, and then do additional initialization, preferablly via c# object initializer syntax : MyClass instance = MyClass.FactoryCreate() { someProperty = someValue; } vs MyClass instance = MyClass.FactoryCreate(); instance....

Changing data content on an Object Tag in HTML

I have an HTML page which contains an Object tag to host an embedded HTML page. <object style="border: none;" standby="loading" id="contentarea" width="100%" height="53%" type="text/html" data="test1.html"></object> However, I need to be to change the HTML page within the object tag. The current code seems to create a clone of the o...

What data does a TObject contain?

TObject.InstanceSize returns 8, yet TObject doesn't declare any data members. According to the implementation of TObject.ClassType, the first 4 bytes can be explained as a pointer to the object's TClass metadata. Anyone know what the other 4 bytes of overhead are there for? EDIT: Apparently this is specific to D2009. In older versions...

min heap in python

Hi - I'd like to store a set of objects in a min heap by defining a custom comparison function. I see there is a heapq module available as part of the python distribution. Is there a way to use a custom comparator with this module? If not, has someone else built a custom min heap? Thanks, SetJmp ...

Flex 3 sorting object fields

i have an object in actionScript3 code which i need to sort, i iterate through the object and print out each value for (var i:String in columnData) { however i need the data im iterating to be sorted aplhabetically. any suggestions on how to do this? ...