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
-
0
votes1
answer113
viewsGPIO Pins Rpi 3 Python
I’m starting with a project with my rpi 3 that concise in using engines connected to the rpi3 gpio pins! In my code there is some error connected in the mode of the pins, but I do not know how to…
-
0
votes1
answer341
viewsCatch table name with Trigger/Function in Postgres
I am implementing a simple replication form of two tables or more. I have the table replication which has the table name to be replicated and id. To feed the table replication I have a Rigger in…
-
0
votes1
answer87
viewsDisplay image on Twitter Wordpress Cards without plugin
I have this code, to add Twitter Cards without the need of 1 plugin, just adding the code in functions.php. The code works, but the image of the article only appears if attached to the post. I would…
-
0
votes1
answer82
views -
0
votes1
answer276
viewsPostgresql PL/PGSQL function
I have the following function : create function sppreenchecombomunicipio(p_uf text) returns TABLE(MUNICIPIO text, COD_MUNICIPIO int) AS $$ begin return query select tb_municipio.municipio,…
-
0
votes2
answers659
viewsProblem using print to show function result
I’m creating a function that scrambles and returns the typed word, but I don’t know how to use the print (if this is really the case) to show the result of the function below: def f(): a = [] x = 0…
-
0
votes0
answers62
viewsDefault acceptable parameter set in PHP function
In the example: public function getEstoqueDeposito($busca, $deposito = FALSE) { ... } I know what I could do: public function getEstoqueDeposito($busca, $deposito = FALSE) { if($busca == 'TOTAL'){…
-
0
votes1
answer51
viewsError-free JS animation on console, but does not work
Well, I am creating an animation of the Tank of the classic Metal Slug, however, when creating the function and executing it to animate the tank, nothing happens. What’s wrong, and how can I fix it?…
-
0
votes1
answer54
viewsJavascript, or other way, to delete a certain line of the html code, and create another in the same location as the previous one
I need to know if there is a function that selects a specific line of code HTML to delete it, when to fire the function, and something to create a new line of code in the same place gives erased…
-
0
votes1
answer27
viewsBring Back between two functions - Javascript
Hello, I have the fuction list , which brings a GET url in another Function.. How do I get the return of {data.name} out of the Function list ?This form below does not return :/ function list(){…
-
0
votes1
answer24
viewsFunction to search character
I’m trying to write a function that returns the index of the character. For example, I want to fetch the index of 'a' the fifth time it appears in the text. This is my code: int buscaChar (String…
-
0
votes2
answers710
viewsOperator in postgres function returns SQL Error [42883]: ERROR: operator does not exist: integer = integer[]
I have the following error in a function postgres SQL Error [42883]: ERROR: operator does not exist: integer = integer[] I tried to convert the data to varchar and text but still I could not return…
-
0
votes1
answer763
viewsWarnings when compiling the program
In the code below, I need to create a structure for Point (Coordinate x and y) and create a function that creates these points using pointers. The structure was made as follows: typedef struct…
-
0
votes2
answers35
viewsMenu close reads target as Undefined
I am mounting a simple menu that ends when clicking on "Document", however, it appears that the target property cannot be read to Undefined "Uncaught TypeError: Cannot read property 'target' of…
-
0
votes2
answers2574
viewsIs there a command to finish the program in Python?
For example, I’m writing a code def soma(): n1=int(input('digite um numero')) n2=int(input('digite outro')) soma = n1+n2 print('A soma de {} e {} é {}'.format(n1,n2,soma)) #começo do programa…
-
0
votes1
answer357
viewsNo return function in Matlab
I need to do a function in Matlab where it will have no variable as return, only parameters, it is possible?
-
0
votes2
answers861
viewsPass ids as parameter to Function js
I have a function that you would like to receive the id values of some quantity, unit value and result fields. But I’m not getting it. ` String.prototype.formatMoney = function() { var v = this;…
-
0
votes0
answers31
viewsProblem in generating the plots in dynamic inputs
I’m trying to recreate the code below based on one that I analyzed, but it’s not working. I think there is an error in the structure! I need a help. <script> function start() { var select_prog…
-
0
votes0
answers53
viewsHow can I make a function that "calls" pre-existing spreadsheets in the R program?
Good morning, I’m new to using the R program, so I have a basic question. I want to do a function that uses an existing spreadsheet to pull some data that will be important for the calculation I…
-
0
votes1
answer42
viewsUse a php function that is in a different domain
Boas. I need to use a function that’s in a file php in a different domain http://exx.exemplo.com/pasta/ficheio_da_funcao.php on another site that is http://meusite.com. What the function does is…
-
0
votes2
answers79
viewsConstruct/start object via string parameter in a function
I need to start objects dynamically with Javascript Ex: Example class: function sayhello() { this.init = function() { alert('Hello'); } } Function to dynamically load and instantiate classes:…
-
0
votes1
answer2113
viewsUse a function variable in another python function
I want to pull what is in the variable 'file' in the function 'Function' and play in the filename of the function 'send_email', how can I do this? def function(event): arquivo = open('log.txt', 'a')…
-
0
votes1
answer191
viewsError when compiling C++ source code along with header file and member function file
Hello I would like a help with this exercise code. This is my first time trying to ask a question here. When I try to compile the file with the member functions Gradebook.cpp or the file containing…
-
0
votes2
answers57
viewsProblem in a function parameter
#include <stdio.h> #include <stdlib.h> int pos_setinha(int x); void menu(int x); int main() {int x=0; do { menu(pos_setinha(x)); } while(1); } int pos_setinha(int x) { x=0; char C;…
-
0
votes1
answer81
viewsFunction Postgresql
I need to create a Function() in my bank PostgreSQL so that whenever there is a movement of INSERT or UPDATE this function is activated in a given table through a TRIGGER so that in my log table are…
-
0
votes2
answers32
viewsphp fetch <p> content
How can I catch the 'Valoor' <p id="sinopse2" style="display:block !important;">VALOOR</p> I tried that code: preg_match_all("#<p id=\"sinopse2\">(.*?)<\/p>#s", $string,…
-
0
votes1
answer43
viewsChained list returning empty outside function
I’m trying to read data from a file .obj and insert into a chained list, I have a function to read and within it I call the insert function. When I call the function of printing the list inside the…
-
0
votes1
answer84
viewsGenerate all possible paths
In an exercise, I need to print, in a file, all the trajectory possibilities between a number N of cities, each city being represented by coordinates x and y and that the last city should be the…
-
0
votes1
answer43
viewsDoubt methods Javascript
Greetings I have a question about methods in javascript. Can anyone tell me if this is a method and what kind of method this is. nomeMetodo : function (){ //code } It wouldn’t be like this...…
-
0
votes1
answer317
viewsError in paging with custom post type
I have two Custom post type created, one for movies and one for series, I have a loop that shows both on index, only when I use paging, it doesn’t work. Ex. Push to go to/page/2 Only I get a 404…
-
0
votes1
answer154
viewsDecrease memory usage of recursive functions in PHP
I have a recursive function in PHP where it loops into an api where it only allows you to retrieve 200 records at a time. However as this API has a very high response latency we decided to use a…
-
0
votes0
answers70
viewsCalculate all distances
In an exercise, I need to calculate all distances between coordinate points (x,y) which are read from a file, the last point of which coincides with the first. Each point represents a city that is…
-
0
votes0
answers52
viewsFunction to return total sales
I have this function that returns me the amount of sales of a cnpj month to month in the year 2018, I would like if possible someone would help me implement a variable in this function, which takes…
-
0
votes2
answers203
viewsGeneric function js
Good afternoon, I have a question related to creating a function for generic use in javascript, the function is this here: function calcular() { var_quant = 0; var valor =…
-
0
votes1
answer44
viewsPrinting the shortest distances
The exercise asks me to print the smallest routes between n cities, whereas the latter is the same city as the starting point. First, I need to read an input file like the following: 5 1 10 4 4 5 1…
-
0
votes0
answers32
viewsReference passage
In an exercise, I need to compare a certain number of distances and tell which are the smallest and print them out. For this, I have the following function: void Permuta(FILE *saida, Cidade *C, int…
-
0
votes1
answer27
viewsPlace the Angularjs switch function inside while php loop
I put the swicth function of angular, inside while in PHP. When executing only the first loop that works the rest of the function does not work. I’ve put the different ng-app and ng-controller names…
-
0
votes2
answers1138
viewsJquery - Make ENTER trigger a button
I have a code in Javascript/Jquery that I wanted to also execute the function or when clicking the button, or that the button was triggered with enter when typing. Detail that this is just a test…
-
0
votes0
answers44
viewsPass Javascript values to an Asp.net class
I need to create some buttons dynamically in c# and pass to them some event, that by clicking them pass two values to a select variable to bring x number of lines of the same the class with select…
-
0
votes0
answers149
viewsCheck for the word in the string using string array and separate the string in a new array
I’m in a problem where I want a string to become an array with separate words, only the code returns duplicate arrays var string = 'xicara,cafecafe'; var array1 = ['casa', 'xicara', 'xicarada',…
-
0
votes3
answers87
viewsI cannot pass Methods as Parameter in PHP
I have the following code <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class DatesController extends Controller { //Função que calcula o inicio e o fim da semana a partir do…
-
0
votes2
answers767
viewsHelp with code implementation and functions
Dear friends I really need a help, follow the details: Vehicles may enter or leave the ring road only if they are in the outer lane of the ring road (lane 1). Vehicles can only develop high speed…
-
0
votes1
answer461
viewsNodejs return function - Mysql query
I’m not able to return value in function, I know it’s wrong, but I’ve made several unsuccessful attempts. The query is being performed and brings the password, the problem is to return this value to…
-
0
votes3
answers784
viewsHow to return an object using the object name as a function parameter?
good night! Can anyone tell me how to return the object using a type invocation: book (booklet 1); function book(bookName) { var obj = { livro1: { quantidadePaginas: 300, autor: "Jorge", editora:…
-
0
votes2
answers418
viewsError . class expected
The program is supposed to ask for a number between 1 and 12. (I haven’t gotten to the part of certifying that it’s between 1 and 12 but this is the easiest.However I’m supposed to write the code…
-
0
votes0
answers1019
viewsReturn a matrix of a function in C
Hello, I am doing a program in C that requires to be modularized, that the user registers the desired courses, prints on the screen the courses,but I want to use the matrix of courses, in another…
-
0
votes0
answers360
viewsCall a method of a class from a function within the class itself? C++
I created the "checkCase4" function in my Tree class and within it I make 2 class methods (rotate_left and rotate_right). Function: void checkCase4(Node *child, Node *grand) { if (child ==…
-
0
votes1
answer41
viewsProblem to enter Switch
Good afternoon, when running the program below, after typing the third note, the program ends without typing the letter needed to enter the switch. I tested with "i" getting whole number and the…
-
0
votes1
answer41
viewsProblems accessing struct members
I have to do some functions with these structs, but since Agenda has a contact struct array and in each contact has another data struct, how do I access the fields? Do I have to work each struct…
-
0
votes1
answer95
viewsDoubt about the onCreateOptionsMenu method
Could someone explain to me the purpose of this method? onCreateOptionsMenu I’ve researched several sites (in the documentation of Android too), but still not clear what the purpose of this method.…