function

zsh alias within function

Good morning, In zshell I have an alias as follows: alias foo='echo FooBar!' Which of course works fine. I have a function wherein I'm trying to actually 'execute' the alias, where it doesn't. foo_fun () { echo "About to foo!" `$foo` $foo eval $foo eval `$foo` echo "Just food...wait what?" } I'm having a b...

How do I create "undo" in c++?

I've got a couple of codes to do some things but I need to create a function that undoes the previous task/addition/change.How do I do this in Borland C++? (the program stores strings of text in a text file using "list",it is stored and then erased unless I use the save-function I've created) right,so I don't know if I've forgotten to ...

Evaluation of jQuery function variable value during definition of that function

I have a large number of rows in a table within which I wish to attach a unique colorpicker (jQuery plugin) to each cell in a particular column identified by unique ids. Given this, I want to automate the generation of instances of the colorpicker as follows: var myrows={"a","b","c",.....} var mycolours={"ffffff","fcdfcd","123123"...} ...

not returning anything from postgresql function?

Is it possible for a PostgreSQL plpgsql function to not return anything? I've created a function, and I don't need it to return anything at all, as it performs a complex SQL query, and inserts the results of that query into another table (SELECT INTO ....). Thus, I have no need or interest in having the function return any output or va...

Why function does not know the array size?

If I write int main() { int a[100] = {1,2,3,4,}; cout<<sizeof(a)/sizeof(a[0])<<endl; //a is a pointer to the first elem of array, //isn't it return 0; } I get 400! If I write void func(int *a); int main() { int a[100] = {1,2,3,4,}; func(a); return 0; } void func(int...

How to get the original variable name of variable passed to a function

Is it possible to get the original variable name of a variable passed to a function? E.g. foobar = "foo" def func(var): print var.origname So that: func(foobar) Returns: >>foobar EDIT: All I was trying to do was make a function like: def log(soup): f = open(varname+'.html', 'w') print >>f, soup.prettify() f.clo...

selecting more than 1 table to get content from [php/Mysql]

Hi There i want to get the latest threads/messages i made my code then i made function that calls the code to show last messages in specific board it works great now i want to get latest messages from 2 boards or more in the same function this is the part that chooses the board AND b.id_board = t.id_board' . (empty($vars) ? '' : '...

C++ function will not return

I have a function that I am calling that runs all the way up to where it should return but doesn't return. If I cout something for debugging at the very end of the function, it gets displayed but the function does not return. fetchData is the function I am referring to. It gets called by outputFile. cout displays "done here" but not "da...

How to get the Entire Function from a file

Ok, I'm reading through a file now, line by line. I know each functions name in the file, since it is defined elsewhere in an XML document. That is what should be this: function function_name Where function_name is the name of the function. I get all of the function definitions from an XML document that I already have put into an a...

Fibonacci Function Question

I was calculating the Fibonacci sequence, and stumbled across this code, which I saw a lot: int Fibonacci (int x) { if (x<=1) { return 1; } return Fibonacci (x-1)+Fibonacci (x-2); } What I don't understand is how it works, especially the return part at the end: Does it call the Fibonacci function again? Could s...

How to call a prototyped function from within the prototyped "class"?

function FakeClass(){}; FakeClass.prototype.someMethod = function(){}; FakeClass.prototype.otherMethod = function(){ //need to call someMethod() here. } I need to call someMethod from otherMethod, but apparently it doesn't work. If i build it as a single function (not prototyped), i can call it, but calling a prototyped does not ...

Array of function pointers in Java

I have read this question and I'm still not sure whether it is possible to keep pointers to methods in an array in Java, if anyone knows if this is possible or not it would be a real help. I'm trying to find an elegant solution of keeping a list of Strings and associated functions without writing a mess of hundreds of 'if's. Cheers ...

+= Overloading in C++ problem.

I am trying to overload the += operator for my rational number class, but I don't believe that it's working because I always end up with the same result: RationalNumber RationalNumber::operator+=(const RationalNumber &rhs){ int den = denominator * rhs.denominator; int a = numerator * rhs.denominator; int b = rhs.numerator * d...

Using recursion to sum two numbers (python)

I need to write a recursive function that can add two numbers (x, y), assuming y is not negative. I need to do it using two functions which return x-1 and x+1, and I can't use + or - anywhere in the code. I have no idea how to start, any hints? ...

jQuery .find() not working in IE

I have a function trying to run this: if ( action=='fadeIn' ) { if ( $( this ).css( 'position' ) == "static" ) { $( this ).css( {position: 'relative'} ); } $( this ).append( '<span class="bg_fade">' ) } var fader = $( this ).find( '.bg_fade' ); alert(fader.attr('class')); It works fine in Firefox, but in IE, the alert re...

SQL wont work? It doesn't come up with errors either

Hey there, I have php function which checks to see if variables are set and then adds them onto my sql query. However I am don't seem to be getting any results back!? $where_array = array(); if (array_key_exists("location", $_GET)) { $location = addslashes($_GET['location']); $where_array[] = "`mainID` = '".$location....

Cryptic C++ "thing" (function pointer)

What is this syntax for in C++? Can someone point me to the technical term so I can see if I find anything in my text? At first I thought it was a prototype but then the = and (*fn) threw me off... Here is my example: void (*fn) (int&,int&) = x; ...

Toggle Image Overlays in Google Maps API v3

Hey guys. I've been building a small library for myself for a job I have at the moment building a map for a university. I've gotten pretty well everything I need in some basic form, but one thing has simply not been working, and is simply not giving me results. The university itself is sort of in a partnership with the neighboring c...

default values for variable argument list in Python

Is it possible to set a default value for a variable argument list in Python 3? Something like: def do_it(*args=(2, 5, 21)): pass I wonder that a variable argument list is of type tuple but no tuple is accepted here. ...

JavaScript eval() "syntax error" on parsing a function string

I have a bit of JavaScript code that is specified in a configuration file on the server-side. Since I can't specify a JavaScript function in the configuration language (Lua), I have it as a string. The server returns the string in some JSON and I have the client interpret it using a clean-up function: parse_fields = function(fields) {...