1-which is the parameter that is added to every non-static member function when it is called?
2-what is an adaptor class or wrapper class?
3-what is a non object when can you tell that a memory leak will occur?
4-what is a parameterized type?
I have a function foo(i) that takes an integer and takes a significant amount of time to execute. Will there be a significant performance difference between any of the following ways of initializing 'a':
a = [foo(i) for i in xrange(100)]
,
a = map(foo, range(100))
, and
vfoo = numpy.vectorize(foo)
vfoo(range(100))
? (I don't care whether the output is a list or a numpy array).
Is there some other better way of doing this?
Thanks.
Hello All,
I am creating a pop up window. After I am finished with the work on child(pop up) window and click close button, i need to call a javascript function of the parent window. How can I achieve this.
I am not creating the child window myself but displaying the contents of some other url.
I have a char array with data from a text file and I need to convert it to hexadecimal format.
Is there such a function for C language.
Thank you in advance!
I am attempting to code some plugins to use with MIDI sequencers but have hit a stumbling block. I can't use global-scope variables to store information because multiple instances of the .dll can exist which share memory.
How do I create a class (for re-usability purposes in other plugins) containing 2 dimensional array and other variables the content of which is to be shared between functions? If that is possible, how would I read and write the data from the function in the framework where I do the processing?
Find the errors from following C function :
char* f(int i) {
int i;
char buffer[20];
switch ( i ) {
1: strcpy( buffer, "string1");
2: strcpy( buffer, "string2");
3: strcpy( buffer, "string3");
default:
strcpy(buffer, "defaultstring");
}
return buffer;
}
this is c funtion not C++, I think it has to do with type conversion
my compiler give warning that declaration of int i shadows a parameter.
I'm trying to setup something like Aspect Oriented Programming in Actionscript 3, basically the only thing I need to be able to do is something like this:
SomeClass.getMethod("methodName").addEventListener(afterMethodExecuted, function() {
//run code
});
This way I can run code after (or before) any method in any class has run, allowing numerous new possibilities.
How should I implement this?
hi i'am begginer in pYthon and openerp , i want to call a function exists in another class
for example:
i have 2 class :
class a:
def notif_personne_event(self, cr, uid,ids,context=None):
and
import a
class b:
notifier(self, cr, uid,ids,context=None):
self.notifiernotif_personne_event()
but when i do this an error is displayed telling me that class b have not an attribute notifiernotif_personne_event()
someone help me please
I am learning about pmap and wrote the following function:
(pmap #((println "hello from " (-> (Thread/currentThread) .getName))
(+ %1 %2))
[1 1 1] [-1 -1 -1])
When run, the result is a NullPointerException
(hello from clojure-agent-send-off-pool-4
hello from clojure-agent-send-off-pool-3
hello from clojure-agent-send-off-pool-5
NullPointerException user/eval55/fn--56 (NO_SOURCE_FILE:11)
Why is this happening? I have understood and observed the body of a fn to be an implicit do.
I saw a delayed example in David Pollak's "Beginning Scala". I tried to adapt that, by trial and error. Here's what I have:
def sayhello() = {
println("hello")
}
def delaying(t: => Unit):Unit = {
println("before call")
t
println("after call")
}
delaying(sayhello())
How would you delay a function/method that takes parameters? Why can't I use parantheses when I call t? Where can I find more documentation on delaying functions?
I'm trying to override the behavior of an external function in user32.dll because I don't want a certain window to show up.
What I'm trying to do is this:
[DllImport("user32.dll")]
public extern override IntPtr GetSystemMenu(IntPtr hMenu, bool bRevert)
{
return new IntPtr();
}
but this won't work because I get the following errors:
... no suitable method found to override
and
... cannot be extern and declare a body
Is there any way to simulate what I'm trying to do?
Trying to optimize my MUI 2 NSIS setup in which I do some ExecWait calls in the .onInstSuccess callback function, I was searching through the documentation to find a callback that is called:
after the files are all copied -and-
before the wizard page is being switched from the file copy page to the finish page.
Unfortunately, I found no such callback.
Therefore my question is:
Is it possible to do some custom processing after the files are copied and before the wizard page is being switched away from the file copy page?
I want to find that when a user fires an event, such as click a button, what function(s) does this event invoke in run-time? Would it be possible?
Thanks!
I have some code that I am porting from an SGI system using the MIPS compiler. It has functions that are declared to have double return type. If the function can't find the right double, those functions return "NULL"
The intel C compiler does not like this, but I was trying to see if there is a compiler option to enable this "feature" so that I can compile without changing code. I checked the man page, and can't seem to find it.
Thanks
It's easy to create a new name for a type, a variable or a namespace. But how do I assign a new name to a function? For example, I want to use the name holler for printf. #define is obvious... any other way?
Solutions:
#define holler printf
...
<?php
function register_template(){
print_r(func_get_args());
# the result was an array ( [0] => my template [1] => screenshot.png [2] => nice template .. )
}
register_template( # unkown number of arguments
$name = "my template",
$screenshot = "screenshot.png",
$description = "nice template .. "
)
?>
BUT , I want the result array as $key = $value form , $key represents the parameter name.
I am trying to stop the default mouse wheel event that is called on the window and on a div and call my own function instead on the div. I need this to be cross-browser (without the use of a library. I know I need to use an eventListener and I think have to use both onmousewheel and DOMMouseScroll (for FF) but I think am getting caught up in the implementation somewhere.
I appreciate any and all help.
eg I have two concurrent AJAX requests, and I need the result from both to compute a third result. I'm using the Prototype library, so it might look something like this:
var r1 = new Ajax.Request(url1, ...);
var r2 = new Ajax.Request(url2, ...);
function on_both_requests_complete(resp1, resp2) {
...
}
One way would be to use polling, but I'm thinking there must be a better way.
I have a data structure containing a list of objects, like this:
class A {
private List<Object> list;
}
How to properly define a hash function for the list, assuming each element of the list has correct hashCode()?
(It's strange that I couldn't easily find the solution via Google.)
This is my first time. I will appreciate any thoughts, tips, and what not. How can I improve this? Ultimately, I don't want so many selects in my script.
function mysqlSelectCodes($table,
$where, $order, $limit) { $sql =
"SELECT * FROM $table WHERE $where
ORDER BY $order LIMIT $limit" or
die(mysql_error());
}
The Python documentation specifies that is is legal to omit the parentheses if a function only takes a single parameter, but
myfunction "Hello!"
generates a syntax error. So, what's the deal?
(I'm using Python 3.1)
In Javascript, when is a new scope created? The 2 situations I know of are:
with a new function
in a "with" statement
as a note, any new block (in if-then-else, loops, or just beginning a block for no other reason) won't create a new scope.
Is there a third situation where a new scope is created besides the two situations above? Thanks.
How to sort a map(?,B) on the values in Java with google collections ordering function, if B is a class, which has a field of type double, which should be used for ordering.