I'm having a rather strange problem with zsh. When I start up my shell, everything - functions, environment vars, aliases, etc. - all work fine. I've created the following function and sourced it in zsh:
clean()
{
path=/tmp
for i in ${path}/*; do
echo $i
done
}
Running clean in the terminal works as expected, i...
I tried an example live below:
typedef struct point
{
int x;
int y;
} point;
void cp(point p)
{
cout<<p.x<<endl;
cout<<p.y<<endl;
}
int main()
{
point p1;
p1.x=1;
p1.y=2;
cp(p1);
}
The result thats printed out is:
1
2
which is what I expected. My que...
i have a set of data in excel and in one column is a estimate (number of weeks)
i want an excel formula to bucket it into
Small
Medium
Large
where if the value is 0 - 10 then put it Small. If the value is 10 - 20 put it in Medium, etc . . .
if there any elegant way of doing it besides having nested if statements all put together?
...
I know that if you write void function_name(int& a), then function will not do local copy of your variable passed as argument. Also have met in literature that you should write void function_name(const int & a) in order to say compiler, that I dont want the variable passed as argument to be copied.
So my question: what is the difference...
Hi,
dadasdf\sdasdasd\qazxbbjj\test.txt
Above is the string in cell A1 in excelsheet,I want to extract the last word from that cell.i.e,I want only test.txt,How can I acchive that using excel function.If it is acchived by declaring any variable then also help me out.
...
Hello!
In my form, my checkbox elements' name are onSite[].
I've made a simple JavaScript to check them with one click.
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
And in the HTML a button which calls the function.
<input type="button" name="CheckAll" value="All" onClick="checkAll(d...
I am new to PHP and regular expression. I was going thorugh some online examples and came with this example:
<?php
echo preg_replace_callback('~-([a-z])~', function ($match) {
return strtoupper($match[1]);
}, 'hello-world');
// outputs helloWorld
?>
in php.net but to my surprise it does not work and keep getting error:
PHP Parse ...
I want to understand about variables, that has been used in returning function.
This is example code
Prototype = {}
Prototype.F =
{
bind: function()
{
var args = arguments, __method = args.shift(), object = args.shift();
return function()
{
return __method.apply(object, args.concat(arguments));
}
}
}
func...
Hi,
I'm trying to write a function that is gets two arrays and the name of another function as arguements.
e.g.
main.m:
x=[0 0.2 0.4 0.6 0.8 1.0];
y=[0 0.2 0.4 0.6 0.8 1.0];
func2(x,y,'func2eq')
func 2.m :
function t =func2(x, y, z, 'func') //"unexpected matlab expression" error message here
t= func(x,y,z...
I have two functions f and g and I am trying to return f(g(x)) but I do not know the value of x and I am not really sure how to go about this.
A more concrete example: if I have functions f = x + 1 and g = x * 2 and I am trying to return f(g(x)) I should get a function equal to (x*2) + 1
...
Often I see a function declared like this:
void Feeder(char *buff, ...)
what does "..." mean?
...
Hi,
there seems to be a limit to the number of parameters a clojure function can take.
When defining a function with more than 20 parameters I receive the following:
#<CompilerException java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Exception: Can't specify more than 20 params (NO_SOURCE_FILE:0) (NO_SOURCE_FILE:0)>
...
Is there any way in F# how to get a name of a variable passed into a function?
Example:
let velocity = 5
let fn v = v.ParentName
let name = fn velocity // this would return "velocity" as a string
Thank you in advance
EDIT:
Why this code does not work? It is matched as value, so I can not retrieve the "variable" name.
type Test() =...
Is it possible to override a function based on the number of parameters that you are passing into it? For instance:
function abc(name) {
document.write ('My name is' + name);
}
function abc(name,friend) {
document.write ('My name is' + name + 'and my best friend\'s name is' + friend);
}
So in the HTML if I just called abc(ge...
Suppose it's a nub question, but is there an analog of mysql's LIKE function in php?
So, e.g. :
like('goo*','google.com');//is true
like('*gl*','google.com');//true
like('google.com','google.com')//also true
I know regex rullez, but don't know any solution to reach this
...
I need a similar function in PHP for this JavaScript function
text = text.replace(/ffc/g, "Hello");
I think preg_replace will do, but i'm not sure how to write the expression..
I want the regular expression similar to "/ffc/g" which is above, What I need exactly is to match the full word and case when performing the replace...
Thank...
Ok, I am trying to place parameters into a function that is called like so:
$parameters['function']($parameters['params']);
Here is the function and the parameters that I need to be placed into this:
$parameters['function'] = 'test_error';
$parameters['params'] = array(0 => $txt['sometext'], 1 => 'critical', 2 => true);
The test_er...
Hi,
Consider the following piece of code:
As you can see we are on line 28. Is there any way to see the return value of the function at this point, without letting the code return to the caller function?
Foo.Bar() is a function call which generates a unique path (for example). So it's NOT constant.
Entering ?Foo.Bar() in the immidi...
Hello Guys,
I want to make a scala function which returns a scala tuple.
I can do a function like this:
def foo = (1,"hello","world")
and this will work fine, but now I want to tell the compiler what I expect to be returned from the function instead of using the built in type inference (after all, I have no idea what a (1,"hello","w...
I'm trying to learn SQL and for demonstration purposes I would like to create a loop which iterates over function arguments. E.g. I would like to iterate over SERVERPROPERTY function arguments (propertynames). I can do single select like this:
SELECT
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS P...