1
голосов
3ответов
1514 просмотров

Confusion with the problems of inline function

In the problems of inline functions in wikipedia : http://en.wikipedia.org/wiki/Inline_expansion#Problems it says : "# A language specification may allow a program to make additional assumptions about arguments to procedures that it can no longer make after the procedure is inlined." Could some...

1
голосов
2ответов
2275 просмотров

Make a new asynchronous call inside a callback function

I would like to use the Google AJAX Feed API to fetch multiple newsfeeds and display them on a webpage. I can't use Google's FeedControl class because I want to control the way the items of the feed are displayed. That leaves me with Google's Feed class as the only option. I've got it to work...

90
голосов
8ответов
49514 просмотров

PHP call_user_func vs. just calling function

I'm sure there's a very easy explanation for this. What is the difference between this: function barber($type){ echo "You wanted a $type haircut, no problem\n"; } call_user_func('barber', "mushroom"); call_user_func('barber', "shave"); ... and this (and what are the benefits?): function...

10
голосов
6ответов
16023 просмотров

How to make functions with flag parameters? (C++)

How could I make a function with flags like how Windows' CreateWindow(...style | style,...), for example, a createnum function: int CreateNum(flag flags) //??? { int num = 0; if(flags == GREATER_THAN_TEN) num = 11; if(flags == EVEN && ((num % 2) == 1) num++; ...

8
голосов
5ответов
1682 просмотров

What does "return function() { ... }" do in JavaScript?

Recently I saw this piece of JavaScript code, but have been unable to understand what it is trying to do. var f = function(a) { return function() { alert(a()); }; }; f(function() { return "Hello World"; })(); Please explain what this accomplishes!

0
голосов
4ответов
3761 просмотров

Javascript: Fade in and out

