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
votes1
answer3433
viewsRun function with Javascript/ Jquery timer
I need help creating a function in javascript/jquery to do the following: When user accesses my site, starts time counter. If the person tries to close the browser window/tab before a certain time,…
-
1
votes1
answer891
viewsTextarea function php pass data
I have a question about how I can be passing the value of a textarea to a php function. I have the following function: function _dup($cclist) { for ($i = 0; $i < count($cclist); $i++) { $ccnum =…
-
1
votes3
answers115
viewsMultiple callbacks with Javascript
Hey there, guys. I have two callbacks of distinct functions that provide me values that need to be used outside of these functions. Follow the code: FB.api('/me', function(response) {…
-
1
votes1
answer84
viewsError in a function check
I need to make a code with several specific functions. In one of them, with a square matrix, I need to trace a primary and a secondary line, both cutting in the middle diagonally, leaving the higher…
-
1
votes1
answer3534
viewsPass and return vector of type defined by struct as parameter of a function in C
I’m finding errors for the following code: #include<stdlib.h> #include<stdio.h> #include<stdbool.h> #include <locale.h> #define true 1 #define false 0 const int limite = 100;…
-
1
votes1
answer193
viewsJavascript image link does not work
Okay, I know there are thousands of ways to do this(better and easier) but I’d just like to make it work. I am passing the images through the JS and would like to assign the link of the same,…
-
1
votes2
answers83
viewsProblem with random values
Good night, you guys. I’m solving an exercise where I must, at each run, generate a random number and then turn it into a letter. For this I made a function. It is almost all right, the number is…
-
1
votes1
answer886
viewsFunction http_build_query
I wonder what the function is for http_build_queryin php. I read the manual, but it was vacant for me. http_build_query It is correct to use it within this context? $cURL =…
-
1
votes0
answers33
viewsUse callback output in a javascript variable
I have a variable within the success of function $.ajax() only that I need the contents of that variable in a part of the code, outside the $.ajax(). I’m trying to create the way: jQuery.ajax({ url:…
-
1
votes1
answer134
viewsMain for function on linked lists
I’m having a hard time creating a main to test if my function is going well. My program is as follows: : Lint fromArray (int v[], int N) which, given an array v with N elements, ordered in ascending…
-
1
votes2
answers1697
viewsAckerman function - Python
Well, I’m still learning to code in python and I came across exercise that I can’t solve. I need to write a function that solves Ackermann’s famous function. I think I will not have problems with…
-
1
votes1
answer82
viewsDirective as Function parameter?
Is it possible to set directives as parameters of a Function already on the html page? I tried to do serviceLogin({{login.user}},{{login.pass}})but I don’t think it’s right
-
1
votes1
answer112
viewsKeyboard function does not work Pyopengl
Guys I have the following code, I wanted to make a simple event to close the application but my function Keyboard does not work, I searched elsewhere and found similar versions. If you can help me,…
-
1
votes1
answer112
views -
1
votes1
answer871
viewsTake time to access a page and write to the BD
I need to take the time that the user was on a given page, and the user leave the page, this time is recorded in the database. Would anyone have any idea how to do? [Edited] The time I managed to…
-
1
votes2
answers553
viewsFunction with CAST and SUBSTRING
This function would return the last two "95512" or to return the number without the last two digits "95512". The value passed to function can vary, at least 3 character and at most 11 DELIMITER $$…
-
1
votes1
answer107
viewsWhat is callback called in javascript when it is named (directly in the statement)?
What callback is called in javascript when it is named (directly in the declaration)? Example: Joint declaration of a function: function fn() { console.log(fn); // Imprime fn() return 'do'; } fn();…
-
1
votes0
answers94
viewsFunction with ajax does not fully load
I have a code that by clicking the button it opens a function in javascript. In this function, a part of the code uses Ajax. I need that, after clicking this button, that code changes the color of…
-
1
votes2
answers1150
viewsPass pythonic form parameters
The database driver I am using returns the data of a record in the form of an example tuple ('João', 32, False). I’m thinking of a pythonic way of passing this data to the constructor of a Person…
-
1
votes0
answers68
viewsReload, Hyperlink
Hi, I’d like to know how to get the message from window.onbeforeunload without the option of Prevent this page from creating additional dialog boxes, for all ways to exit the page with for example,…
-
1
votes2
answers129
viewsHow to do operations between functions in C?
The function funA() stores a value entered by the user. The function funB() will allow the user to choose an option. My difficulty is in the third function: I need to create a function that…
-
1
votes2
answers1085
viewsHow to test whole arrays in javascript?
Good night! I need to create a function that accepts an array of numbers and returns true if it contains at least an even number and false, otherwise. The code below even does this, SQN: var…
-
1
votes2
answers222
viewsWhat is the difference between this and var within a Javascript class?
tell me which one to use, which ones are used in good programming practices. I write in javascript but I usually use one and the other in the same code... Eae?…
-
1
votes1
answer266
viewsIs there any way to know how many times the function has been called?
I wonder if in PHP there is any way to find out how many times a certain function has been called. I speak natively as I would also like to do this check for native functions. Example:…
-
1
votes1
answer2495
viewsFunction reverses numbers in array
How this function works in c reversing the numbers? void inverte(int vetor[MAX], int n) { int i,aux; for (i = 0; i < n/2; i++) { // troca posicao i por n-1-i aux = vetor[i]; vetor[i] =…
-
1
votes2
answers70
viewsHow to insert the connection inside the functions without repeating the instructions?
Since I have several functions that will use this connection, how to enter the $pdo within the function without copying the require and $pdo within each of the functions that I will draw up?…
-
1
votes1
answer865
viewsFunction/Method to change a variable from another PHP file?
I have a login page that takes a variable from another file, which at the beginning is empty, and puts below the login screen. If the user misses login/password or does not enter anything, the…
-
1
votes1
answer40
viewsHow do I take information from a website and distribute it in a view?
I made a function that receives data from the database as parameters passed by $_GET[] ... How can I use this information elsewhere in my system? function db_tratcontent(){ $slug =…
-
1
votes1
answer1923
viewsReturn javascript object
var Mensagem = function(opcoes){ var padrao = { titutlo: "", msg: "", lido: false } var config = $.extend(padrao, opcoes); this.prototype = config; } var msg = new Mensagem({ titulo: "Olá mundo!",…
-
1
votes2
answers276
views -
1
votes1
answer94
viewsHow to take the otido value in a function and put in a text, Javascript?
I can show in Alert but qnd I will put in text (temp2), will not! function mostrarValor(){ var escalaEntrada = getRadioValor('escalaEntrada'); var escalaSaida = getRadioValor('escalaSaida'); var…
-
1
votes2
answers1328
viewsCalling javascript function with null parameter
The function verificaCampoVazios has two parameters (fs and campos). verificaCamposVazios = function (fs, campos) { console.log(campos[0]); } Example of how it is called function:…
-
1
votes1
answer60
viewsCall class function: Minpdo::connect();
I have a class called MinPDO and within it a function called connect: class MinPDO { public $sgbd = "mysql"; public $dbhost = "localhost"; public $dbname = "minpdo"; public $dbuser = "root"; public…
-
1
votes1
answer418
viewsFunction int(*Cmp)(void*,void*)
I know it compares pointers and returns an integer that determines whether one is smaller than another, in order. But, when I will use it in main(), is giving some error. Can help me?…
-
1
votes0
answers16
viewsTransfer file from server to client and send to LPT1
I need help with a function that does the following: I have a file .txt on disk C: server Send this file .txt for a client machine Send the content from .txt to the door LPT1 customer’s Currently…
-
1
votes1
answer360
viewsYou can use a foreach of a query within a function
I have a query simple: $Consulta = $pdo->query(" SELECT * FROM dados ")->fetchAll(); foreach ($Consulta as $key) { echo $key["InfoDado"]; } If you execute the foreach of it out of a function!…
-
1
votes1
answer26
viewsRelease parameter on striptag
I would like to put an exception in this function, to release insertion of <iframe>. This function that I use for general Forms, decreases the chance of injections, clears the spaces and tags…
-
1
votes1
answer334
viewsOperator & and * in functions
What is the meaning of this & in front of the matrix (my function only works with &, I am overloading Cout<<(matriz1 + matriz2)) And the meaning also of the * in front of the void?!…
-
1
votes1
answer240
viewsAccentuated error - Search ZIP - Magento
Hello, I’m doing an address search through the zip code in a function, then I pick up the result and create a session with the name of the city and the state, acontce that every time I have a city…
php magento character-encoding function accentuationasked 8 years, 8 months ago Quebrando Cabeca 131 -
1
votes1
answer146
viewsKeep variable value between layers of a function
I wanted to make a site where when I click on the image it doubles in size and width, but can do this only once, and if I do more, a warning appears preventing it. Similarly, if it is the default…
-
1
votes1
answer102
viewsRecursion and sum
I am making a program in which you need a recursion according to the exercise that sums a vector of two matrices and sums the rows after the recursion and then add the columns to my code #include…
-
1
votes0
answers19
viewsParameter with default value in Java
In other languages, such as javascript, it is allowed to make a function by passing a parameter with a default value, as in the following structure: function myFunction(value = true){ //alguma ação…
-
1
votes2
answers124
viewshow do I make a table go showing tables
wanted to do a function that makes kind of something like the thing below for i in pairs(v) do if type(v[i])=="table" then for j in pairs(v[i]) do if type(v[i][j])=="table" then print("...") else…
-
1
votes1
answer74
viewsfunction result is given as Undefined in javascript
I have the following code : function calculaDiasDeVida(idade) { var dias = idade * 365; }; function calculaBatimentos(dias){ var batimentos = dias * 24 * 60 * 80; }; idade = parseInt(prompt(nome +…
-
1
votes0
answers42
viewsReset functions?
On a supposed page where all the content all the site is loaded in dynamic Ivs without the refresh need, when closing one of these Ivs it is possible to reset the Function that added the content to…
-
1
votes1
answer172
viewsFunction return type for a chained list
What kind of return to use in a chained list? For example, insert at the beginning of the list. void inserir(pessoas **pessoa, int valor) no return (void). Or return a pointer from the list.…
-
1
votes1
answer48
viewsWhy isn’t this Function working?
I am layman and am learning Javascript for a app simple hybrid. The first obstacle is a Function that is not running: The one whose name: function calcular(){ //ap1 =…
-
1
votes1
answer707
viewsPass variable Angularjs through JS function
I have a dynamic modal in Jquery that is called with the onclick="ShowModal()" is working. However, I want to send values coming from Angularjs and cannot. It sends the code Angularjs…
-
1
votes1
answer1897
viewsHow to use pointer and vector in a single struct in C?
I cannot run a program that needs functions to execute a procedure, this function receives a vector of type struct by means of a pointer. There is no build error, but the program hangs while running…
-
1
votes0
answers282
viewsfunction that returns the name of the key field of a query (tfdquery), Delphi XE8
I’m preparing a CRUD in Delphi and need to do a function to find the key field (Keyfield) of a certain record located in the query. The idea is to replace the id field required by Locate with this…