Most voted questions
150,413 questions
Sort by count of
-
5
votes3
answers64
viewsObtaining single records based on two columns
Considering the dataframe df1 intended to obtain a dataframe with unique records (origin, destination) counting the number of unique pairs (origin, destination) and summing the value per unique…
rasked 3 years, 6 months ago user250908 77 -
5
votes1
answer110
viewsReorder levels of a categorical variable within panels according to the group to which they belong
When using the command fct_reorder(class, hwy, .fun = median) below, I asked for the variable levels class were reordered according to median variable hwy: library(tidyverse) ggplot(mpg, aes(x =…
-
5
votes2
answers86
viewsIs there a difference in creating objects and adding properties with literal notation or with`new Object` in Javascript?
I have a question. Do this here: let meuCarro = new Object(); meuCarro.fabricacao = 'Ford'; meuCarro.modelo = 'Mustang'; meuCarro.ano = 1969; console.log(meuCarro.fabricacao);…
-
5
votes1
answer67
viewsWhat is the syntax that comes before the variable name in function parameters?
Reading the PHP documentation I came across the following example: function bar(A $a = null, $b) {} // Ainda permitido function bar(?A $a, $b) {} // Recomendado I did a little digging and figured…
-
5
votes3
answers102
viewsHow to do linear interpolation on R?
I have a date.frame with 3 columns: YEAR, COHORT and Income. I would like to make a linear interpolation between the values of 1960 and 1980 to define the values of 1970. To the COHORT = 5, would…
rasked 3 years, 7 months ago Alexandre Sanches 1,223 -
5
votes1
answer56
viewsCan LLVM be used with the C language?
I’m studying compilers and I’m using the C language and learning about LLVM but all examples are in C++ language. The question is whether I can use the LLVM with the C language and how can I start a…
-
5
votes1
answer122
viewsWhat is the prop "key" for in React?
When rendering a dynamic list in React or React Native, I receive the following warning: Warning: Each Child in a list should have a Unique "key" prop. Despite this, things seem to work well without…
-
5
votes2
answers78
viewsLine Break inside the P tag does not work
I am making an animation in Javascript so that the text has the effect of being typed. I am using a single tag <p> for text, and Gostaria that broke the line in the tags <br>, but they…
-
5
votes1
answer35
viewsHow to check if a value is contained in another list
I need to check if the value of a column is contained in a list and, if it is, copy its value to a third column. Let’s take the example: df <- data.frame(Nome = c("Maria", "Pedro",…
-
5
votes1
answer60
viewsWhat is the relation of the "+" operator to the "valueOf()" method in Javascript?
I have a question about the operator +. In this answer on the operator, the following was said: The + can also play the role of a binary operator. In that case, operates on two values. In this…
javascript characteristic-language operators type-conversionasked 3 years, 9 months ago Cmte Cardeal 5,299 -
5
votes1
answer73
viewsHow to format a string to add spaces to the right in a printed table?
I am trying to print a table in Java using the method System.out.format, where the exit should be this way: (Dados apenas de exemplo. Não são reais.) SBGR -> BCO | 9,0 m | 5,0 NM | 1400 Ft/m |…
-
5
votes1
answer53
viewsWhat good is lib.rs in Rust?
As shown in this question, in Rust it is possible to import a file (its structs, functions, etc) using the keyword mod. For example, in the following directory structure: src/ main.rs…
-
5
votes1
answer135
viewsWhat is UML? What is it for?
A conceptual issue. What is UML? What good is? Is it really useful? Therefore, we must learn? Is widely adopted? What defects of this language? Is linked with object orientation?…
software-engineering uml software-project documentation project-managementasked 3 years, 9 months ago Maniero 444,682 -
5
votes2
answers100
viewsWhat does "ad-hoc" mean in the context of computing?
Eventually I see some terms preceded by "ad-hoc", but I still can’t quite understand what it means. When used "ad-hoc" in a term related to computation, is there a common meaning? What does it mean…
terminologyasked 3 years, 10 months ago Luiz Felipe 32,886 -
5
votes1
answer44
viewsHow to use Result in user-defined function?
Many Rust functions apply the enumerable Result in its implementation. This enumerable makes it easy to manage error, since you can use unwrap or expect to help identify the error in a code. An…
-
5
votes1
answer91
viewsWhat is Regexp Match Indices?
I recently found this package, which serves as a polyfill for a new Javascript feature. The proposal Regexp Match Indices was finalized recently, which means it will soon be part of the language. On…
-
5
votes0
answers62
viewsIs there any way to specify scroll-behavior runtime: Smooth?
The estate scroll-behavior: smooth allows you to change the behavior of the scroll to be smoother. Example: #scroll{ overflow: auto; height: 600px; width: 100%; scroll-behavior: smooth } #a, #b {…
cssasked 3 years, 11 months ago Wallace Maxters 102,340 -
5
votes0
answers60
viewsWhat is and what is the advantage of using "span<T>"?
C++20 has a new type std::span. External libraries as GSL also provide C++14 and C++17 compliant implementations. Seeking to understand what a span<T>, I stumbled upon the following…
-
5
votes2
answers140
viewsI cannot use the value passed in argv in the program call
When I type b in the call of the program he does not return me the Bom dia. I would like to understand what is wrong in my code. Follow the program below. #include <stdio.h> int main (int…
-
5
votes2
answers213
viewsLike "clone" an Inputstream?
Often I need to read a InputStream more than once. For example, to pass on the content of stream for multiple methods. void readStream(InputStream input) throws Exception { var result1 =…
-
5
votes3
answers110
viewsHow to "flatten" a list of lists of integers?
I have a list of lists d = [[1],[2],[3],[3]] And I’d like to turn it into a list s = [1,2,3,3] I don’t really understand the difference between d and s, but I need to do the transformation because I…
-
5
votes0
answers51
viewsHow to gain insight into new programming technologies and techniques?
You look like you’re subject to opinion/debate, but I wanted to try to fit a question into that line. It is important for a good programmer to know how to evaluate trade-offs (pros and cons of…
-
5
votes1
answer123
viewsHow to perform semantic analysis using pure functional programming without side Effect?
I wonder if there is any way to know what the current context is without using side effects as Agente of the elixir , letting semantic analysis be carried out along a pipeline of functions that walk…
-
5
votes1
answer91
viewsWhat kind of data do you use to store the date of death in a register (Datetime or string)?
I have a record of people where I need to store birth dates (DateBirth) and death (DateDeath). Knowing that the guy DateTime in C# cannot be empty and its default initial value is 01/01/0001…
-
5
votes3
answers358
viewsHow to generate random hexadecimal colors with Javascript?
In this question, teach how generate random colors through PHP. How to do this in Javascript?
-
5
votes2
answers260
viewsIn Python, how do you remove specific characters from all the records of just one particular column?
I’m at Jupyter Notebook working with Python. The dataframe has some columns, but in a specific column I want to delete all records that end with ". txt", meaning the last 4 characters. Image of the…
-
5
votes3
answers211
viewsProblem where IF and ELIF do not work in Python
First time programming, I started a week ago and I gave up trying something. However, I have a problem where, no matter what I put in the variable, it always shows the same result, which in the case…
-
5
votes1
answer90
viewsHow to use Beautifulsoup’s "find" to find a script tag with a specific type?
For a while I have been studying how to use Beautifulsoup to be able to find tag content etc. But I came across a problem where the content I want to find is inside a tag <script…
-
5
votes1
answer129
viewsHow do PHP 8 attributes work?
In PHP 8, the attributions, which can be used in classes or methods. Example: namespace MyExample; use Attribute; #[Attribute] class MyAttribute { const VALUE = 'value'; private $value; public…
-
5
votes2
answers70
viewsError plotting with ggplot
library(tidyverse) library(lubridate) Suppose a dataset containing the year followed by the number of books published by an author: df<-tibble( ano = c(2007, 2008, 2017, 2018), n = c(1, 2, 2, 1)…
-
5
votes3
answers77
viewsIs there a bash iterator equivalent to the python enumerate?
It is common situations in which, to iterate, I need not only the elements of a list, but also their respective indexes. In python, this type of iteration is facilitated with the use of iterator…
-
5
votes1
answer150
viewsHow to remove a file from Git, but keep it locally?
When I have a file on my local computer that I would like not to be uploaded to the repository on Github, I simply create a file .gitignore and add the path file. It so happens that I would like to…
-
5
votes0
answers90
viewsWhat is the Utility-first standard in CSS?
In CSS, there are patterns like WELL for the organisation of the nomenclature of the HSC classes. Recently, with the rise of libraries like the Tailwind CSS, I realized the existence of a new* CSS…
-
5
votes1
answer194
viewsHow is the scope of an Event Listener defined in any attribute in HTML created?
According to the documentation, when the Listener event is assigned as an HTML attribute, the specified code (in the attribute value) is wrapped in a function, with the following parameters: event -…
-
5
votes1
answer45
viewsRandomizing two sets of numbers, not repeating the values within each group (R)
Whereas I have these individuals on file: ID 1 1 1 3 3 3 7 7 7 And I need to assign two sets of numbers to ID randomly (set1 - 1,2,3; set2 - 5,15,25). To do this my attempt was: df %>%…
-
5
votes0
answers51
viewsIntercept constructors and destructors of all objects in Delphi
I use a feature on my system where some users may have access to scripts in Pascal Object and can customize some rules. This is generating a certain problem of Memory Leak, because just as a…
-
5
votes2
answers206
viewsWhen to use GIT ADD?
I have a question regarding how to commit using GIT. For example, let’s assume I gave one git add in a file and performed the first commit. If I want to commit again, I need to use the command git…
-
5
votes2
answers50
viewsHow to relate a column to a dictionary in R?
library(tidyverse) I have a dataset that has in one column titles of articles and in another column, their respective authors. I reproduce here a row of this dataset: df<-tibble( titulo= "A…
-
5
votes2
answers162
viewsWhen using the term "prototype" to refer to a Javascript method, as in "Array.prototype.foreach"?
Javascript has several objects with methods, as is the case of arrays which have, for example, the method forEach. But eventually the same name can be used by other objects, such as method forEach…
-
5
votes1
answer62
viewsThere are ways to add figures on a Plot in R
Gero this figure: when using that code: library(tidyverse) library(plotly) tres <- readRDS(…
-
5
votes2
answers470
viewsHow to apply mock in "new date()" using Jest?
Please someone knows how to apply mock in the new Date() using the Jest? I tried to do so, but it did not work. The date remains current: jest.spyOn(Date, 'now').mockImplementation(() => { return…
-
5
votes1
answer375
viewsHow to cancel/interrupt a request made with Axios?
Generally, I usually make some AJAX calls with the library Axios. Those days I needed a resource, where I could interrupt a certain request already started, but did not know how to do. Is there any…
-
5
votes1
answer168
viewsWhy does Std::Cout use <<?
I am very beginner in language, maybe I am being rushed, but I would like to understand why std::cout and std::cin use respectively << and >> different from its "mother language" C,…
-
5
votes1
answer174
viewsShow DIV content by clicking on the image with slideToggle
I’m trying to get a click on an image in question to hide the previous title and show the current one, and so on. I’ve tried using nextAll, return false etc, but I think the problem is nesting…
-
5
votes1
answer67
viewsI need help with the textContent function
I have to validate all the <td> of <tr> through the Javascript, for a college project! I used the following code: var dvd = document.querySelector(".info-dvd"); var dvdInfo =…
javascriptasked 4 years, 4 months ago dimascamillo 61 -
5
votes2
answers81
viewsCompare two lists without interference of upper and lower case letters
I want to develop a log-in system where it does not allow new users to have the same names already used by other registered users, but I’m having a problem in case of upper and lower case letters…
-
5
votes3
answers196
viewsWhat causes my component to be rendered again in React?
Very commonly I see talk that a component of React will be re-rendered because of a prop, state, value of context altered, etc.. What are the factors that actually influence the re-rendering of a…
-
5
votes1
answer84
viewsHow to select samples in R
How to select 100 size samples n = 10, without replacement, using a population of N = 1000? My population: set.seed(1234) x <- rnorm(1000, mean = 100, sd = 20)…
rasked 4 years, 4 months ago Alice Ramos 53 -
5
votes1
answer72
viewsInclusion x-axis name of months
I am not able to change/include in the x-axis the information of months in the nominal format. Dice: dt;AverageTemperature;Month;Year;media_tempMes; 1846-01-01;26.499;1;1846;25.5466;…
-
5
votes1
answer62
viewsCopied objects stay at different addresses?
When I have for example: $abc = new ZZZ(); $mno = $abc; The object $mno is the same as $abc? That is, do they have "memory addresses" alike? How do I print this "memory address"?…