Most voted questions
150,413 questions
Sort by count of
-
7
votes3
answers162
viewsAnother alternative to not repeat this "function" three times?
Make a program that reads three vectors with 10 elements each. Generate a fourth vector of 30 elements, whose values should be composed of the interspersed elements of the three other vectors.…
-
7
votes2
answers347
viewsDoubt about the use of the Join method
I’m doing a Javascript course and I came up with a question in one of the exercises. Below is the exercise: Given the following object array: var usuarios = [ { nome: 'Diego', habilidades:…
-
7
votes2
answers99
viewsJavascript . NET Zip() method
I was reading that question and I noticed there’s no method Zip in Javascript, I would like to know how to implement a method that works the same way or if there is some other function that does the…
-
7
votes2
answers421
viewsHow to apply conditions in this string template?
Currently I own this object: const messages = { required: field => `${field} é obrigatório e naõ foi preenchido!`, } That prints the following value: name é obrigatório e não foi preenchido! I…
-
7
votes2
answers138
viewsWhat is the Enumerable Zip in . NET?
I was making a code to combine two lists, and looking to improve discovered the method Zip of the interface IEnumerable. At first I thought it was some algorithm to "zip" a list/array/etc., but I…
-
7
votes1
answer1023
viewsWhat is a Great Algorithm?
I’m taking classes from Introducing the Analysis of Complexity. I was told that an example of an optimal algorithm is the algorithm for finding the smallest value between elements of an array of…
-
7
votes2
answers102
viewsDo partial imports bring advantages to the application?
Some languages have as a resource the import of parts of the library used. Using Dart as an example we have two types of partial Imports showand hide . import 'package:google_maps/google_maps.dart'…
-
7
votes1
answer140
viewsIs the purpose of the inheritance reuse?
Many say that the goal of object-oriented inheritance is to promote code reuse, but I believe this is a mistake. I remember (or think) reading that the goal is NOT reuse but I don’t remember now…
-
7
votes1
answer68
viewsWhy is there result divergence depending on how the regular expression is executed in Javascript?
What is the reason for the result divergence found when executing the same regular expression in different ways in Javascript? Regular expression:…
-
7
votes1
answer1853
viewsWhat does the number returned by System.currentTimeMillis represent?
I went to read the documentation, made available by IDE and came across this: It is said that the method System.currentTimeMillis returns: the Difference, measured in milliseconds, between the…
-
7
votes2
answers97
viewsHow to see the implementation of the Typescript code?
In several programming languages that I have worked or currently work with, I can see the implementation of the developed codes. In Dart or Java for example, I can go to the source code and analyze…
-
7
votes2
answers116
viewsWhat happens when we assign the default value to objects?
Example: public Carro Metodo(string marca) { Carro carro = default; if(!string.IsNullOrEmpty(marca)) { carro.Marca = marca } return carro; } Studying on the Internet, I realized that some objects…
-
7
votes1
answer84
viewsDoubt about prototype
I have a basic question in prototype in Javascript, is the following: function MeuObjeto() {} obj1 = new MeuObjeto MeuObjeto.nome = "Lucas" console.log(obj1.nome) Upshot: Undefined I am in doubt as…
-
7
votes2
answers1109
viewsDo if by denying a boolean in Python
How do I make for the if check a boolean negation, as below: self.senha = Gugu_0099 for i in self.senha: if i.isdigit() and i.isalpha(): total_simbolos += 1 I want you to get into this if if the…
-
7
votes6
answers19845
viewsHow to change the name of the pandas dataframe column?
I am using pandas to process a CSV file in the following structure: nome;idade Fulano;28 Joao da Silva;27 Maria;29 The reading of the file is done as follows: import pandas as pd df =…
-
7
votes2
answers1052
viewsWhat is the difference between foreach and map in Javascript?
const arr = [1, 2, 3, 4, 5] arr.forEach(i => i); arr.map(i => i); I’d like to understand the difference between the methods forEach and map in Javascript.…
-
7
votes1
answer458
viewsIs webview useful to use as an application UI?
Context I saw a Steve Sanderson’s article about an experimental project called Webwindow that uses a Webview component available on the operating system to use as the UI of an application. This is…
-
7
votes3
answers15990
viewsMascara CPF/CNPJ ANGULAR 8 NG-MASK
I have a Component where I need the input to have the mask for Cpf or cnpj according to the data entry. I am using ng-Mask, but my validation for the mask is only working for the first validation.…
-
7
votes1
answer404
viewsWhy are certain languages faster than others?
I’ve heard a lot about how C is faster than C++ and Java, Lua is the language of script faster, among other examples. What makes certain languages faster than others? What defines a language as…
performance characteristic-language language-independentasked 4 years, 10 months ago NinjaTroll 1,752 -
7
votes1
answer364
viewsProblems with CORS in Django using AWS S3
My application uses a Bucket on AWS to host the static and MEDIA files, here’s the link: http://memoriasclubeturismoenv.us-east-2.elasticbeanstalk.com/gilson-rolim-02-12-2019 or…
-
7
votes1
answer1265
viewsWhat is "Prop Drilling"?
I believe the term is related to passing properties between various components, but I don’t understand exactly. What is "Prop Drilling"? How to avoid it? It is a common practice?
-
7
votes3
answers557
viewsContinue loop if input is’S'
I tried to make a loop, that while the input is’S' it comes back and prompts again (it’s just for me to learn), if the input is 'N' it comes out of the loop, but is in loop infinite. continuar =…
-
7
votes1
answer92
viewsHow to detect when the textarea has more than one line?
I’m doing a chat, and I came across the following problem, my textarea when breaking a line, whether the user press enter or not have enough space and jump to the next line, my textearea does not…
-
7
votes1
answer202
viewsWhat is a convention on configuration?
Currently I see that some frameworks, libraries and systems use the concept of convention on configuration, from which I raised the following questions What is a configuration convention? What are…
-
7
votes2
answers650
viewsAdd 1 month function in php fails when current month has no day 31
In this code PHP, I am checking the type of recurrence of an activity contained in a list of activities, and adding 1 month when it is monthly recurrence, 2 months when it is bimonthly recurrence…
-
7
votes2
answers142
viewsWhat does byte* mean?
I’m studying cryptography and I took an example in AES. In the code is this byte* and even *variavel and I couldn’t understand what it meant. This is the block that uses this, quoted above: byte*…
-
7
votes1
answer94
viewsWhat are the differences between ways of manipulating huge strings with Python?
When it is necessary to work with strings very large it is normal to see approaches that seek to optimize the process in some way. Of the approaches I have seen are using: io.StringIO or io.BytesIO…
-
7
votes1
answer88
viewsCan qubit be represented in Boolean?
A bit can have only two states: true and false. In quantum computing, the qubit, or quantum bit, in which you can assume true and false simultaneously. How this is represented in boolean form? Or…
-
7
votes1
answer116
viewsAre the new self-contained . NET executables really native?
In that question here, was discussed about whether there is a need to install . NET 5 (or .NET Core 3) on the machine to run compiled executables, and the answer is: No, the . NET 5 is not…
-
7
votes3
answers189
viewsGlobal and local scope variable
If I print the global scope variable within a local scope, I am not allowed to redeclare again in the local scope. Why? For example, if I do: let a = 2; { let a = 3; console.log(a) //aqui aparece 3…
-
7
votes2
answers634
viewsHow to use different . Kv files in a Kivy application?
I am trying to create a game using Kivy in Python language and I would like to know how I can use different files .kv to be used in the application as levels for the game. Example: main.py game.kv…
-
7
votes3
answers1161
viewsHanoi Tower - How does this recursive solution work?
Could someone explain to me the logic of this recursive function? I’m not getting the idea from if down. The code solves the problem of the Tower of Hanoi: def toweOFhanoi(disc,ori,dest,aux): if…
-
7
votes1
answer136
viewsWho regulates W3C or WHATWG web standards? Or neither?
I always thought that whoever ran the standards was just the W3C, but it seems that’s not quite it... I saw that there is also the WHATWG (The Web Hypertext Application Technology Working Group)…
-
7
votes3
answers329
viewsHow to return the number of arguments and sum the values of the arguments in a javascript function
I need to know how to return the amount of arguments. Examples are: list(red, green, blue) Returns 3 list(1,45,33,50) Returns 4 It is not possible to know the amount beforehand…
javascriptasked 5 years, 1 month ago user161306 105 -
7
votes4
answers138
viewsCount inside an array with values from another array
I would like to realize a Count of the values contained within the array1 with the array values nomes, but he’s returning me an output with the strange values SCRIPT array1 = [ 'VALUE1', 'VALUE1',…
pythonasked 5 years, 1 month ago Luis Henrique 697 -
7
votes1
answer88
viewsWhat is the advantage of PHP objects being passed by default references?
From PHP 5 an object variable no longer contains the object itself as a value. It contains an object identifier that allows the object’s "accessors" to find the real object. I recently went through…
-
7
votes1
answer309
viewsRunning time of an algorithm
def isprime(n): # 0 and 1 are not prime if n < 2: return False # 2 is prime if n == 2: return True # even numbers are not prime if n % 2 == 0: return False # test if any odd number between 3 and…
pythonasked 5 years, 2 months ago mayconrralves 73 -
7
votes1
answer327
viewsWhat does the "MZ" listed at the beginning of executable code mean?
In the good times of MS-DOS I executed the command type <nome-do-arquivo> in archives .EXE and a lot of ASCII (binary code code code code) characters started by the acronym MZ. I always…
-
7
votes3
answers1969
viewsWhat’s the difference of using background to background-color?
I have that code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta…
cssasked 5 years, 2 months ago Dom Domdomdom 192 -
7
votes2
answers600
viewsPrint only the last two digits of a year
How to make the year have only two digits? data = new Date().getFullYear(); console.log(data); console.log(data.substr(2,4));…
-
7
votes1
answer190
viewsHow do I pause a script when I leave the page?
I have a Javascript function that loops, it controls one element of the page that switches places with another, my goal is when you leave the page, this function stops and only comes back when the…
-
7
votes2
answers175
viewsRemove HTML snippet between specific comments
I have a class called Page(page.class.php) that "mounts" the page, and one of the functions of that class is to censor content by user level. <?php class Page(){ //(...) static function…
-
7
votes1
answer2211
viewsIs there a module function of a number in C#?
Example : module of -1 (|-1| = 1). I’ve done some research on the internet but all I think is the division module (%). I am trying to circumvent the common way of passing a negative number to a…
-
7
votes2
answers161
viewsHelp Using List Comprehension/Dictionary
Hello, I have the following module (did not want to put all the code here) in Python >= 3.6. It is already functional in the current state, although it does not handle all possible errors. But I…
-
7
votes2
answers2558
viewsHTTP status for registered user
What status should I return to my API if a user tries to register with an existing user name or email in the system?
-
7
votes3
answers547
viewsWhy does the "text-align: center" property work in image?
I don’t understand why text-align: center is centering the image because this property is not used to center text? because it centralizes the image too? I created an example. @charset "utf-8";…
-
7
votes2
answers283
viewsUse of empty "print()" in place of " n" before conditions
Have a problem using print() before conditions instead of using \n. For example let’s say I have something basic like: `idade = int(input('Quantos anos você tem?')) if idade > 0 and idade <…
-
7
votes1
answer260
viewsWhat is Data Science?
The Stack Overflow matrix has a site called Data Science SE. I, who am an active member of the tag R, I realize that there are few discussions on this subject elsewhere in the Brazilian version of…
-
7
votes1
answer689
viewsDifference between @Deprecated and @deprecated
What’s the difference between @Deprecated as an annotation in the class and @deprecated in the documentation of the same? When to use one and when to use the other? /** * Combo box that shows the…
-
7
votes4
answers388
viewsHow can I add a hyphen between all even numbers of a value?
Good morning, could someone help me with a code please, I need to insert a hyphen (-) between two even numbers. For example, if you receive the number 02368859 as input, the output of the program…