function

Matlab's 'save' function - how to name the variable inside the .mat file same as file name?

I want to save the result of the q_yearly for each case_no in corresponding string of the q_cases_yearly as a .mat file. With my statement of save(q_cases_yearly{case_no},'q_yearly') even though the names of files are coming as the corresponding string of q_cases_yearly, however all those .mat files contain variable with the same name of...

java vs C++ pass by reference

Hi, I am confused in the following: In C++ we can pass a parameter to a function by reference (having declared it as a pointer or reference variable) and if we modify it inside the function, the changes are reflected to the caller when the function returns. This is not happening in java and I am not sure I understand why. E.g. this is a...

jQuery function clear form and set back to onLoad status

For my jq driven form I am looking for a function that clears my form and set it back to the original stage as it was on page load but without refreshing the entire page. I use placeholder text and I have created a standard reset button. In webkit browsers it works fine. If the reset button is hit, the form returns to the original state,...

In C++, how to I stop my pointers from being 'overridden' when a function is called again?

Hello, all! I don't know if 'overridden' is the right word here. In my programming class, I have to create a circular list, such that each node node contains a pointer pointing to the next node and the final node points to the first node. In addition, there is a tail node that points to the last node added (its null before any nodes are ...

Flex: How to Call a Custom Component's Public Function in the Main App?

Hi, How do I call a custom component's public function from the main app. For example, I've got a timer component, MyTimer. In the main app, I want to call startTimer() or stopTimer(). In the main app, I've got: <visualcomponent:MyTimer /> In the component, I've got: public function startTimer():void { baseTimer = getTimer();...

Passing an object to a function taking pointer as parameter

How does it work when I only have an object but my function takes a pointer to that type of object. Someoclass test1; SomeFunction( Someclass*) { //does something }; ...

Should an object return null and a collection of objects return an empty collection?

The topic of returning nulls, empty objects and empty collections came up today and we'd like to get the opinion of others. We have read the discussion on returning null for object and separately the discussion on returning empty collections and agree with the marked answers for both topics. However, in our case, we have a class that c...

Call function after certain time has elapsed

I'm making a GUI API (for games, not an OS) and would like to implement animated buttons. I'd like to be able to create timed events, but, within the class. example: class TextBox { void changeColor(int color); void createTimedEvent(func* or something, int ticks); void animate() { createTimedEvent(changeColor(red),30);...

Flex 4 timers keep Firing

I'm trying to create a simple flex4 project which involves some timers that trigger other functions. I don't have much experience with Action Script and even less with timer events. Here is a bit of my code it seems to be working for the most part but you lines were I'm adding up the total score (score = score +1;) seems to just keep a...

Why to use empty parentheses in Scala if we can just use no parentheses to define a function which does not need any arguments?

As far as I understand, in Scala we can define a function with no parameters either by using empty parentheses after its name, or no parentheses at all, and these two definitions are not synonyms. What is the purpose of distinguishing these 2 syntaxes and when should I better use one instead of another? ...

Should I use a T-SQL function, view, or stored proc ?

Hi Guys, I've got a question about reusing table data but a view won't work in this scenario as I have a parameter that needs to be passed in. Basically this part of the system requires a travellerid to be sent to the procedure and a list of arrangers returned for that specific traveller. There are around 7 business rules that are used ...

Difference between returns and printing in python?

In python I don't seem to be understanding the return function. Why use it when I could just print it? def maximum(x, y): if x > y: print(x) elif x == y: print('The numbers are equal') else: print(y) maximum(2, 3) This code gives me 3. But using return it does the same exact thing. def maximum(x, ...

Functions / Methods in Objective C!

Hi guys! I need help with functions in objective C? In C++ i can make a function like this: int testFunction(int zahl) { int loop; loop = zahl * 10; return loop; } this function multiply my zahl with 10 and returns the result. In C++, i can call this function whenever i want with: testFunction(5); and it returns 50. ...

Looping through several functions in PHP

Hello, Basically I want to achieve such functionality that 5-10 functions are executed in a row (like normally). However, I want the script to go back several steps back (ex. from 5th back to 3rd) and continue further (like 4,5,6,7,8,9,10), if specific return is received. Example: <? function_1st(); function_2nd(); function_3rd(); funct...

Is there a technical term for a function that takes one argument and returns an object of the same type?

I'm considering functions of one argument of type T that return an argument of type T. I seem to vaguely recall that there is a name for that sort of function, maybe homo-something. Is there such a term? ...

Determining the input of a function given an output (Calculus involved)

My Calculus teacher gave us a program on to calculate the definite integrals of a given interval using the trapezoidal rule. I know that programmed functions take an input and produce an output as arithmetic functions would but I don't know how to do the inverse: find the input given the output. The problem states: "Use the trapezoidal...

How to call function using the value stored in a variable?

I have a variable var functionName="giveVote"; What I need to do is, I want to call function stored in var functionName. I tried using functionName(); . But its not working. Please help. Edit Based on the same problem, I have $(this).rules("add", {txtInf: "^[a-zA-Z'.\s]{1,40}$" }); rules is a predifined function which takes metho...

jQuery animation glitch: functions fire in wrong order when mousing across to quickly

NOTE: I didn't write the script in question, my collegue did. Just volunteering to get some input on this for us. Please pardon incorrect terms or descriptions that sound like a noob; I'm not a scripting guy, I'm an HTML/CSS guy. The page in question: http://cure.org/curekids/kenya/2010/02/joseph_muchiri/ A screenshot of the issue: ...

Exceeding Max Char Limit in Excel

How do I use more than 255 characters in Excel's CONCATENATE function? I am actually also using the CONCATENATE function within the HYPERLINK function in EXCEL. An example looks like this: =HYPERLINK(CONCATENATE("http://www.google/com/morethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255charsmorethan255charsmoretha...

Some error in php function .

This Is my code http://www.ideone.com/R1P4b I'm use simple_html_dom class In end of file if i rung one line is no error and if i rung two line is return one error echo getImg($text1) . "<br/>"; echo getImg($text2) . "<br/>"; error but echo getImg($text1) . "<br/>"; or echo getImg($text2) . "<br/>"; Don't error Please help me fix...