i have this PHP based doc (chatbox) where you can type your message and send it. Now, i have this fade animation where a message comes in when a message is send. Looks like this: Javascript: function stateChanged1() { if (xmlHttp1.readyState==4) { document.getElementById("sent").innerHTML="...

1
голосов
3ответов
2175 просмотров

Use Variable of a function in another function without parameters?

i like to make my database insert more dynamicly with functions. Like this: private void setValues() { string test = "foo"; string test2 = "bar"; } private void WriteToDB() { dc dcOfMyDatabase = new dc(); DBTable myTable = DbTable() { field1 = test; // values of other fu...

0
голосов
2ответов
53 просмотров

Problem in a function actionscript

How do I add a variable that varies with the dummy variable in a loop: function resetAll(menuNum){ trace(menuNum); for (i=0; i<=7; i++){ if(menuNum != 1){ menu_all_mc.this["btn_"+i].gotoAndStop("off"); } } } this["btn_"+i] don`t work I need pass the btn name like: btn_1...

1
голосов
11ответов
2224 просмотров

Finding the function caller in C

Hey all, I'm just wondering if it is possible to get the name of the program thats running within a function? Here's an example: Say I called: ./runProgram main() { A(); } function A() { // Possible to retrieve "runProgram" if I cannot use main's argc(argv) constants?? }

0
голосов
1ответов
134 просмотров

Execute JavaScript function with externally loaded link

I'll admit the title is a bit confusing but it was hard to come up with a better one. Ok, so What I have is 3 pages, first is the main page that the user loads up and the other 2 are ones that are going to be loaded into the main page with jQuery. Here is the JavaScript code on the first page: ...

77
голосов
7ответов
38228 просмотров

C function syntax, parameter types declared after parameter list

I'm relatively new to C. I've come across a form of function syntax I've never seen before, where the parameter types are defined after that parameter list. Can someone explain to me how it is different than the typical C function syntax? Example: int main (argc, argv) int argc; char *argv[]; ...

20
голосов
11ответов
15394 просмотров

What happens in assembly language when you call a method/function?

If I have a program in C++/C that (language doesn't matter much, just needed to illustrate a concept): #include <iostream> void foo() { printf("in foo"); } int main() { foo(); return 0; } What happens in the assembly? I'm not actually looking for assembly code as I have...

0
голосов
2ответов
2595 просмотров

Send variables to javascript(jquery) function

I wont to be able to send a variable to a JavaScript function when I click on a link but for some reason I cant find anywhere on how to do it on the internet. Here is the function at the top of my page: <script> $(document).ready(function(){ $('[name=updateInterface]').click(function() { ...

3
голосов
7ответов
16761 просмотров

A homework about growth rate of function

Please order the function belows by growth rate n ^ 1.5 n ^ 0.5 + log n n log ^ 2 n n log ( n ^ 2 ) n log log n n ^ 2 + log n n log n n ps: Ordering by growth rate means, as n gets larger and larger, which function will eventually be higher in value than the others. ps2. I have ordered most o...

3
голосов
2ответов
3491 просмотров

Using SWIG with pointer to function in C struct

I'm trying to write a SWIG wrapper for a C library that uses pointers to functions in its structs. I can't figure out how to handle structs that contain function pointers. A simplified example follows. test.i: /* test.i */ %module test %{ typedef struct { int (*my_func)(int); } test_str...

1
голосов
3ответов
241 просмотров

Complexity of a given function

When I analyzed the complexity of the code segment below, I found that it is O(n/2). But while searching the internet I discovered that it is probably O(n). I'd like to know who's correct. void function(int n) { int i = 1, k = 100; while (i < n) { k++; i += 2; } }

7
голосов
6ответов
8694 просмотров

Property vs Function (specifically .NET)

I've read some discussions about this subject, and there's something I just don't understand. The most common answer seems to be this: use a ReadOnly Property to return cached data, use a Function to return non-cached data. Don't use a WriteOnly Property at all, cause "it doesn't make sense". T...

1
голосов
3ответов
1696 просмотров

Accessing td property of a html table through javascript and css

I am trying to change the background color of a td element in a static html table. I will be finding the td's invovled through a database call and need to show the td by way of turning the background color from none to yellow. I have built a css file to match the td class attribute so I can isola...

0
голосов
2ответов
1726 просмотров

Call Javascript function from asp.net page in a frame

I have 2 pages in a frameset, in the first page i have a Javascript Function, the second is an asp.net form with a button, the thing is that I need to call the Javascript function in the first page when user clicks the button: I'm trying with: ClientScript.RegisterStartupScript(this.GetType(), ...

0
голосов
1ответов
177 просмотров

Accessing function from multiple forms on same page

I have the following function: <script type="text/javascript"> $(function(){ // start a counter for new row IDs // by setting it to the number // of existing rows var newRowNum = 2; // bind a click event to the "Add" link...

1
голосов
3ответов
8646 просмотров

SQL Inline or Scalar Function?

So I need an SQL function that will concatenate a bunch of row values into one varchar. I have the functions written but right now I'm focused on what is the better choice for performance. The Scalar Function is CREATE FUNCTION fn_GetPatients_ByRecipient (@recipient int) RETURNS varchar(max) ...

5
голосов
10ответов
411 просмотров

Is this the way to go about building Perl subroutines?

So I've had a simple ucwords function for Perl which I've had a while, and wanted to expand it, this is what I've come up with, is this the way I should be building my functions to handle optional parameters? Original: sub ucwords{ $str = @_[0]; $str = lc($str); $str =~ s/\b(\w)/\u$...

3
голосов
2ответов
1576 просмотров

How can I solve an ODE without using nested functions?

I have some differential equations that I need to solve using MATLAB's ODE solvers. While the differential equations themselves are fairly simple, they depend on a lot of "constants". These constants aren't universal, and need to be supplied by the caller. An example ODE of this sort would be: ...

55
голосов
8ответов
30872 просмотров

Getting a function name as a string

Say I have a bunch of functions, each with something likeMyFunction.1, etc. I want to pass these functions into another function, which prints out a small report. Ideally I'd like to be able to label sections of a report by which function is being used to generate the results. So are there a...

0
голосов
2ответов
318 просмотров

Getting WP Functions to Return rather than Printing Immediately

I'm trying to build an array within "The Loop" of values provided from various functions like the_title(), the_excerpt(), the_permalink() and others. I'd like to do something similar to what follows. The unfortunate thing is that most of these functions immediately print their results rather than...

0
голосов
4ответов
318 просмотров

PHP OOP, perform a function once a certain variable has been set

How can i perform a function once a variable's value has been set? say like $obj = new object(); // dont perform $obj->my_function() just yet $obj->my_var = 67 // $obj->my_function() now gets run I want the object to do this function and now having to be called by the script. Tha...

2
голосов
8ответов
433 просмотров

More vs Less Functions

I had a little argument, and was wondering what people out there think: In C++ (or in general), do you prefer code broken up into many shorter functions, with main() consisting of just a list of functions, in a logical order, or do you prefer functions only when necessary (i.e., when they will b...

6
голосов
6ответов
6121 просмотров

Ruby: building a plot of function

What's the easiest way to build a plot of a function under Ruby? Any suggestions as to the special graphical library? update: under windows only :-( update 2: found the following gem as a best solution so far https://github.com/clbustos/rubyvis

0
голосов
1ответов
110 просмотров

calling function scope mystery

If I have: Object._extends = function(Derived, Base) { Derived.prototype = new Base(); Derived.prototype.constructor = Derived; Derived.uber = Derived.prototype; } var BASE = function() { this._name = "BASE" } var DERIVED = function() { Object._extends(DERIVED, BASE) this...

25
голосов
4ответов
25913 просмотров

jquery prevent duplicate function assigned

If I need to assign a click function dynamically, is there a way to ensure the click function is only assigned once and not duplicated? this.click(function(){ alert('test'); })