function

C++ Function Calling Itself

Question I wish to know if this is a viable way to implement variable depth recursion so that I can run a function at each step and any better/other solutions to the description problem. Description Suppose I wish to have a function that fills an array either in pattern x,y,x,y,x,ywhere x and y are variables defined by some algorithm and...

invoking yield for a generator in another function

suppose I have some manager object. This object's API has a main_hook function, that gets another function f as it's argument, and runs the given f in a loop, doing some stuff in between each iteration: def main_hook(self,f): while (self.shouldContinue()): #do some preparations f(self) #do some tear down No...

What is the purpose of the intial function in a PHP class which has the same name as the class?

So I am getting started with OO PHP, and after reviewing a variety of classes which I have downloaded from the internet, I have noticed that some - but not all of these classes have an intial function with the same name e.g. class MyClass{ function MyClass{ //function contents in here } function otherfunction{ //more stuff here } ...

Can a PHP function accept an unlimited number of parameters?

In PHP there are functions like unset() that support any number of parameter we throw at them? So, I want to create a similar function that is capable of accepting any number of parameters and process them all. Any idea, how to do this? ...

Get name of function

Hello, are there any ways to get function signature/name from it's pointer? Like: void test(float data) {} cout << typeid(&test).name(); I wan't to use this data for logging. ...

unsigned _stdcall.... implicitly an int??

A function with this signature: unsigned _stdcall somefunction (LPVOID lParam); does it mean that it implicitly returns an integer? As unsigned really isn't a value by itself? And _stdcall is a calling convention.... ...

str_shuffle() equivalent in javascript ?

Hello, Like the str_shuffle() function in PHP, is there a function similar in shuffling the string in javascript ? Please help ! ...

MATLAB how to use FIND function with IF statement

This question is related to http://stackoverflow.com/questions/3071558/matlab-how-to-merge-data how to use the FIND function with IF statement? e.g. if I have this data: 20 10 1 20 11 1 20 15 1 23 10 1 23 10 1 23 12 0 Rule 1: Data of column 3 must be 1. Rule 2: If n is the current index of column 1, if n equal n-1 (20=2...

MySqlCommand call function

I am using the MySQL Connector. using (MySqlConnection connection = new MySqlConnection("...")) { connection.Open(); MySqlCommand command = new MySqlCommand(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "FN_NEW"; command.Parameters.AddWithValue("P_SES...

Why does this work?

hi, I have just been working with boost::bind and boost::function and noticed the following behaviour (which I thought was a bit odd). You can bind a function with fewer parameters than required by the boost::function type! It appears as though any additional parameters are simply ignored and just fall away. So why is this behaviour co...

how to use two function at the same time?

hi im new to delphi. how to use the two function at the same time? function a(...):integer; function b(...):integer; because b waits until a is finshed. ...

How to call a shared function which its name came as a parameter

In a method, I want to call a shared function which its name came as a parameter. For example: private shared function func1(byval func2 as string) 'call func2 end function How can i do it? ...

(Embedded) C: void function() or #define FUNCTION()

Hi, im programming embedded devices and I was wondering what to use for a macrofunction, for example an init of some registers. should i make this static/const or define it as a macro? for example, this: #define FPGA_INIT()\ { \ /* Set function and direction of start_code pin*/\ P0SEL &= ~0x04; \ P0DIR |= 0x04; \ FPGA_START_CO...

get object from a method in as3

Hi, Is there a way to know from which object a method (a Function object) came from? tx ...

javascript / jquery - setting (this) in a function...

Hey all. Basically, I need "(this)" in my function to correspond to this selection: $(".widget .portfolio img") But I want alternative ways of running this function, one when it is cilcked, and one in intervals, like this: function cycle() { var poo = $(this).attr("id"); $(".poo").html(poo); } $(".widget .portfolio img").cli...

function templates with class template typedef arguments

Hi, the following code is an example of something I'm trying to do in a large project: #include <iostream> #include <vector> // standard template typedef workaround template<typename T> struct myvar {typedef std::vector<T> Type;}; template<typename T> T max(typename myvar<T>::Type& x) // T max(std::vector<T>& x) { T y; y=*x.begin(...

Determine the frequency of occurrence in XQuery

Hi, does anybody know a way of determining the number of times in which a particular value occurs in a sequence, with XQuery. Thanks in advance ...

How do I tell jQuery to run a function on one specific web page only?

I have some jQuery code that is on every web page of the site (in the head element). What selector syntax can I use to tell jQuery that a certain function should only run on one page and not all the other pages on the site? Can I specify a page name or URL in the selector somehow? Many Thanks ...

Passing row of static 2-d array to function in C++

This is a really elementary question. Nonetheless, I haven't found a solution after studying dozens of semi-relevant examples online. I have a two-dimensional array of doubles whose size is known at compile time: double demPMFs[ NUM_DEM_PARAMS ][ NUM_AGE_CATEGORIES ]. Array entries are populated by input files early in the program. I'd ...

How to fix this WordPress function so that it doesn't return a 404 page?

I have the following function that I've added to my functions.php file in WordPress. The idea is that it gathers all of the titles of 'fsmodel' posts (a custom post type that I've created). It then returns these as an array, which I then use to populate a select tag in the custom meta fields for a second custom post type. Basically, 'fs...