function

Is it possible to call a JavaScript function using an array of values as arguments ?

I'm looking for another way of doing the following: function call_any_function(func, parameters){ // func => any given function if(parameters.length==0){ func(); } if(parameters.length==1){ func(parameters[0]); } if(parameters.length==2){ func(parameters[0], parameters[1]); } if(parameters.length==3){ fun...

Asterisk with new functions

hi all , please need help for an asterisk with windows I created a write func odbc list records files in sql table: [R] dsn=connector write=INSERT INTO ast_records (filename,caller,callee,dtime) VALUES ('${ARG1}','${ARG2}','${ARG3}','${ARG4}') prefix=M and set it in dialplan : exten => _0X.,n,Set( M_R(${MIXMONITOR_FILENAME}\,${CU...

functions inside or outside jquery document ready

Up until now I just put all my jQuery goodness inside the $(document).ready() function, including simple functions used in certain user interactions. But functions that don´t require the DOM document to be loaded or are only called afterwards anyway, can be placed outside the $(document).ready() as well. Consider for example a very sim...

Access Expression problem: it's too complex, so how do I turn it in to a function?

Access 2007 is telling me that my new expression is to complex. It used to work when we had 10 service levels, but now we have 19! Great! I've asked this question in SuperUser and someone suggested I try it over here. Suggestions are I turn it in to a function - but I'm not sure where to begin and what the function would look like. My e...

Function allocation

Where are functions stored in a C++ program? For example int abc() { //where am I stored? } I know that we can take the address of a function, that means functions are stored somewhere in memory. But I have already read at many places that no memory allocation for functions takes place. I am confused. My question may seem vague...

Javascript get Function Name?

How can I access a function name from inside that function? // parasitic inheritance var ns.parent.child = function() { var parent = new ns.parent(); parent.newFunc = function() { } return parent; } var ns.parent = function() { // at this point, i want to know who the child is that called the parent // ie } var obj = n...

How do you control what your C compiler Optimizes?

I am writing the firmware for an embedded device in C using the Silicon Labs IDE and the SDCC compiler. The device architecture is based on the 8051 family. The function in question is shown below. The function is used to set the ports on my MCU to drive a stepper motor. It gets called in by an interrupt handler. The big switch statemen...

How do I combine 2 prewritten Javascript functions

Would I want to nest one function into another? ...

What is a RECURSIVE Function in PHP?

Can anyone please explain a recursive function to me in PHP (without using Fibonacci) in layman language and using examples? i was looking at an example but the Fibonacci totally lost me! Thank you in advance ;-) Also how often do you use them in web development? ...

JavaScript using toString on a Function object to read text content

Calling toString() on the function below returns different strings across browsers. I understand this is because ECMA-262 15.3.4.2 leaves wiggle room for each vendor. Chrome returns the comments in addition to all syntax. Sadly Firefox 3.6 omits the comments. Based on Firefox's behavior I haven't tested IE, Opera, or Safari. functio...

Difference between a virtual function and a pure virtual function

Possible Duplicate: C++ Virtual/Pure Virtual Explained Hi, Need to know what is the difference between a pure virtual function and a virtual function? I know "Pure Virtual Function is a Virtual function with no body" but what does this mean and what is actually done by the line below virtual void virtualfunctioname() = 0 ...

Jquery addClass on radio box checked.

I checked all the topics, but i simply don't know why my script does not work :( <script type="text/javascript"> $('input[name=pic]').click(function() { $(this).closest('ul').find(".green").removeClass("green"); if($(this).is(':checked')) { $(this).closest('ul').find("li").addClass('green'); } }); </scri...

Cython code doesn't work

I wrote some Python code and it worked fine when using the "python". I then converted it to C using "Cython" and used distutils to compile it to a shared library. I then changed some of the code to Cython so it would run faster. But when I imported the .so module and tried to use the command I had "cdef"ed it said that the command didn't...

Why doesn't javascript function aliasing work?

I have some Firebug console function calls that I wanted to disable when Firebug wasn't enabled, e.g. console isn't defined. This works fine in IE6 and FF3, but not in Chrome: var log; if(console){ log = console.log; }else{ log = function(){ return; } } I get an "Uncaught TypeError: Illegal Invocation" in Chrome =/ I read about ...

access variables of other functions

hi, in python, how can i access the variables of one function into another function, is it possible, i tried the global variable method but that doesn't work for me. can someone help me, how to access the variables from one function to another function. ...

Can a function return an object? Objective-C and NSMutableArray

I have an NSMutableArray. It's members eventually become members of an array instance in a class. I want to put the instantiantion of NSMutable into a function and to return an array object. If I can do this, I can make some of my code easier to read. Is this possible? Here is what I am trying to figure out. //Definition: function Obje...

Overwriting a core Wordpress function - should work but it doesn't

I'm trying to overwrite a core Wordpress function (found in media.php) using add_filter() in my theme's functions.php file. This should work accord to the blogs that I've come across, but for some reason I see no change whatsoever. #override what WP is trying to do to scaling images by default function my_image_hwstring($width, $height)...

posmax: like argmax but gives the position(s) of the element x for which f[x] is maximal

Mathematica has a built-in function ArgMax for functions over infinite domains, based on the standard mathematical definition. The analog for finite domains is a handy utility function. Given a function and a list (call it the domain of the function), return the element(s) of the list that maximize the function. Here's an example of fin...

Jquery: Calling functions from different documents

Hi, I've got some Jquery functions that I keep in a "custom.js" file. On some pages, I need to pass PHP variables to the Jquery so some Jquery bits need to remain in the HTML documents. However, as I'm now trying to refactor things to the minimum, I'm tripping over the following: If I put this in my custom.js: $(document).ready(functi...

How can I take any function as input for my Scala wrapper method?

Let's say I want to make a little wrapper along the lines of: def wrapper(f: (Any) => Any): Any = { println("Executing now") val res = f println("Execution finished") res } wrapper { println("2") } Does this make sense? My wrapper method is obviously wrong, but I think the spirit of what I want to do is possible. Am I right...