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
answer71
viewsExtending javascript function with parameters
I wonder if it is possible to extend a javascript function without having to repeat the parameters, as if it were a constructor, I currently use it like this: function DefaultRun(args1,args2) { }…
-
0
votes2
answers28
viewsDeclare variable value in function call
I don’t know how to call this to Google search or if it is possible to do this. I have an object that is as follows: var clear = { Search_r: false, Search_f: false, Search_e: false } And I have the…
-
0
votes1
answer31
viewsJS - Target object as function argument
I come from C# and I’m having a hard time understanding this concept of passing the target object as a function argument. In the examples below, the first works, as I do to assign the function…
-
0
votes3
answers872
viewsHow to validate if a value is a tuple having a string and an integer?
I want to write a function that takes an argument (any type) and returns true if the argument is a tuple (double elements, double elements of 2), where the first is a name (str) and the second is an…
-
0
votes0
answers53
viewsCan anyone help write this program in python that involves tuples?
I am writing the python "check" function, which takes an argument of any type and returns True if that argument is a Tuplo whose elements are pairs (2-element doubles), where the first element is a…
-
0
votes2
answers42
viewsHow to obtain the value of the variable outside the function?
How to get the value of var DI out of office? I’m a rookie, and I curled up.. I need to include it in another function but I can’t get the value out of it :( $(document).ready(function () { $.ajax({…
-
0
votes0
answers52
viewsWhat is the asterisk for as "parameter" in Python functions?
I was reading the documentation of version 3.8 of Python, in the part of the new syntax for positional parameters, and found the following function: def f(a, b, /, c, d, *, e, f): print(a, b, c, d,…
-
0
votes1
answer122
viewsHow to transfer data from one function to another?
The initial idea of my personal project was to develop a basic system to carry out the payment division between n customers who consumed n products, in order to train my skills. For this, the…
-
0
votes1
answer8005
viewsHow to create a python function to connect sql server?
To summarize the connection process, I’m trying to create a function to connect the data bunch, but I’m not able to make the connection as expected: def conectar_com_banco(usuario): if usuario in…
-
0
votes1
answer63
viewsA function that does the opposite of an addition mod 2³²
def mod_2to32sub1(x): s = 0 # the sum while x > 0: # get the digits s += x & (2**32-1) x >>= 32 if s > 2**32-1: return mod_2to32sub1(s) elif s == 2**32-1: return 0 else: return s…
-
0
votes1
answer77
viewsLoad reply comment with AJAX without refreshing page
I am sending comments with AJAX and then loading it in the reply, works well, except that the reply link is not being processed on the page, after you click to publish reply the page is being…
-
0
votes0
answers45
viewsHow is the function returning the name?
As the function fala_oi is managing to return the nome? def mestre(funcao, *args, **kwargs): return funcao(*args, **kwargs) def fala_oi(nome): return f'Oi {nome}' executando = mestre(fala_oi,…
-
0
votes1
answer333
viewsHow to hide a URL ID
I have a function that captures the ID of the URL and makes the query in DB and returns the value on the page, how to do this query without appearing the ID in the URL? Currently this way:…
-
0
votes0
answers32
viewsBucket Sort C help me
Good afternoon everyone, I would like to thank you first because you have already helped me a lot, but I need your strength again. I have a work in which I must use the ordering method Bucket Sort…
-
0
votes1
answer43
viewsHow to add a number to an array?
Hello! All right with you? I’m making a code and I needed to define a function: def sigmoid (v): return 1/(1+np.exp(-v)) Only what I’m assigning to the function is an array 2d. My question is: in…
-
0
votes0
answers20
viewsWhat is the role of get before a function?
I am a beginner in the Back-end, and I am in doubt in a code that was listed in the class, I would like to know what the get before function id() const sequence = { _id: 1, get id(){return…
-
0
votes0
answers13
viewsDoubt about this and Arrow Function
Good afternoon, I have a question about this and Arrow Function. For example: const user = { age: 32, halfAge(){ return this.age/2; }, doubleAge: () => 2 * this.age; }…
-
0
votes1
answer259
viewsHow to create a Function that calculates CRC16 in SQL Server?
can tell me if there is any sql function that calculates CRC16, the calculation method is listed as "CRC-CCITT (0xFFFF)". CRC-CCITT (0xFFFF) -> polynomial: x 16 + x 12 + x 5 + 1 I tried to create…
-
0
votes1
answer355
viewsUncaught Argumentcounterror in construction
I’m trying to list the database data, only when I try to list it returns the error: Uncaught Argumentcounterror: Too few Arguments to Function processes::__Construct(), 0 passed in When I declare…
-
0
votes1
answer45
viewsFunctions with ajax make loop for stop running
I have a function that executes when I click a button. When clicking, the function should execute a loop for and if the value of that position of the for correspond to any of the ifs then it…
-
0
votes0
answers13
viewsHow do I interrupt a python function?
The problem is this: I want to make a function not make its execution complete if a certain condition is met. Example: a = 1 def function(): if a is 1: pass #aqui seria o local onde que a função…
-
0
votes2
answers48
viewsPython: upper and Lower function do not work
I’m conducting experiments on Python and this time my targets were the functions that handle Strings. In my tests, I’m trying to make a text converter, however, the functions are not performing…
-
0
votes1
answer13026
viewsWhat solution to the error: "A non well Formed Numeric value encountered"?
function exemplo() { $premio = "Jose ganhou na lotérica 2.000.000,00 mais gastou 1.000.000,00 com quanto josé ficou? <br>"; echo $premio; $smtNumero = explode('na lotérica ',$premio);…
-
0
votes1
answer347
viewsHow to chain async functions in typescript?
I have two asynchronous functions A and B. How do I initialize function B only after function A is complete? import { Component } from '@angular/core'; import { Options } from 'fullcalendar'; import…
-
0
votes1
answer1217
viewsFunction to invert vector c
I’m a beginner in c and I’d like to know what’s going wrong with my code. I know I did a trick on the job, but that’s where I got the closest. #include <stdio.h> void inverte(int vetor_A[ ],…
-
0
votes2
answers215
viewsWhy can’t I pass a matrix as a parameter of a function in C?
Dear friends, today I have come across a problem I cannot understand. When trying to pass an array as a parameter, I cannot access the values of the elements, I always access the memory addresses of…
-
0
votes1
answer27
viewsResponsive navbar does not appear when changing window size
I’m doing a full header with grid. The problem is I made a hamburger menu. So I made this function to click it appear and click again it hide. However if I enlarge the window(resize) after clicking…
-
0
votes1
answer30
viewsParagraph disappears quickly after executing function
Hello, I would like help with my code, I’m starting in js. I would like to show an arithmetic progression, but when I run the function by clicking the button, the answer shown in the paragraph with…
-
0
votes1
answer1068
viewsList and Access Python subdirectories
Good afternoon guys, I’m trying to create a very simple text file management system, but in some of the difficulties I am found is accessing and manipulating files in subdirectories. Below I have…
-
0
votes1
answer60
viewsPass function by validation function in php
Good, I have a class "Entity", where I have the property "Phone", for the phone, I have a function the part that validates the phone number "isvalidTelephone", I also have a function that prints all…
-
0
votes1
answer25
viewsFunction does not recognize the structure created in main
I made a system and created a two Structs to store data of people of a hotel, but when trying to organize them in order of weight the system gives the following error: line 100 error: incompatible…
-
0
votes1
answer386
viewsAdd values of 2 fields, click on the button and appear the result in a third field
I would like to add the values informed in two fields/inputs click on the button and the answer appears in another field/input. I can’t figure out what’s missing in the code below. <!DOCTYPE…
-
0
votes1
answer177
viewsIf function with decimal numbers
I am a designer and an adventurer in programming and eventually adapt some codes in projects. I have a situation here that I couldn’t handle on my own. The following code analyzes the value entered…
-
0
votes1
answer91
viewsCreate a recursive function to accuse the occurrence of an element in a matrix
I have some problems creating a recursive function that accuses the occurrence of a requested element. So far, this is what I’ve been able to do (perhaps I’ve made some mistake with pointer…
-
0
votes3
answers189
viewsFunction to print the number of characters in a two-dimensional string
By the enunciation of the exercise, I must use as the second argument char **strings, I believe that there is my confusion, in manipulating her to count the size of string. (I did other tests with…
-
0
votes1
answer52
viewsJavascript - function that retouches an object
I’m trying to pass a challenge and I’m having a hard time getting through the following topics: Write a function called createCars which will receive three arguments: name, stars and brand. This…
-
0
votes0
answers87
viewsI cannot add element to DOM through an anonymous function in JS
I created a table via javascript by manipulating elements of an array, which is all right, but I can only add the table in the DOM by a common function or an anonymous Jquery function, but when the…
-
0
votes1
answer63
viewsHow to convert a function to view
Good afternoon, I have the following function: if object_id('dbo.batidas', 'TF') is null begin exec('create function dbo.batidas() returns @retorno table(T int) as begin return end'); end; go alter…
-
0
votes1
answer21
viewsIf existing category adds in Menu - Woocommerce 3.6.4
I’m using the hierarchy: Samsung>S9 Plus, Category A The code only works at the following address: https://paginaweb.pt/categoria-produto/s9-plus The code is this: // adiciona produto ao menu se…
-
0
votes1
answer221
viewsQuestions about the use of C functions
I need to do an exercise that will basically ask the user to type two strings. Before that, an integer value X is entered representing the position from which the first string will be saved to the…
-
0
votes1
answer77
viewsFunction does not work with variable in parameter
Hello, I love programming, but I started programming recently. Recently we decided to make a major modification on the website of the company in which I am a partner. Everything worked fine, but I…
-
0
votes1
answer168
viewsProgram in C closing without explanation
I am doing a C program that aims to read a list of purchases stored in a text file and add the total value of the prices of the products. In each line of the file has, the product name, the quantity…
-
0
votes2
answers243
viewsProblem with accents and special characters, called Ajax
I have a function that makes an ajax call, and sends the data to be saved in the database, the problem is that whenever you save a word that has some special character or accent, it does not encode…
-
0
votes1
answer79
viewsHow to assign a script to a button?
Good afternoon! I am doing documentation and need a side menu button to show/hide a div. I tried this script here but it only shows/hides "Content 2" and never "Content 1": <script> function…
-
0
votes1
answer88
viewsDoes the shuffling function have traps not easily perceived?
The function shuffle receives as input a array and the shuffle. // function shuffle(a) { // atribui a variável n a quantidades de elementos da array a. n = a.length; // Percorre a array a da posição…
-
0
votes1
answer523
viewsRedirect to another Page With Avascript in a smooth way (slide, fade in , etc)
Guys down here is my code. the following happens: I am using a java function that automatically redirects the user to another page. turns out that when directing the user, the page transition was…
-
0
votes1
answer129
viewsFunction validate users registration
I’m starting in OO in php, and with the function below I’m trying to check if the name coming from the form is equal to some value coming from my user table before making Insert in the table. I wish…
-
0
votes2
answers246
viewsCalling a method within a Javascript method
Follows the class: class Advogado{ constructor(nomeAdv, tipoEnderecoAdv, ruaAdv, numAvd, cidadeAdv, estadoAdv, oabADV, estadoOabAdv, emailAdv){ this.nomeAdv = nomeAdv; this.tipoEndereco =…
-
0
votes1
answer70
viewsImplicit recursion when assigning the return of a function to a variable?
Speak guys, I’m starting studies in Python and I came across a behavior a little strange for me. It’s this: I have a file test py. which contains some functions. In another file, exempl1.py imported…
-
0
votes3
answers95
viewsI can’t use javascript in my html
I would like to connect a function to work with finite automata. The intention is that from the forms I can work with her js: var ListaNo = new function () { this.Nos; function CriaNo(idNo){ var…