function

How can I rename (or even remove?) buddypress' wire-section?

I am currently setting up an online community for the first time. I am a frequent worpress user, yet this one problem occurs: I don't like the section name "wire". I'd much rather use something like "guestbook" or "short note" for it, but I cannot find the place to change it in the backend. It is not in the theme's CSS editor. Same goe...

`new function()` with lower case "f" in JavaScript

My colleague has been using "new function()" with a lower case "f" to define new objects in JavaScript. It seems to work well in all major browsers and it also seems to be fairly effective at hiding private variables. Here's an example: var someObj = new function () { var inner = 'some value'; this.foo = 'blah'; ...

Why can one specify the size of an array in a function parameter?

I don't understand why the following example compiles and works: void printValues(int nums[3], int length) { for(int i = 0; i < length; i++) std::cout << nums[i] << " "; std::cout << '\n'; } It seems that the size of 3 is completely ignored but putting an invalid size results in a compile error. What is going on here?...

php class function -> call the function according to a passing parameter

Hi, I have a class 'abc', with several functions inside it: 'abc_function1' 'abc_function2' 'abc_function3' 'abc_function4' 'abc_function5' I would like to call a function of the class 'abc' according to a parameter that I enter, a string containing 'function1' or 'function 4' for example, to refer to the corresponding function of the ...

Transform text in OpenOffice.org Spreadsheet

I have list of text that contain double quoate and upderscore. How can I use function to change text pattern to following format. "CUSTOMER_DETAIL" to CustomerDetail "PERSON" to Person "CUSTOMER_ADDRESS_DETAIL" to CustomerAddressDetail Thank you for replay. ...

Python: Do (explicit) string parameters hurt performance?

Suppose some function that always gets some parameter s that it does not use. def someFunc(s): # do something _not_ using s, for example a=1 now consider this call someFunc("the unused string") which gives a string as a parameter that is not built during runtime but compiled straight into the binary (hope thats right). The que...

Is this valid standard c?

I am reviewing some optimisation libraries and came across the function signature double solvopt(unsigned short n, double x[], double fun(), void grad(), double options[], double func(), void gradc() ) note that fun() and gard() are passed as function. My q...

How to replace 2 strings (with eachother) simultaneously in PHP

What I'm trying to do is very simple, but I'm looking to do it most efficiently, preferably using php builtin fns. $str = '1234'; echo replace_function(array('1','3'),array('3','1'),$str); // output: 3214 str_replace,preg_replace would result in 1214, which means it goes through the arrays, replacing matched strings. I'm looking for ...

Creating a function from string which inherits the parent scope

In Javascript, is there a way to create a function from a string (such as through the new Function() constructor) and have it inherit the parent scope? For example: (function(){ function yay(){ } var blah = "super yay" yay.prototype.testy = new Function("alert(blah)") yay.prototype.hello = function(){alert(blah)} ...

why does c++ have its separate syntax for new & delete?

Why can't it just be regular function calls? New is essentially: malloc(sizeof(Foo)); Foo::Foo(); while delete is Foo:~Foo(); free(...); So why does new/delete end up having it's own syntax rather than being regular functions? ...

The behavior of a C compiler with old-styled functions without prototypes

When my program consists of two files: main.c #include <stdio.h> int main(void) { printf("%lf\n",f()); return 0; } func.c double f(int a) { return 1; } compiler do not show any errors. When my program consists of only one file: main.c #include <stdio.h> int main(void) { printf("%lf\n",f()); retur...

How to call value of variable which is in one function to another function in as 3.0

I have taken variable in one function and want to use that value in another function. Please give me example... ...

how to create a loop in a function with another function?

Thanks for the help guys ...

PostgreSQL Conditional selects

I have written a recursive function and depending on the output I need to select different fields. My question is now, how can I do this multiple times without having to call the function more then once? What I'm doing right now is just using the CASE WHEN... condition and checking every time what the functions return. (This is only a ps...

PHP - Access a function from another class...

How can I access function b from within function a? This is what I have so far, and I'm getting this error: PHP Fatal error: Call to undefined method a::b() class test { function a($x) { switch($x) { case 'a'://Do something unrelated to class test2 break; case 'b': $this->b(); break; } } } ...

How pass a list of values to compare in a SQL Function in SQL Server 2008?

I have an SQL Function with the following SQL within: SELECT StockID FROM (SELECT DISTINCT StockID, ROW_NUMBER() OVER(ORDER BY DateAdded DESC) AS RowNum FROM Stock WHERE CategoryCode LIKE @CategoryID) AS Info WHERE RowNum BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) - 1 I have a Parameter @CategoryID - however I need to...

Best practices for an API in PHP : functions, or classes ?

Hi, In my company we have developped some applications. We have to create an API for one application (say application A), so that the others can use it (an its data). The question is : we already have developped PHP classes for the model of Application A, if we want to create an API, should we : - re-use these classes (too much functio...

Silveright calling javascript issue?

I'm calling out to javascript from a SL component using the HtmlPage.Window.Invoke api, when I call a javascript function defined in the page (html) it executes as expected, e.g. HtmlPage.Window.Invoke("publishValue", topic, jsonObject); But when I place the javascript function in a *.js file it is failing to execute the method even t...

Fun with Lambdas

Not having them used them all that much I'm not quite sure all that lambdas/blocks can be used for (other than map/collect/do/lightweight local function syntax). If some people could post some interesting but somewhat understandable examples (with explanation). preferred languages for examples: python, smalltalk, haskell ...

php private mysql connection

I have 2 functions, the function get_user_info() which connects to a db called 'users', and another, called print_info() which connects to a db called 'blah'. I call get_user_info() inside print_info(), so it can retrieve the information. They connect to 2 different databases and make 2 different connections, i use another function to co...