Most voted "function" questions
The function (also called procedure, method, subprogram, or routine) is a portion of code intended to perform a single, specific task.
Learn more…1,309 questions
Sort by count of
-
1
votes2
answers325
viewsHow to test the factorial in Main()?
How would the main() of this function below? The user enters a number and appears on the screen the factorial of the same. int fatorial(int num) { if (num >= 0) { int fat = 1; while (num > 0)…
-
1
votes1
answer166
viewsFunction to return the binary value of an image
I created the following Function to return the binary value of an image. However, when executing the query you are displaying the following message: CREATE FUNCTION [dbo].[fn_image](@DSCAMINHO…
-
1
votes1
answer831
viewsphp another page function
This is code on another php page I try to call the functions but give error as if the variable did not exist , someone has some idea? <?php $host = "host"; $port = 587; $username= 'usuario';…
-
1
votes2
answers109
views.onscroll is only read once
I’m having some problems with a function .onscroll: window.onscroll=function(){ if(document.documentElement.scrollTop>5){ menuPrincipal.style.backgroundColor = "rgba(0,0,0,1)"; }else{…
-
1
votes1
answer70
viewsReturn Path in wordpress
I configured in the nail the wp-mail function of the wordpress responsible for sending emails on the site through the form. If wordpress update I have to make this addition of codes again in…
-
1
votes1
answer194
viewsFunction to create buttons from an Object
I need to create a function similar to this: criarBotoes({ "Abrir": function(dados){ alert("Abrindo..."); console.log(dados); }, "Fechar": function(dados){ alert("Fechar..."); console.log(dados); },…
-
1
votes2
answers212
viewsWhy of Null Pointer Exception in simple Java agenda program, and how to configure the function that returns an array of phones
Good evening! I’m having a problem with a college job, which is apparently simple (however, I’m very Noob in Java, and I don’t know what to do!). I would like you to help me, I am receiving Null…
-
1
votes2
answers737
viewsHow to use one class functions in another?
In a project I was using a class to define functions for the entire project, and as the project is growing the need arose for the creation of a new file with new class and function. In this case I…
-
1
votes0
answers218
viewsCallbacks that don’t get in my head!
Guys I’m trying to get the concept of callbacks before you start studying NODEJS. But I can’t really understand the syntax of callbacks... it’s just passing a function by parameter? função1…
-
1
votes1
answer28
viewsProblems in a query performed within a Stored Funcion in Mysql
I have a problem in a consultation on Mysql held within a Funcion. The question is the following, among the various activities that the ai function performs, is to test whether certain data has…
-
1
votes1
answer117
viewsTransaction in Postgress on Nodejs
I’m looking to encapsulate my SQL execution in the Postgress database. My initial wish is to call a method to execute a specific query and another method to execute a transaction of various queries.…
-
1
votes1
answer63
viewsCan I assign value within a parameter?
I have a work in pseudocode, where I needed to create a function to receive a user value and do the mod by 2, so I did so: Função Módulo (x,b=2: inteiro) : inteiro Var i:inteiro Inicio…
-
1
votes2
answers752
viewsHow to create an event where when the user presses the space key something happens?
For now I have only this bit of code: personagemPular.on("keyup",function(){ I wanted to trade this keyup for pressing space. And I’m also using a area text in HTML to receive keyboard entries, as I…
-
1
votes2
answers279
viewsProblem with Struct and Function in C
Good evening, I’m having a problem with the code I’m doing. I don’t know if I’m deleting the values correctly (and replacing them with the next one). The error is appearing in the replacement by the…
-
1
votes1
answer41
viewsDoubt regarding the passage of parameters
In the code below, in line 5, the function foo1t calls the function foo1 passing two parameters to it, however, the function foo1 has only one parameter. Is it possible to do this or the code is…
-
1
votes2
answers214
viewsjquery time Picker, create function for "min time"
I have two input with jQuery which loads a time interval of 30 minutes every 30 minutes. The first is the check-in time, the second is the check-out time. $(function() {…
-
1
votes0
answers139
viewsOverwrite php functions
I am working on the security of my site and would like to know if a malicious user can override some php function of my site if by chance he finds out what the name of this function?
-
1
votes1
answer818
viewsCalling javascript function with combo
function SemAcao() { return false; } function Mostra(nome, modelo, preco) { var nom = document.getElementById("bolnome"); var foto = document.getElementById("bolimg"); var prec =…
-
1
votes0
answers51
viewsHow to copy the contents of a code Parameter hint?
In Delphi, when we press the combination CTRL+SHIFT+ESPAÇO after the parentheses of a function, the IDE brings a code Parameter hint, telling the fields that must be informed for that function. I…
-
1
votes1
answer91
viewsDoubt def function with tuple mode input
Good person I have the following code: def tuplas(x): return x[::2] tuplas(('Hello', 'World', 'estamos', 'vivos')) This code will work perfectly, but if I remove the parentheses of my tuple,…
-
1
votes1
answer142
viewsWhat is the function mysql_store_result() for?
Hello, I’d like to know the real function of the mysql_store_result() method within the C++ language when we are working with mysql database.
-
1
votes1
answer130
viewsError using a function outside the Python script
I created a function that uses other functions that are not in the same script, when running the program I find an error, stating that the function outside the script is not defined. All functions…
-
1
votes2
answers5472
viewscalling a function within another function in c
I need to receive values float to store in a struct, however, these values must be validated by means of a validation function.` The function that reads and validates these values is working…
-
1
votes2
answers1736
viewsFormat string/float for PHP currency
I am doing reports in PHP and I have a column of value, only this column can come values with OR commas point. When it comes to displaying the value, I need you to show it in the form of cash.…
-
1
votes1
answer319
viewsNode js problem when picking function value
I have the following structure in Node : module.exports.find = function(pesquisa,frase){ return new Promise((resolve,reject) => { pesquisa.find(frase, function(err,data){ if(err) throw err; else…
-
1
votes1
answer304
viewsDictionary as input argument is being modified within the function
In the code below the dictionary used as input argument is also being modified by the function. I need to perform a deepcopy() at all times? def muda(a): a['valor'] = 50 return a dic1 = {'valor':…
-
1
votes1
answer101
viewsAbout passing parameters in compiled programming languages
What would be more advantageous when calling a function, putting in the stack from right to left or vice versa? And cleaning the stack? The function that calls (Caller) or what is called (calee)…
-
1
votes3
answers71
viewsCompiler accusing error I don’t know
#include<stdio.h> int sumofDie(int value1, int value2); int main( void ){ int die1[7]; int die2[7]; int i; srand(time(NULL)); printf("Rolling die 1 ..........\n"); for( i = 0; i < 6; i++){…
-
1
votes2
answers5641
viewsWhat is the use of the word "self" in Python?
excuse my ignorance on the subject because I’m starting now in the Python language, and for this very reason I wanted to know what works the reserved word "self". Thanks for your attention and…
-
1
votes3
answers944
viewsJavascript - Function that returns value from a CSS property
Good evening (good morning or good afternoon) to all! I need a function that returns the value of a css property. Follow my code: CSS: .teste{ opacity: 0; display: none; } Javascript: function…
-
1
votes2
answers80
viewsUse get_object_vars in a child class
I got the following class: class Dominio { private $teste; public function getAtributos() { return get_object_vars($this); } } And other classes that inherit it it(Dominio): class ClasseQualquer…
-
1
votes1
answer96
viewsStatic page paging not working
The latest posts and the link paging are appearing, but when I click on link, the URL changes to /page/2/ but gets the same content from the first page. Does anyone know how I can solve? <?php…
-
1
votes2
answers202
viewsEvent conflict with jquery
I have the following code: $('#abre-busca').click(function(event){ event.preventDefault(); $('#menu-principal-sub li').css({'opacity':0}); setTimeout(function(){ $('#menu-principal-sub…
-
1
votes1
answer60
viewsParameter name does not match with the variable passed
void countdown(int max, boolean output) { for (int i=max; i>=0; i--) if (output) println(i); } void setup(){ int top = 20; countdown(top, true); } There is something wrong with the syntax/writing…
-
1
votes0
answers96
viewsI wanted to call this function within my anonymous function, how can I do that?
retonaEndereco(myLatlng,adress => { let getDistance = function (origin,destination) { let distance = geolib.getDistance(origin,destination); return…
-
1
votes2
answers726
viewsCode within parentheses
What’s the difference of writing Javascript code in the following ways: Original form: 'use strict'; var openCtrl = document.getElementById('btn-search'), closeCtrl =…
-
1
votes1
answer229
viewsJavascript onclick/addeventlistener with no anonymous function
I have a problem with javascript onclick/addeventlistener, I have tried several different ways and no results were found, I wanted my click event to be equal to a function already declared and not…
javascript html web-application function javascript-eventsasked 8 years, 1 month ago Alexandre Gomes 321 -
1
votes1
answer135
viewsTooltip function does not work when running a second time
I’m creating a tooltips sketch, so that when you click on a certain span, this span shows a message HTML <div class="banner-tooltips" id="banner-tooltips"> <span…
-
1
votes4
answers7774
viewsCalling javascript function only once
Suppose I have a button that when clicked calls a javascript function. I would like that if this button were clicked several times it would only call this function once. There are ways to do this?…
-
1
votes1
answer252
viewsRunning a system command with parameter inside a Function in Postgresql
I’m having a hard time create a function in the Postgres execute a command shell linux, with one detail: it is a function in a Trigger after insert and I need to use some columns from NEW. In Mysql,…
-
1
votes1
answer2823
viewsVBA: Putting a space before or after uppercase letters in a given text
I have a string of texts that represent customer names, but which are without the proper spacing between each word/name (for example: Carlosalbertogomes). However the words can be differentiated…
-
1
votes1
answer32
viewsHelp in plugin or function
Does anyone know of a plugin or function that automatically deletes after a certain period posts and Wordpress media? I have a news site and has news of more than 2 years that I wish to delete,…
-
1
votes2
answers649
viewsRecursion in Python 3
I’m having trouble organizing a recursive summation formula in Python. I need to calculate: My code: def seq1(n): if n == 1: return n return seq1(n-1)+(-1**(n+1)/n) I keep getting the same error for…
-
1
votes0
answers28
viewsFunction that returns more than one variable in c
I need to do a function that takes 3 floats and returns the average, the largest number among the 3 and the difference between the average and the largest. I tried to make the return by a pointer…
-
1
votes1
answer540
viewsStop a Function already started in Jquery
The problem is this. I have a function called showJsonProducts(); I want that when I call another Function it stops running, example: $('.btn').click(function(){ showJsonProducts.stop(); ou…
-
1
votes2
answers1005
viewsHow to get all the digits of a variable in C?
I have to do a function that tests divisibility by 3, return true if divisible by 3. Otherwise return false. Following the rule : A number is divisible by 3 when the sum of its digits is divisible…
-
1
votes2
answers241
viewsA file with multiple functions OR multiple files with a function?
In the scope of my design use include("funcoes.php"), inside that file has all the functions I use in different parts of the project, I don’t use all the functions all the time. So a doubt! Pro…
-
1
votes1
answer96
viewsRandom character insert - Postgresql
I have a Function that makes an Insert when a certain action occurs, I’m trying to insert together random letters but I’m not finding anything related to this, It is possible to do this in…
-
1
votes1
answer29
viewsJavascript, a null(empty) id can be returned?
I’m wondering if it’s possible to return one id which has been removed as I want to get the same and remove the id="", and then click on a button for example, to put back what was before. (Goal) 1•…
-
1
votes1
answer2117
viewsHow to correctly call a function through another function in C?
I have the following duties : int testarDivisibilidade(int dividendo, int divisor); int divisibilidade3(int num); And the following variables: : int dividendo; int divisor; With the function…