function

jQuery function calling

hi, I've got 2 jQuery functions. One calls the other (in theory...). These are: $.testFunction = function(arg1){ alert("testFunction(arg1)"); $.testFunction(arg1, ""); } $.testFunction = function(arg1, arg2){ alert("testFunction(arg1, arg2)"); alert("arg1: " + arg1 + "\narg2: " + arg2); } I've got two functions, beca...

Execute JavaScript function from object

Hi all, Is it possible to execute function this way: this.values(value); not this.values[value](); this.values[value].call(); If so, how? Or any other methods? Thank you. Here is my code: write: function(value) { this.values = { "red": function() { /* do something */ }, "orange": function() { /* do something */ }, ...

How to write a method for a JQuery plugin?

Hi all, I've written a fairly basic jQuery plugin that takes an unordered list and creates a nice looking multi-selectable list. Calling it 'multiSelector', the plugin declaration looks like this: jQuery.fn.multiSelector = function(options) { // plugin code } The plugin actually runs on a containing div with an unordered list ins...

Python passing list as argument.

If i were to run this code: def function(y): y.append('yes') return y example = list() function(example) print(example) Why would it return ['yes'] even though i am not directly changing the variable 'example', and how could I modify the code so that 'example' is not effected by the function? ...

what is the difference between function declaration and signature?

In C or C++ what is the difference between function declaration and function signature? I know something of function declaration but function signature is totally new to me. What is the point of having the concept of function signature? What are the two concepts used for actually? Thanks! ...

Combining jQuery Sortable and Drop Event

Basically I have a draggable list which is connected with a sortable list. Works great except I need some sort of Drop event which I can use to change the list item after its dropped into the sortable list. This works with .draggable -> .droppable but is there a fix for draggable -> .sortable? ...

PHP How to check if you can afford it?

Hello. I have this: $scCost = $row["gpsc"]; mysql_query(" UPDATE member_profile SET points = points-$scCost WHERE user_id = '".mysql_real_escape_string($userid)."' ") or die(mysql_error()); That takes do the user´s points - scCost. How do i check if the user can afford it or not? So, if the user...

Analyze every function I call

Hy guys. I want to analyze the result of each function that I call. If this result is a exception or is false then the script ends. I can do this manually, but it is a big waste of time to call a control function for each new function. Something like this: http://codeviewer.org/view/code:c5c Can I configure PHP to set this error ...

'static' for c++ class member functions?

Why is the static keyword necessary at all? Why can't the compiler infer whether it's 'static' or not? As follows: Can I compile this function without access to non-static member data? Yes -> static funcion. No -> non-static function. Is there any reason this isn't inferred? ...

how to convert decimal points?

i have value of 1.564 and 1.565 i need round this value to 1.56 and 1.56,which function suitable for this in c#. ...

Passing strings to C functions with SAS proc proto

I've been poking my nose in extending SAS string handling with some C functions such as a longest common substring algorithm. The proc FCMP functions get easily pretty inefficient. The embedded C compiler in proc proto doesn't seem to produce the results I expect after writing the algorithm in Visual Studio. One thing I think I have ver...

Javascript: Get access to local variable or variable in closure by its name

Hi all. We all know that you can access a property of a javascript object by it's name using the [] syntax.. e.g. ob['nameOfProperty']. Can you do the same for a local variable? Another answer here suggested the answer is to use window['nameOfVar']. However, this only worked for the poster as he was defining variables at window-level ...

Calling function in other Class not working

Hey everyone, not sure what is going on here :( Basically I have a function that is needs to tell 2 other classes to do something. It works for one of the classes: BigPlayButton, but not Background for some reason. TabMenu.as Class function Note: The function below WILL call the hitPlayCircle function in my BigPlayButton class, but I ...

Default value for boost::function argument?

I've got a function that I want to take an optional boost::function argument as a callback for reporting an error condition. Is there some special value I can use a the default value to make it optional? For example, with a regular function pointer I can do: void my_func(int a, int b, t_func_ptr err_callback=NULL) { if (error && (...

How to extract numeric values from a string in SQL Server

I have a string in a SQL Server table whose format is like this... nvarchar int nvarchar int nvarchar There are no obvious delimiters other than some chars are numeric and others are alpha. How do I reference the second int value? ...

Boost::function error ambiguous overload for ‘operator[]’

The full error I'm getting is this: error: ambiguous overload for ‘operator[]’ in ‘a[boost::_bi::storage4<A1, A2, A3, boost::arg<I> >::a4_ [with A1 = boost::_bi::value<MsgProxy*>, A2 = boost::arg<1>, A3 = boost::arg<2>, int I = 3]]’ It references line 116 of a class I have, which is the boost::bind call in this function: // Dis...

Using input to call a member function

Is it possible to use Input to call a member function? void one() { } cout << "enter input:" << endl; cin >> input; //where input is "one" instance.input() ...

Python: passing a function with parameters as parameter

def lite(a,b,c): #... def big(func): # func = callable() #... #main big(lite(1,2,3)) how to do this? in what way to pass function with parameters to another function? ...

PHP Fatal error: Using $this when not in object context

Hello Everybody, I've got a problem: I'm writing a new WebApp without a Framework. In my index.php im using: require_once('load.php'); and in * load.php* I'm using require_once('class.php'); to load my class.php. In my class.php I've got this error: Fatal error: Using $this when not in object context in class.php on line ... (in t...

C++: Any way to 'jail function'?

Well, it's a kind of a web server. I load .dll(.a) files and use them as program modules. I recursively go through directories and put '_main' functors from these libraries into std::map under name, which is membered in special '.m' files. The main directory has few directories for each host. The problem is that I need to prevent usa...