Most voted questions
150,413 questions
Sort by count of
-
4
votes1
answer179
viewsWhat are the main differences between Arrow Function and Closures (anonymous functions) in PHP?
In version 7.4 of PHP, it was implemented Arrow Functions. Example: $double = fn($x) => $x * 2; var_dump($double(4)); // int(8) Which could be done as follows in previous versions: $double =…
-
4
votes2
answers96
viewsHow does logic test work with two integers in Python?
I was analyzing a code and came across the following expression: 1 & n >> k Where n and k are integers. For now, I’m focused on the first part of the expression. I’ve never seen a logic…
-
4
votes1
answer161
viewsOutput composite structures in Python in Google Colab
I have this list called "brazil" and I wanted to understand why when I asked for it in Google Colab Notebook calling its respective variable, the list is presented in a certain order and when I…
-
4
votes1
answer49
viewsHow to know if the "Windows animations" option is disabled in Win32?
In the CSS there is the prefers-reduced-motion. This media-query says that the user prefers reduced animations (off) or not, it respects the configuration that the user chose in the Windows settings…
-
4
votes3
answers98
viewsDeclaring PHP variables from the keys of an array
Is there any way to declare variables in php the same way we do in Javascript? I’d like to do that: const { variavel1, variavel2, variavel3 } = array To simplify this: $variavel1 =…
phpasked 3 years, 10 months ago user126009 -
4
votes1
answer72
viewsHow to transpose from "wide" to "long" (wide to long) with several variables?
I have a dataframe with multiple variables, as in the example below: df <- read.table(header=TRUE, text=" ID COR TIPO SITUACAO_2016 SITUACAO_2017 SITUACAO_2018 SITUACAO_2019 SITUACAO_2020…
-
4
votes1
answer85
viewsScatter plot in ggplot2
Talks guys I’m wanting to create a scatter chart in R using the ggplot2, a scatter plot with gene size (lengthbp) X variants (frameshift, splice_acceptor, splice_donor, stop_gained), the figure…
-
4
votes2
answers1473
viewsWhat is the difference between % and % in C?
What’s the difference between using the % and the %% in the C language?
-
4
votes4
answers412
viewsHow to check if a list contains 3 consecutive numbers
Insert a vector with 10 random integer values. Then check if there is a sequence of 3 consecutive numbers in the vector. Two values are consecutive if the difference is 1 unit example: A = [10, 5,…
-
4
votes1
answer220
viewsHow to add 1 to the number using the "for" command when the number N is a function parameter?
Being n the value of 5, adding up 1 + 2 + 3 + 4 + 5, resulting in the return. I tried to do it like this, but it didn’t work: function (n){ for ( var i = 0; i < n.length; i++ ){ total += n[i]; }…
-
4
votes1
answer77
viewsCan I use Object.assign to assign properties to this in Javascript?
I’m learning about objects now and I’d like to know if it’s possible to use Object.assign to assign all properties to this of a class in Javascript. Example: class Foo { name; email; phone;…
-
4
votes1
answer30
viewsError while integrating a real function
I’m trying to integrate, under the whole line, the function: integrand_1<-function(x){ exp(-x/phi-y*exp(-x)/(phi*2)-(x+sigma2/2)^2/(2*sigma2))} Using the following data: df <-…
-
4
votes1
answer38
viewsHow to return only the last commit date?
I know if I use the remote git log I can see commit ids in my repository and if I use git rev-parse HEAD, I can see the name of the last commit. But I needed to return only the date information of…
-
4
votes2
answers47
viewsIncrease the number of columns in the histogram
Hello, I’m having trouble increasing the number of columns in a histogram. I tried to change the number of Bins from 10 to 5 but it didn’t work. histograma: id MCP #MB02 12,59 #MB03 0,001 #MB04…
rasked 3 years, 11 months ago Francielle Oliveira 71 -
4
votes1
answer95
viewsValidation test works with numerical values but not strings
My inheritance code works normal, what I wanted to do is if the nome and the pseudonimo are null the code would stop, the code only stops running when idade, altura or peso sane null. import…
-
4
votes0
answers27
viewsBeagle crashing getBeagleCacheFromDisk function with unchecked cache
I’m using Beagle 1.4 (usebeagle.io) in a partially server driven Android app. I have the cache disabled in Beagleconfig, but when I get to the screen with the Beagle UI, the app crashes. I do not…
-
4
votes1
answer82
viewsWhat are the differences between Rmarkdown and Rnotebook?
The RMarkdown has become a very popular interface and file type in recent years. I believe this is due to the fact that it allows using a single software to write complete statistical analysis…
-
4
votes1
answer96
viewsOverlay two scatter charts into one (with ggplot)
I have 2 data frames for males and another for females (the variables are the same, crc and maxilla). From each of these df generated two charts. Now I’m trying to combine them into just one chart,…
-
4
votes0
answers46
viewsHow to iterate a recursive array without redundancy?
I have in certain directory thousands of software package files, which in turn has versions, as for example: /var/cache/fetch/archives/python-3.5.0-1-x86_64.chi.zst…
-
4
votes1
answer63
viewsCan the use of many variables in the CSS affect page performance?
The use of many variables in CSS can end up greatly degrading the page’s performance? It is possible to say more or less the use of how many would be necessary to begin to bring a negative impact?…
-
4
votes2
answers151
viewsWhy does changing a variable in a function not reflect in the passed variable itself?
let a = 2; let change = (val) => { val = 3; } change(a); console.log(a); I hoped the value of a was 3, but actually it is 2. Why?…
-
4
votes1
answer112
viewsWhy does Python have such big numbers?
What would be the largest number in python? Python shows the result of expressions like: >>> 8**150000 The result was 135465 digits! I wanted to know the language can do this.…
-
4
votes1
answer175
viewsHow do I center all the contents of a table in Latex using Overleaf?
All the contents of my table are located to the left of it. How do I center the contents of the columns and rows of this table? Table photo. Table code. \begin{table}[H] \centering \footnotesize…
-
4
votes3
answers71
viewsConditional column based on multiple dplyr lines
I have this df: structure(list(id = c("R054", "R054", "R054", "R054", "R054", "GT68U", "GT68U", "GT68U", "GT68U", "GT68U", "G001", "G001", "G001", "G001"), car1 = c("sim", "sim", "sim", "sim",…
-
4
votes3
answers341
viewsSort a list based on two different criteria using Sorted
I have a list of tuples and I want to sort them out, but that’s two different criteria. Each tuple has the following configuration: (peso, beneficio) The ordination I want to make is as follows:…
-
4
votes1
answer127
viewsWhat are Javascript property descriptors and attributes and how do they work?
Eventually I read, mainly in more advanced content about objects in Javascript, the terms "proprietary descriptors" and "property attributes". I believe they are related concepts. What they are and…
-
4
votes1
answer166
viewsMath.Running defining minimum and maximum values other than 0
I’m trying to set the minimum and maximum value, using Math.random() * (max - min) + min;, for example, informing on the Html page the minimum = 10 and the maximum = 20, but the results are always…
-
4
votes1
answer137
viewsHow to create a regex equivalent to a BNF?
I need to create a regular expression that is equivalent to the following BNF: <SEQ> ::= <DIG><SEQ> | <DIG> <DIG> ::= 0|1 I tried to create a Python code with the regex…
-
4
votes3
answers239
viewsOrdering arrays with Bubble Sort
I’m solving a question of my course which I need to use a vector ordering algorithm based on the Bubble Sort algorithm. Making a previous summary, the logic consists of going through all the values…
-
4
votes2
answers98
viewsHow do I know if a value is higher or lower than another value in a list using recursion?
Being a classified monster with your name, attack and defense. ("medusa", 2, 5) or (string, int, int). And getting a list of monsters, how do I create a function that tells me if the monster I want…
-
4
votes2
answers584
viewsHow do I draw random names from each list without repeating them
I want to draw random names from 3 different lists, I have a program in Python that does more or less that. The problem is that they keep repeating several names in different combinations, I would…
-
4
votes1
answer69
viewsWhy are different types of quotes used in places as error messages?
Eventually I see different quotes (one type of quotes to "open" and another to "close") some message, mainly in error messages. Take, for example, an error message issued by Ruby when evaluating a…
language-independentasked 4 years ago Luiz Felipe 32,886 -
4
votes1
answer85
viewsHow to take system time and add minutes to it in Javascript?
I am making a basic "calculator" for a game, and I need a function that takes the system date and adds 30 minutes when the button is pressed. Follow the script I’m trying to use and it doesn’t work:…
-
4
votes1
answer30
viewsComparison between two objects
Assuming I have the following objects: const dataBody = { name:'luiz', email:'[email protected]', cpf:'12345678910' } const dataDb = { name:'luiz', email:'[email protected]', cpf:'12345678910' } How do I…
javascriptasked 4 years ago Beto Garcia 71 -
4
votes1
answer71
viewsplace the result of each iteration of the cycle in html for
If you could help me with a question, I would really appreciate it! So, I’m very junior in javascript and I’m doing an exercise, where I wanted to put the results of my cycle out to appear in HTML,…
-
4
votes1
answer304
viewsBinary sum result
A program capable of operating two binary numbers between 0-255. Program input needs to be in binary and output as well. I did it in a way that was working, so that if I pass in binary 1 + 11, the…
-
4
votes0
answers147
viewsHow to change the basis of a branch?
I have a branch derived from master, development, that never comes back to master. All the branchs of features are derivatives of development, but after tested and validated, are combined both with…
-
4
votes2
answers186
viewsDoubt about Number.isInteger() in JS. Number is an object or function?
Number would be a function or object? My teacher said that everything in Javascript can be seen as a function (even objects) and it confused me a little. He told me that Number would be an…
-
4
votes3
answers49
viewsNormality and fragmentation of the sample
I’m having a problem with an analysis of shapiro.test in the R. I want to analyze the normality of a certain variable x, but I want to do this in stratified samples that together correspond to…
rasked 4 years, 1 month ago Matheus Peixoto 41 -
4
votes2
answers108
viewsGiven an X number, check if there are 2 elements in a list that together result in X
Problem: The user enters an X number, and a function must check whether two numbers summed within a list, content elements that can be ' ' or integers, results in the user’s X number. My job: #…
pythonasked 4 years, 1 month ago Pedro Barretto 51 -
4
votes2
answers68
viewsCan’t print objects using template string?
Why doesn’t string template print objects correctly? I have the following test code: const obj = { a: 1, b: 2, c: 3,} console.log(`Novo Obj ${obj}`) and the result on the console comes out as: Novo…
javascriptasked 4 years, 1 month ago FireEagle 129 -
4
votes1
answer94
viewsRepositories can manipulate and "transform" data?
I’m implementing two video service Apis (Youtube and Vimeo), and because it’s a layer of data, I thought it was ideal to create repositories for each one, with the API being the "source" of the…
-
4
votes1
answer72
viewsHow to plot the factors (spp) of the metaMDS result using ggplot2, related to the collection sites in the original data frame?
Given the following data frame: dat<-data.frame( "sitio" = c("a", "a", "a",'a', "b", "b", "b", 'b', "c", "c", "c",'c'), "amostra"=c(rep(1,4),rep(2,4),rep(3,4)), "sp1"=c(1,3,3,2,4,2,1,5,3,6,1,5),…
-
4
votes2
answers51
viewsSpecial character removal in Software R
in the database below in column 7 (Column title is Round) is written "1st Round". How to remove the "th" and keep only "1st Round"? Below follows the code for reading database view. url <-…
rasked 4 years, 2 months ago Filipe Fulgencio 49 -
4
votes2
answers110
viewsIs it possible to use Async Generators with the ES5 syntax?
For example, the code below that creates a async Generator: async function* iterate() { yield 1; yield 2; yield 3; return null; } Could be used with the syntax for await...of: for await (const…
-
4
votes3
answers138
viewsWhy does the Endl exist in C++ and n already performs the same procedure?
I’m sorry if the question seems trivial, but I don’t understand why Endl in C++, since n already performs the same task. It wouldn’t be "reinventing the wheel"?
c++asked 4 years, 2 months ago Gabriel Bento 75 -
4
votes2
answers279
viewsHow does Undefined return work?
When a variable is declared, but it has no value assigned to it, theoretically it has no data, but it exists in memory and is ready to be used: let myVariable; But when trying to use it is the same…
javascriptasked 4 years, 2 months ago felipe cardozo 275 -
4
votes1
answer75
viewsCompilation error on non-static element reference
public abstract class Teste { public static final Teste IMPLEMENTACAO_1 = new Teste() { @Override public void executar() { teste1(); } }; public static final Teste IMPLEMENTACAO_2 = new Teste() {…
-
4
votes2
answers165
viewsFunction with two parentheses? function()()
I don’t know how to describe why I couldn’t find information about. kkk At the end of the code when exporting "connect", what does the second parenthesis do? What is called this syntax? import React…
-
4
votes1
answer53
viewsHow to access the "this" of a class with an external function?
I want to create a function within a class that is defined externally, but I can’t access the this class. Example: class minhaClasse { constructor(objeto){ this.meuNumero = objeto.meuNumero…