object

return a function object with parameter binded?

All, def a(p): return p+1 def b(func, p): return func(p) b(a,10) # 11 here I do not want the result "11" actually, what I want is a function object with the parameter has been binded, let's name it c. when I use c() or something alike, it will give me the result 11, possible? Thanks! ...

javascript datastructure question

I have an array: myArray = []; To which I am adding objects: data = []; myArray.push( { elem1: ..., elem2: data.push(...); } ); So, elem2 in the object contains an array. How can I, given myArray add new elements to the array in elem2? I tried the following: myArray[idx].elem2.push("new data"); But got an error saying tha...

How do I convert an object to a custom string in javascript?

I want to overload the conversion of an object to a string, so that the following example would output the string "TEST" instead of "[object Object]". How do I do this? function TestObj() { this.sValue = "TEST"; } function Test() { var x = new TestObj(); document.write(x); } ...

Crash when use SQlite Persistence Object on iphone device

I use SQLite Persistence Object in my App. It's working well on simulator but when i deploy on the device. Sometime it's work, sometime not. My app often is crashed and i got:"Program received signal: “EXC_BAD_ACCESS”." on Debugger Console. In the Debugger i got: #0 0x3153311c in sqlite3_blob_write #1 0x31501b7c in sqlite3_os_end #2...

R: Call matrixes from a vector of string names ??

Hello Imagine I've got 100 numeric matrixes with 5 columns each. I keep the names of that matrixes in a vector or list: Mat <- c("GON1EU", "GON2EU", "GON3EU", "NEW4", ....) I also have a vector of coefficients "coef", coef <- c(1, 2, 2, 1, ...) And I want to calculate a resulting vector in this way: coef[1]*GON1EU[,1]+coef[2]*GON...

How to detect whether an object is ready in JS?

My web app includes an ActiveX control. However, when I run the app, I got error "object expected" error intermittently. It seems sometimes the control is not ready when I call its properties/methods. Is there a way that I can detect whether an object is ready using JS? Thanks a lot. ...

How to read web.config APP key settings in HTML markup

I have an ASP.NET site which uses a 3rd party activeX control. I have to pass a few parameters to the OBJECT tag in the HTML page. If i hardcode these parameters into the HTML everything works. I would like to place the parameters in my web.config with app settings "key/value" pairs. My problem is i cannot read the app key setting in ...

How to retrieve Object array value?

Hello, So the thing is that i'm new to OOP php and i seems can't find answer to how to retrieve specific value from Object array. So i run my request to the User class and method find_by_sql: $getAct = User::find_by_sql($sql); Response i get is: Array ( [0] => User Object ( [id] => 6 [permissions...

Check if a variable is a string

Hi there, I am currently using the isNaN function to check if my variable is a string or an object. I just wondered if this is the wrong way of doing it because it does not seem to be working. if(isNaN(element)) element = document.querySelector(element); At the moment even if element is an object it is still causing isNaN to retur...

How to Get query all the lists of a SharePoint site through Silverlight Client object model

Hi All, I have a requirement in which I have to show the number of documents uploaded by a user in all the lists and libraries in a SharePoint site in a Silverlight webppart. How much ever I try I keep getting the error "The property or field has not been initialized. It has not been requested or the request has not been executed. It...

Syntax choices for accessing child objects.

I'm wondering which is semantically and technically most optimal of my choices here. I've created a simple object registry class, but the method of object access has me wondering what's best. I'm currently using the first variation: //the Registry methods can chain, each returning a self reference $registry = Registry::getInstance()->re...

In what structure is a Python object stored in memory?

Possible Duplicate: How do I determine the size of an object in Python? Say I have a class A: class A(object): def __init__(self, x): self.x = x def __str__(self): return self.x And I use sys.getsizeof to see how many bytes instance of A takes: >>> sys.getsizeof(A(1)) 64 >>> sys.getsizeof(A('a')) 6...

How to get AOP-like object beforeConstruction hooks in Javascript properly?

Hi there, I'm trying to dynamically alter all objects in Javascript so that its construction can be hooked. This is what I've got now, which almost works properly: Function.prototype.beforeConstruction = function(newFunc) { var oldObj = this; var newObj = function() { newFunc.apply(this, arguments); oldObj.apply(...