function

Problem in calling a C++ dll function from C#

Hello, This is my 3rd thread concerning a blowfish problem in C#.Despite the fact I cannot have blowfish implemented in my application, I decided to use it as an external C++ dll. Please note I've tried Blowfish.NET and any other, the problem is that I'm translating code from C++ to C# and the C# code must do exactly the same as the C++...

Python tkinter label won't change at beginning of function

I'm using tkinter with Python to create a user interface for a program that converts Excel files to CSV. I created a label to act as a status bar, and set statusBarText as a StringVar() as the textvariable. inputFileEntry and outputFileEntry are textvariables that contain the input and output file paths. def convertButtonClick(): s...

How can I import only a couple of functions from a Ruby module?

Suppose I have a module with the methods : function1,function2,function3. I want to import function1 and function2 but not function3. Is there a way to do this in ruby? ...

Optional function parameters: Use default arguments (NULL) or overload the function?

I have a function that processes a given vector, but may also create such a vector itself if it is not given. I see two design choices for such a case, where a function parameter is optional: Make it a pointer and make it NULL by default: void foo(int i, std::vector<int>* optional = NULL) { if(optional == NULL){ optional = new...

VB script math function

Hi friends, I have an ASP page where I have 2 variables, strActualRate and strProposed. The values are: strActualRate = 33.30 strProposed = 33.3 So when I write the following line to compare: if strActualRate <> strProposed then Response.Writr "Both are not equal!" end if I am getting the output "Both are not equal", even though...

C++ multiple declaration of function error when linking

Hi, I seem to be forgetting my C++ ... I'm trying to declare some functions in C in separate sources, and including the appropriate .h when necessary. It compiles OK; but the problem is during linking, where the linker complains about functions already being defined. I even tried defining the functions as extern, in a (vain) attempt ...

Asp.Net call function from a different *.aspx.cs page

If I have a button inside one page for example "main.aspx". And upon being clicked I want the clicked method in "main.aspx.cs" to call a function from a different *.aspx.cs page but also redirect to that *.aspx page...is that possible? ...

Can I include a function inside of another function (PHP)?

Is it possible to include one function inside another? To learn functions, I'm trying to create a combat sequence using PHP. The sequence would look like this: Dice would roll, assigning numbers to variables; Hero1 attack results are printed; Dice would roll, assigning numbers to variables; Hereo2 attack results are printed; Dice woul...

Terminology for a deterministic function with no side-effects?

I need the proper terminology for a specific type of function. Suppose you write a function in your SQL database, whose inputs and outputs are contained within the scope of a database transaction. That is, if you call this function in the scope of a database transaction, all the data used by the function is available within the same ...

How can I have PHP avoid lazy evaluation?

I have an interesting question about the way PHP evaluates boolean expressions. When you have, for example, $expression = $expression1 and $expression2; or if ($expression1 and $expression2) PHP first checks if $expression1 evaluates to true. If this is not the case, then $expression2 is simply skipped to avoid unnecessary calcul...

Pass JSON obj out from parse function? | noob javascript question

I'm trying to pass an object out of a function. Here's my code: <script type="text/javascript"> // finds the head element; creates a script with passed url; appends it to the head function loadJSON(url) { var headID = document.getElementsByTagName("head")[0]; var newScript = document.createElement('script'); newScrip...

MySQL - pass database field through PHP function before returning result

The following code from http://php.morva.net/manual/en/mysqli-stmt.bind-result.php shows a mysqli query being prepared and executed. while ($stmt->fetch()) loop looks like it is generating the result resource. Can I change this to include a call to a function e.g. while ($stmt->fetch()) { foreach($row as $key => $val) { ...

Can I write my own mySQL functions to use in mySQL queries?

Can I write a custom function that I can call when making mySQL queries eg. My database table has fields 'filetype' and 'filename'. I want to perform a function on filename before returning the result. $query = "SELECT filetype, MY_FUNCTION(filename) FROM table.."; $result = mysql_query($query); return $result SO $result now has the ...

What is a maximum number of arguments in a Python function?

It's somewhat common knowledge that Python functions can have a maximum of 256 arguments. What I'm curious to know is if this limit applies to *args and **kwargs when they're unrolled in the following manner: items = [1,2,3,4,5,6] def do_something(*items): pass I ask because, hypothetically, there might be cases where a list lar...

Why do I get a "Too many input arguments" error when not passing any?

I am working on some simple object-oriented code in MATLAB. I am trying to call one of my class methods with no input or output arguments in its definition. Function definition: function roll_dice Function call: obj.roll_dice; When this is executed, MATLAB says: ??? Error using ==> roll_dice Too many input arguments. Error in ==> ...

jquery.load

I would like to use jQuery's load function I can write : $('#somediv').load('somefile.html #aSpecificDivinThatPage'); Now I would like to have a variable as the source div in the html page, how do i write that out ? ...

Make function of this repetitive piece of java code

I've got this piece of java code: int maxDigit = 4; for(int a = 0; a <= maxDigit; a++) { for(int b = 0; b <= maxDigit; b++) { if(b != a){ for(int c = 0; c <= maxDigit; c++) { if(c != a && c != b) { for(int d = 0; d <= maxDigit; d++) { if(d != a && d != b && d != c) ...

What is the difference between a 'function' and a 'procedure' ?

Generally speaking, we all hear about the "functions" or the "procedures" in programming languages. However, I just found out that I use these terms almost interchangeably (which is probably very wrong). So, my question is: What is the difference in terms of their functionality, their purpose and use? An example would be appreciated. ...

how to get NHibernate aggregate function sum() to return decimal?

Hi, I can't get sum() to return decimal and it always returns int64 truncating the decimals. I have Googled for a whole day but still can't find a real work around. I have a DB table called ProductPurchase with QtyPurchased(int) and UnitPurchasePrice(money) columns, these are mapped to a C# POCO object using NHibernate, where Qt...

How to create my own function with { } in PHP

I want to create my own function loop(): loop($x,$y){ //do something } it should work like for, foreach operators: $y=count($array); for($x=0; $x<$y; $x++){ //do something } How to create functions like this with { } in PHP? (NOT a regular function) ...