function

List of functions references

Hello, I'm using boost::function for making references to the functions. Can I make a list of references? For example: boost::function<bool (Entity &handle)> behaviorRef; And I need in a list of such pointers. For example: std::vector<behaviorRef> listPointers; Of course it's wrong code due to behaviorRef isn't a type. So the ques...

Work with function references

Hello, I have another one question about functions reference. For example, I have such definition: typedef boost::function<bool (Entity &handle)> behaviorRef; std::map< std::string, ptr_vector<behaviorRef> > eventAssociation; The first question is: how to insert values into such map object? I tried: eventAssociation.insert(std::pair...

How to pass function reference into arguments

Hi, I'm using boost::function for making function-references: typedef boost::function<void (SomeClass &handle)> Ref; someFunc(Ref &pointer) {/*...*/} void Foo(SomeClass &handle) {/*...*/} What is the best way to pass Foo into the someFunc? I tried something like: someFunc(Ref(Foo)); ...

Bash/shell script - shell output redirection inside a function

function grabSourceFile { cd /tmp/lmpsource wget $1 > $LOG baseName=$(basename $1) tar -xvf $baseName > $LOG cd $baseName } When I call this function The captured output is not going to the log file. The output redirection works fine until I call the function. The $LOG variable is set at the top...

VB.NET Why won't my Function return an array?

Hi, I'm trying to write a function that returns an Array that I can pass into a String.Format: Public Function ToArray() As Array Dim vals As New ArrayList() vals.Add(Me("district")) vals.Add(Me("county")) vals.Add(Me("route")) vals.Add(Me("section")) vals.Add(Me("beg_logmile")) vals.Add(Me("end_logmile")) ...

PHP: Collect all variables passed to a function as array?

Hi everybody, I was thinking about the possibility of accessing all the variables that are passed into an function, and merge them into an array. (Without passing variables into an array from the beginning) Pseudo-code: // Call function newFunction('one', 'two', 'three' ) ;// All values are interpreted as a one rray in some way // Fu...

struct and arguments

I am trying to modularize a function that used to add values to multiple structures in one call. Now I want to do one value addition per call, but I am not sure how to make a less specific argument reference. func ( [?] *val ) { } ...

Passing a filepath to a R function?

Hi everybody, I tried to pass a filepath to a function in R, but I failed =/ I hope someone here can help me. >heat <- function(filepath) { chicks <- read.table(file=filepath, dec=",", header=TRUE, sep="\t") ... } When I call the function, nothing happens... >heat("/home/.../file.txt") ... and "chicks" is not found >chicks Error...

jquery ready function: script not detecting a function

There is a web page with place holder (a normal div). Via ajax calls I am loading a <form> and a <script> into the place holder. The script contains necessary javascript to initialize the form (i.e. for e.g. disable the controls so as to make form read-only, etc). Here is a piece of code I have; it works, but the commented part doesn't w...

php function output ina table row... how?

I want to run this function but show the result in a table row strlen($cat_row['sms'] This is what i came up with but it is not working: echo "<tr><td bgcolor=#626E7A>".**strlen($cat_row['cars']**."</td></tr>"; How do you show result of a php function in a table row? i am trying to format the output some how. please help ...

c++ Function pointer inlining

I know I can pass a function pointer as a template parameter and get a call to it inlined but I wondered if any compilers these days can inline an 'obvious' inline-able function like: inline static void Print() { std::cout << "Hello\n"; } .... void (*func)() = Print; func(); Under Visual Studio 2008 its clever enough to get it dow...

Calling multiple functions sequentially with jquery.

I want to loop through an object that contains functions which will execute one after another. My most ideal approach would be to have these chain somehow (ie. func2 waits for func1 and func3 waits for func2) but this needs to happen dynamically and the functions will all have different durations. I'm using jQuery so I thought that per...

Read/Write operation on Fat table with out using System.IO in C#

Hi i am new to the system programming...i want to read information from fat table like total sector,total physical drive,containing logical drive types and as well containing files in the drives(like their file size,when accessed)with all information of files..and then display of these files with respect of their hierarchy at GUI. this ...

PHP: Check if URL redirects?

Hi everybody, I have implemented a function that runs on each page that I want to restrict from non-logged in users. The function automatically redirects the visitor to the login page in the case of he or she is not logged in. I would like to make a PHP function that is run from a exernal server and iterates through a number of set URL...

Jquery function doesn't work (with smarty).

Hi! I can't find whats the wrong with this script. Please help me! {elseif $text[i].text == "%SubPages"} <!-- js--> {literal} <script type="text/javascript"> $(function(){ $("#button_{/literal}{$text[i].id}{literal}").click(function(event) { event.preventDefault(); $("#settings_{/literal}{$text[i].id}{literal}").toggle(); }); $("#setti...

Forced naming of parameters in python

In python you may have a function definition: def info(object, spacing=10, collapse=1) which could be called in any of the following ways: info(odbchelper) info(odbchelper, 12) info(odbchelper, collapse=0) info(spacing=15, object=odbchelper) thanks to python's allowing of any-order argume...

to call a javascript function periodically

I want to call function with arguement periodically. I tried setTimeout("fnName()",timeinseconds); and it is working. But when I add an arguement it won't work. eg: setTimeout("fnName('arg')",timeinseconds); ...

Passing variables to functions

A quick question: When i pass a variable to a function, does the program make a copy of that variable to use in the function? If it does and I knew that the function would only read the variable and never write to it, is it possible to pass a variable to the function without creating a copy of that variable or should I just leave tha...

Best PHP xml2array function

I need a function that takes a string as XML input and change that into an array. Example: <a> <b> <c></c> </b> </a> So I can read it in PHP like this: $array = xml2array($xmlcode); echo $array['a']['b']['c']; Note: I tried all xml2array functions in PHP's documentation on xml_parse, and they all didn't work or had problems. ...

How to execute multiple succeeding functions in 1 line in Ruby?

I have two succeeding function with the same condition and I wonder what is the best way to write this? I know the one way to do this is using if (condition) ... end, but I'm wondering if I can do it in one-line similar to bash, '[$n == $value] echo "$n" && break'. n = 0 loop do puts n if n == value # puts and break is having the same...