Most voted questions
150,413 questions
Sort by count of
-
5
votes1
answer224
viewsIs it possible to start serverless-offline by Javascript?
The plugin serverless-offline is used to start a framework-based application Serverless. To start, the command is used serverless offline [options] or sls offline [options] Is it possible to start…
-
5
votes1
answer82
viewsWhat’s the difference between using and not using keys in string interpolation in PHP?
What’s the difference between? $fruta = 'tomate'; echo "{$fruta} é fruta<br>"; echo "$fruta é fruta<br>"; Why some programmers use the keys ({}) if the result without them is the same?…
phpasked 4 years, 10 months ago Jonathan Matheus 383 -
5
votes1
answer115
viewsAccess variable of a Function in another Function
I’m starting in Javascript and I’m having the following difficulty, I need to take a variable and access it in another Function. I have created a variable without specifying anything making it…
-
5
votes2
answers1699
viewsHow to compare each character of a Java String?
I’m creating a Java application where I travel through one String with a bow for and I need to check every character of that String. Example: for (int i = 0; i < texto.length(); i++) { char…
-
5
votes4
answers1335
viewsHow to use . replace() to remove Python strings
I’m doing a Coursera exercise in Python. In this exercise he asks to build a Python function that takes a string (word) and removes the punctuation symbols. It provides me a list of strings ["'",…
-
5
votes1
answer185
viewsWhat is the difference between creating an object from the literal form or from a constructor function?
I wonder if it has any difference or relevance between the two forms below in the construction of an object: Create an object from the literal form: let pessoa = { nome: 'Pedro' };…
javascript characteristic-language objects builder prototypeasked 4 years, 10 months ago felipe cardozo 275 -
5
votes1
answer348
viewsWhat is Pattern Matching?
I’m reading about the Pattern matching and I’m still very confused about this feature because it’s something new for me. Here are some examples: {:ok, result} = {:ok, 12} {:okay, 12} and 12 = result…
-
5
votes2
answers355
viewsWould using underline in C# be good practice?
The question refers to development pattern and good practices. I come from a Javascript and PHP world, work for 12 years with development, and I’m very used to using underlines _ variables, such as…
-
5
votes1
answer210
viewsWhat is the difference between %p and %d in C language?
Which means the memory address that appears with %p and the %d exactly? What’s the difference? int main() { int teste = 10; int *ptr = &teste; printf("%p\n%d",ptr, ptr); return 0; }…
-
5
votes2
answers123
viewsAccentuation using regex
I have the following function for name normalization function normalizaNome(nome) { var palavras = nome.match(/\b\w+\b/g), preps = ["de", "da", "do", "das", "dos"]; return palavras.map(function(e,i)…
-
5
votes3
answers97
viewsDoes Hoisting occur with the variable within the function or any other block command?
Keyword variable statements var does not directly have a local scope its scope is within the function that contains it or outside it the scope is global (var Hoisting). Like in the example below the…
javascriptasked 4 years, 11 months ago user181348 -
5
votes2
answers46
viewsInterpretation of Dive into Python on exceptions
Here is an excerpt from page 47 of the book 'Dive Into Python' about exceptions: "...You don’t need to Handle an Exception in the Function that raises it. If one Function doesn’t Handle it, the…
-
5
votes3
answers727
viewsIs it bad practice to store CPF and CNPJ in the same column of the database?
In a flow that allows the registration of natural persons and legal persons I have seen the two approaches, but I’m not sure whether it is a good practice to store the two information in a column…
database entity-framework modeling software-architectureasked 4 years, 11 months ago adamasan 2,069 -
5
votes2
answers74
viewsWhat it really means "from modulox import *"
As far as I know it matters all the classes and functions of a certain file without having to reference it in the code, right? But I’m beginning to think from modulo import * doesn’t mean that. I…
-
5
votes1
answer95
viewsGet equivalent expression to list(zip(list, Heights)) using the map() function
Be: heights = [x*0.0254 for x in [69,77,54]] lista = [69,77,54] The expression: print(list(zip(lista,heights))) has as output: [(69, 1.7526), (77, 1.9558), (54, 1.3716)] My goal is to get the same…
-
5
votes1
answer325
viewsLogin with verification of two tables
Good afternoon, I’m developing a site, and I’m having a lot of doubts lately, it’s for my tcc and they help little. I made a system to register the user being a student or teacher with Mysql, in…
-
5
votes1
answer1155
viewsGet the smallest positive number that is divisible by all numbers from 1 to 20
I made a code in a way that works, but it doesn’t look anything pythonic, and takes a lot of time. i = 1 numero = 1 while i != 0: if numero % 1 == 0 and numero % 2 == 0 and numero % 3 == 0 and…
-
5
votes3
answers123
viewsCompare range of values
The code below compares a value and according to this value generates a percentage and works. But I would like a more practical way, whether function or other structure, because these ranges of…
-
5
votes2
answers154
viewsIs there a rule for "type statements in class properties"?
PHP 7.4 supports type declarations in class properties. In a normal routine I would use: /* @var array */ protected $names; Now in PHP 7.4 I can: protected array $names; But if I declare it this way…
-
5
votes1
answer258
viewsWhat is Lambda calculus?
I heard about it once, but I don’t understand its relationship to programming. Where I could apply this knowledge in development?
mathematicsasked 4 years, 11 months ago Luan 372 -
5
votes2
answers215
viewsDid "Class Components" die in React?
Before the React update 16.8 it was not possible for functional components to be internal, so Hooks arrived to solve this problem, so the functional components became the standard of React. Then the…
-
5
votes1
answer820
viewsElement has the type any implicitly when trying to access a property of a module namespace (object)
Works: import * as Icons from 'react-icons/fa'; ... const teste = 'FaAddressBook'; const Icon = Icons[teste]; Doesn’t work: import * as Icons from 'react-icons/fa'; ... const teste:string =…
-
5
votes3
answers896
viewsHow to insert a character in the middle of the sentence
I am implementing a function that checks whether within a word there are two equal letters in a row, and if so, add an x between the two letters to separate them. Example: Entree: pizza Exit: pizxza…
-
5
votes2
answers740
viewsHow do I perform a "merge commit" or "merge pull request" on "Github"?
I want to contribute to a project on github only that I don’t want to post a PR with 28 commits. How do I (on Github) join these commits?
-
5
votes2
answers462
viewsHow to recover an array saved on localStorage
var pessoa = ["Bonito","Alto","Magro"]; Window.localStorage.setItem('pessoa',JSON.stringify(pessoa)) pessoa=[null] Now I want to recover that value Bonito,Alto,Magro one by one , which is no longer…
-
5
votes0
answers345
viewsAPI googletrans mistranslating texts
I am trying to create a Python application where I need to translate some texts, and to perform such a task, I am using the API googletrans. text = 'Back in the day people used to go to many…
-
5
votes2
answers2279
viewsHow to get only the date month with PHP from the database
Well the date is in the format ( 2020-02-10 17:04:01 ) So I just want to take the month or day separately, the data is saved in the data Anco, I can get the whole date, but I wanted to take…
-
5
votes2
answers769
viewsHow to return values with numbers in an array
I’m trying to perform a school grade calculation with Javascript but the result returns me NaN. Code: array_notas = [10, 9, 8, 7] function calcularMedia(param) { for (let i = 0; i <= 4; i++) {…
-
5
votes2
answers291
viewsCmd text box functionality for Git
I’m developing a .bat, which will make a series of commands from the git predefined. But one of these commands, it is necessary that the user type an operation message. Follow the series of…
-
5
votes1
answer187
viewsCreate more specific or more generic custom exceptions?
Taking into account that in a project is used the practice of creating custom exceptions, which makes more sense? I mean, make an exception for every possible error predicted in the code by…
-
5
votes1
answer92
viewsWhy are certain domains easier to model than others?
I have heard about certain domains, such as Guis and games, which are more "abstracted", or are already abstractions, or are "mechanisms", in short, have a distinction in relation to other domains.…
-
5
votes2
answers675
viewsWhat is RDD (resilient Distributed dataset)?
I’m studying about Spark in Python and the acronym RDD always appears. However I can’t understand what this nomenclature is really about. So I’d like to know what it is resilient Distributed dataset…
-
5
votes1
answer58
viewsWhat is the $$ function in posntegresql functions?
Hello, I’m a beginner in postegrsql and I have the following question: When we create functions in postgresql the following logic is usually used CREATE FUNCTION func() RETURNS ret AS $$ BEGIN ...…
-
5
votes2
answers143
viewsRandom Hoice and shuffle with different behaviors
I’m testing some codes with the module random and I noticed a difference in behavior between random.choice() and random.shuffle(). Following the codes I’m training: import random alunos =…
-
5
votes3
answers204
viewsIs it possible to save a used browser object localstorage?
I made a Todo list with 3 features: add an item, delete and clean the input field. I would like the added items to be saved after reloading the page, it is possible to do this using the…
-
5
votes3
answers4467
viewsHow to take part of a String up to a specified character?
I would like a Javascript method that takes part of a String up to a certain point (character) from it. In this case I would specify a character and only be taken part of the String until the…
javascriptasked 5 years ago Gato de Schrödinger 2,367 -
5
votes1
answer71
viewsHow to create a heatmap for a calendar?
One of the graphs I find most interesting is called, in English, heatmap Calendar. Perhaps its most common application is in github, that displays our collaborations in the last year with the chart…
-
5
votes1
answer151
viewsHow to avoid repeating "using" in ASP.NET MVC?
I have a controller where several moments have a code similar to this: public ActionResult ListarProduto() { using (DBModels db = new DBModels()) { return View(db.Produto.ToList()); } } How not to…
-
5
votes1
answer65
viewsWhy does Std::Ceil produce different results for float and double?
Follows the code: #include <iostream> #include<math.h> using namespace std; int main() { float calculo = 4.347 * 20 * 100; double calculo2 = 4.347 * 20 * 100;…
-
5
votes1
answer124
viewsResized screen after upgrading Xcode to version 11
After upgrading the Xcode to version 11, the App developed for Ipad does not behave in a maximized way on the screen when running, both in the simulator and on the device, but the storyboard is…
-
5
votes1
answer128
viewsDisplay: Does None really affect seo?
On my hidden quiz site about 95% of the questions and answers content (text and images). I leave visible only a small area with an image, the title of the quiz and a description, and finally a…
-
5
votes1
answer109
viewsWhat does << in Ruby mean?
I’m studying a book of programming logic and wanted to know what it means << see what the book is applying to: This balcony to maintain a help variable with the actual size used an array is…
-
5
votes2
answers180
viewsIncorrect value in vector when binary search
import java.util.Arrays; /** * @author Vinicius * */ public class Vetor04 { /** * @param args */ public static void main(String[] args) { int vet[] = {3, 7, 6, 1, 9, 4, 5}; int s =…
-
5
votes1
answer178
viewsWhat is Lazy, Laziness in Python/Django?
I’m starting to program and reading the documentation from Django, I saw some references about lazyObject, about Django being Lazy and that Querysets sane Lazy. I’ve done some research but I haven’t…
-
5
votes1
answer260
viewsWhat is Headless Browser?
I am creating a program to compare prices in Nodejs, and in my researches I came across this term, what would be Headless Browser and how it works?
-
5
votes2
answers105
viewsDoes Python syntax accept either "+" or "," in the "print()" command?
For example, if I wanted to print a string that I create on time along with a ready-made variable, any of the cases would work? #Case 1 nome = "Júlia" print("Olá " + nome) #Case 2 nome = "Júlia"…
python-3.xasked 5 years, 1 month ago Mofux666 53 -
5
votes1
answer109
viewsDoubt about generic types in Typescript
I am currently studying Typeorm, and wanted to create a generic controller, as it will always be the same CRUD operations. I know I can solve with native Typeorm solutions, such as getRepository(),…
-
5
votes1
answer144
viewsItalics in dashboard headings in facet_wrap()
I’m having trouble formatting species names in italics in the title of the panels with the argument facet_wrap in the ggplot2. Following example: library(ggplot2) ggplot(mpg, aes(x=displ, y=hwy)) +…
-
5
votes2
answers156
viewsWhat is the correct way to do an Replace in a string-like variable?
I need to create a folder on the file server and realized that the variable that receives one of the information is coming with invalid characters ( / : * ? " < > |) for creating a folder on…
-
5
votes2
answers219
viewsRegex to search for word inside tag with CDATA
I have a file that contains the following string possibilities: 1st Case: <text><![CDATA[Casa]]></text> 2nd Case: <text><![CDATA[Qualquer texto que tenha Casa no…