function

way of calling a function

I was trying to make an API. I just wanna hide all details from end programmer. I also want to provide them number of options to call a function.For example I have 4 functions with same name but different signature (overloaded functions) function1() function1(arg1) function1(arg1,arg2) function1(arg1,arg2,arg3) In above sequence 4th ...

Making global var from inside a function in PHP

Hi, I am trying to define dynamically variables. I am using a function for this, but I don't know how to define the new var as global (because it never created before the function). is that possible ? Thanks. edit ok, this is what I've built. is it that dangerous ? function extract_values($row) { foreach ($row as $key => $val...

Function overloading in powershell

Can you overload functions in powershell ? What I want to do is that my functin could accept string, array or some switch. Example what I want: Backup-UsersData singleUser Backup-UsersData @('Alice', 'Bob', 'Joe') Backup-UsersData -all Best regards. ...

Problem executing different js functions on span elements click nested inside a HTML hyperlink.

Hi, I have a couple of span elements inside a HTML hyperlink like this. <a href="Default.aspx"><span id="span1" onclick="adddata();">Span1<asp:Literal ID="Lblcount" runat="server"></asp:Literal></span><span id="span2" class="removetab ui-icon ui-icon-circle-close" style="float:right; margin: -2px -10px 0px 3px; cursor:pointer;" onclick...

Is Function really an Object

I am a self taught web developer and am still trying to come to grips with some JavaScript fundamentals. Below are some quotes extracted from Douglas Crockford's Good Parts. "Functions in JavaScript are Objects" "In JavaScript, arrays are objects, functions are objects, regular expressions are objects, and, of course, objects are obj...

Jquery nextUntil() alternative.

I have the following code which it was provided by Nick in a previous question and it work like a dream. What I am trying "I am trying to generate a jquery script to make all tr elements from a table with class top clickeable and when one tr with class top is clicked all tr below with class bt until there is another tr class top will ...

C# - Calling a function in another program over a networked solution.

I have a server and a client program, and they communicate as expected. The only thing is, I have a combo box on the client program, and when this combo box is changed, I want it to call a function on the server program. How would I go about this? I've thought about it for a while, and just can't seem to get it to work. ...

Best practice when using functions/objects and database - general question

I have this question on and of for a year or two, but it is so nonspecific, and my native language is not English, so I don't know how to ask to be precise and everybody will understand what is my dilemma. It is even more valid if using objects but for the sake of simplicity I'll make a simple example (theoretical) with a function and d...

How to create extend a jquery function

I'm trying to create a jquery plugin initially the plugin is used like $('element').plugin; Now, i want to extend it further to call specific operations like $('element').plugin.create; or $('element').plugin.delete; any way of doing this? ...

Functions and pointer to pointers

I have been trying to create a pointer variable in the called function and somehow pass the value pointed by it to the main function. I wrote a few sample programs but it i still seem to be missing something out. and the challenge was to achieve this using pointers to pointers to pointers. Here is the code that I wrote and tested. I thin...

Which one of these two ways of writing this code would be more suited?

I've got a code that as you can see I can write in either of two following ways, the matter is the only difference is since in second function the parameter is declared as non-constant I can use that instead of declaring a new variable(num1 in first function) but I' curious which one would be more suited if there would be any difference ...

c++ interesting function define

Hi all, i have examined code of RDcode. And i come across a defined function and i dont understand. Can you help me to this code. template <typename T> class argless { public: argless(const T& c) : container(c) {}; // i dont understant this line. bool operator() (unsigned int v1,unsigned int v2){ return container[...

Haskell - Foldr and Foldl further explanation and example

I've looked at http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl%27 and http://haskell.org/haskellwiki/Fold as well as a few others and they explain it fairly well. I'm still having trouble on how a lambda would work in this case. Example foldr (\y ys -> ys ++ [y]) [] [1,2,3] Could someone go through that step by step and try to e...

Any tool to determine most efficient way of passing data, by reference or by value?

For objects or primitive data with a size equal to or less than size of a pointer the most efficient passing method to a function would definitely be by value but the thing is I want to know would be there any tool capable of determining best method of passing objects of classes or primitive data with a sizes bigger than size of a pointe...

Extra output none while printing an command line argument

Hi, It's my day 1 of learning python. so it's a noob question for many of you. See the following code: #!/usr/bin/env python import sys def hello(name): name = name + '!!!!' print 'hello', name def main(): print hello(sys.argv[1]) if __name__ == '__main__': main() when I run it $ ./Python-1.py alice hello alice!!...

Why can't a function have a reference argument in C?

For example: void foo( int& i ); is not allowed. Is there a reason for this, or was it just not part of the specification? It is my understanding that references are generally implemented as pointers. In C++, is there any functional difference (not syntactic/semantic) between void foo( int* i ) and void foo( int& i )? ...

Visual Studio Visual Basic 2010/ Function & Sub & For Loop

For example, input values are Cost = 1250, Salvage = 150, Life 5. Then the output I want is: $500.00 $300.00 $180.00 $108.00 $12.00 However, the program outputs: $500.00 $500.00 $500.00 $500.00 $500.00 P.S. This is for the DDB Also, how could I add numbers before each values like 1 $500.00 2 $300.00 3 $180.00 4 $108.00 5 $12.00 Thank yo...

How to make a public module that can do some common functions in java?

As asked in title, can I make a 'common' public Class and some public static foo() in it? Thanks! ...

Help changing function from prototype to jQuery!

Hey I found this function online and it works fine if I use it by itself, but the rest of my document has all jQuery functions and I'd like this one to be in jQuery as well. I also get a few errors when mixing prototype and jQuery. Here is the function: function updateCommodityProduct(e) { // The response comes back as a bunch-o-J...

Python function prints None

I have the following exercise: The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in. Here's what I've done, but the second print function only prints 'None'. def sleep_in(weekday, vac...