function

Export function lists (with parameters) from lots of C files

Dear all: I have an old VC 6.0 project with lots of C files. I need to document all the methods with their signatures, for example, listed them in a txt file like: LoadTranCde(LKFD lkfd, char * msg, char * code) MoveBack(LPT lStm, int numRows) RTrim(Char * paraString) .... The function list can be easily viewed in Visual Studio clas...

Python: return the index of the first element of a list which makes a passed function true

the list.index(x) function returns the index in the list of the first item whose value is x. is there a function, list_func_index(), similar to the index() function that has a function, f(), as a parameter. the function, f() is run on every element, e, of the list until f(e) returns True. then list_func_index() returns the index of e. ...

How to capture a string into variable in a recursive function?

I tried to print all the possible combination of members of several vectors. Why the function below doesn't return the string as I expected? #include <iostream> #include <vector> #include <fstream> #include <sstream> using namespace std; string EnumAll(const vector<vector<string> > &allVecs, size_t vecIndex, string strSoFar) {...

Private member function that takes a pointer to a private member in the same class

How can I do this? (The following code does NOT work, but I hope it explains the idea.) class MyClass { .... private: int ToBeCalled(int a, char* b); typedef (MyClass::*FuncSig)(int a, char* b); int Caller(FuncSig *func, char* some_string); } I want to call Caller in some way like: Caller(ToBeCalled, "stuff"...

Visual C++ saying void function needs to return a value

Visual C++ is saying my void function needs a return value I compiled this on my mac, and it worked perfectly, but now I am trying to compile this with Visual c++ (using windows 7) Heres the build log: Command Lines Creating temporary file "c:\Users\Jonathan\Documents\Visual Studio 2008\Projects\magicsquare\Debug\RSP000008229...

MySQL date_add() how to use month into this?

Hallo all, i have this SQL SELECT DATE_ADD( '2009-'+ MONTH( NOW() ) +'-01' , INTERVAL -1 MONTH ); i can't get it to work, what i make wrong here? tanks for help. ...

Python 3 Function List

I've just started learning Python and would like to know if there is a searchable list of Python (3.1) functions available online, like there is for PHP (php.net)? Thanks. ...

Pass a set function as an argument

Hi, How can I pass a 'set' function as the Function Object argument of another function? eg: public class IdModel { private var _id:String; public function IdModel(source:Source) { //Create Binding BindingUtils.bindSetter(id,source,"id"); } public function get id():String { return _id;...

Assigning an array element to a variable with the same name?

I'd like to be able to extract some array elements, assign each of them to a variable and then unset these elements in the array. Let's say I have $myarray = array ( "one" => "eins", "two" => "zwei" , "three" => "drei") ; I want a function suck("one",$myarray)as a result the same as if I did manually: $one = "eins" ; unset($myarray...

AppleScript: Index of substring in string

I want to create a function that returns a substring of a specific string from the beginning of said string up to but not including the start of another specific string. Ideas? So something like: substrUpTo(theStr, subStr) so if I inputted substrUpTo("Today is my birthday", "my"), it would return a substring of the first argument u...

Problem with Jquery live-based function

Hi! I am currently dynamically adding content to the page with the help of Jquery. The content that is being added contains some input fields and I need to use some kind of form hint/helper plugin on those. I have tried this one, but i have no idea how to set it up correctly: http://mucur.name/system/jquery%5Fexample/ whilst dealing wi...

Ignore data within a certain set of characters with PHP

Not sure what this is called, but is there a way I can pull data from a file, echo it, but ignore data within a certain set of characters? <?php echo file_get_contents('test.txt'); ?> Would it be possible to ignore the data in between the asterisks, and the asterisks themselves when I echo out the final function? ...

array of pointers as function parameter

I have a basic question on array and pointer in C/C++. Say I have: Foo* fooPtrArray[4]; How to pass the fooPtrArray into a function? I have tried: int getResult(Foo** fooPtrArray){} // failed int getResult(Foo* fooPtrArray[]){} // failed How can I deal with pointer array? EDIT: I once thought the error msg is from passing the...

taking java method names as function arg in clojure

All, I want to create a function that takes a symbol representing a java method and applies it to some object: (user=> (defn f [m] (. "foo" (m))) When I execute this, I get a result much different from what I expect user=> (f 'getClass) java.lang.IllegalArgumentException: No matching method found: m for class java.lang.String (NO_SO...

How can Java inline over virtual function boundaries?

Hi all, I'm reading up some material on whether Java can be faster than C++, and came across the following quote: "Java can be faster than C++ because JITs can inline over virtual function boundaries." (http://www.jelovic.com/articles/why%5Fjava%5Fis%5Fslow.htm) What does this mean? Does it mean that the JIT can inline virtual functi...

What does the SBCL time function return?

I'm trying to time an order statistic function implemented in SBCL. Googling around I found this timing function: (time form). However I'm not sure what it returns. It seems to be a large number but I can't find documentation specifying if the return value is milliseconds, nanoseconds, system time, etc. Does anyone know? ...

Calling a JavaScript function named in a variable

I have a JavaScript variable which contains the name of a JavaScript function. This function exists on the page by having been loaded in and placed using $.ajax, etc. Can anyone tell me how I would call the javascript function named in the variable, please? The name of the function is in a variable because the URL used to load the page...

Patterns for declaring functions for greater readability

In C++ functions needed to be declared before they were called. This could be worked around with function signatures but for the most part this is no longer required in newer programming languages, C#, Python, ETC. However, while reading other peoples, code and when having to structure functions in a class, I find that I miss the consis...

PHP Calling a function within a Class method?

I have been trying to figure out how to go about doing this but I am not quite sure how. Here is an example of what I am trying to do: class test { public newTest(){ function bigTest(){ //Big Test Here } function smallTest(){ //Small Test Here } } publ...

Check if a string is an email address in PHP

I am trying to do an SQL query, but I need to check somehow if the value is an email address. I need a way to check if $user is an email address, because I have user values such as this in my table. test test2 [email protected] [email protected] test392 [email protected] and so on... I need to make it so $useremail checks $user to find...