Most voted questions
150,413 questions
Sort by count of
-
3
votes4
answers167
viewsHow to return the first vowel of several words in a list?
The code is partially done, but it returns only the vowels found in each word. How could I return only the first vowel of each word? palavras = ('boi', 'vaca', 'macaco', 'ovelha', 'lesma',) vogais =…
-
3
votes0
answers42
viewsHow to listen to coordinate changes on a canvas via a mobile device?
I created this component in Angular that has a canvas and when the user clicks and drags on that frame, the canvas is filled with coordinates positions. I tried to reproduce this same behavior in a…
-
3
votes1
answer126
viewsFastest way to iterate over lines in python, pandas
I’m having a certain performance difficulty in the code because it’s taking too long to run. I have the following Dataframe. (Example because what I’m wearing is much bigger) orders = {'Código':…
-
3
votes0
answers105
viewsHow to make my python server work on an external network using ngrok?
I created a server in python that runs on port 50000... Soon after that I created my client. If the two are on the same network both connect and everything is fine! But in external network I can not…
-
3
votes1
answer42
viewsStandardize phone number with REGEX on R
library(tidyverse) I’m trying to standardize the "numero_telefonico" column of this dataset: https://raw.githubusercontent.com/rivaquiroga/latinr-taller-regex/master/datos/telefonos.csv Download the…
-
3
votes1
answer57
viewsProblems in deleting all data from an employee
After creating create and read I have been having problems in the update and delete code, but currently I have focused more on delete and I am not able to make it delete the entire employee.…
casked 3 years, 10 months ago Nicolas Sousa 31 -
3
votes1
answer66
viewsQuery two tables and display the quantity of the group that has the most foreign key records
I need to make a query between the following two tables: Table Class: id_turma classmate class code 1 1A 20201AVesperto 2 2A 20202AVespertino 3 3A 20203AVespertino 4 4A 20204AVsmarter 5 5A…
-
3
votes1
answer56
viewsGet the name of the Variable by which the function or class was called
I was looking at how the databases are created in Sqlalchemy and I was in doubt in the part where I create class variables and are converted to a column in the database with the name of the variable…
-
3
votes1
answer59
viewsLanguage C - Understanding the Concept of Pointers and Dynamic Allocation, where is the error?
I would like a help in pointer call concepts, and dynamic allocation with struct. I’m developing a code to address an issue of college work, and I’m coming across some errors that I believe are…
casked 3 years, 10 months ago Andre Coelho 31 -
3
votes1
answer60
viewsFind content between 2 strings inside a giant string with Regexp
I need to create a function that takes the frame number and takes its contents from a file . txt with more than 3000 lines. Every table has the following configuration: Starts with "Frame X" and…
-
3
votes1
answer51
viewsWhat is the difference between the pre-processor directive and the if statement?
In what situation should I use the directive #if? And the reserved word if?
-
3
votes1
answer65
viewsReplace strings with list elements
# Código list = [a for a in range(100,103)] df = pd.DataFrame({ "A":['x','y','z'], "B":[0,1,2], "C":[0,0,0] }) I need to replace column strings C by the strings of list, so that the first string of…
-
3
votes2
answers94
viewsHow to call a function within the setTimeOut() method by passing parameters?
For example, below I have two buttons that when clicked display different contents: let btn1 = document.querySelector("#btn1"); let btn2 = document.querySelector("#btn2"); btn1.onclick = () => {…
javascriptasked 3 years, 10 months ago user216657 -
3
votes2
answers73
viewsHow to find strings within an array
Good morning! I have the following array: const keys = ["idCard1", "idCard2", "idCard3", "oi", "idCard4"] I need to save in another array only what starts with the word "idCard", would be possible?…
-
3
votes1
answer157
viewsWhat is the difference between string find and index methods in Python?
I always use the method index to fetch the index of a character in a string in Python. I recently discovered the method find() and I noticed that he does exactly the same thing. Example: name="Alan…
-
3
votes1
answer207
viewsHow to plot a graph in python using a file containing numpy arrays?
Good afternoon! I am creating a python program that plots the graph of the quadratic function (y=x**2), however, you need to put the data of x and y in a file and plot the graph by extracting the…
-
3
votes3
answers105
viewsFind and change specific Python dictionary
I have to perform a search inside a list with dictionaries inside, looking for the person’s specific CPF, to confirm their data, and thus change some specific dictionary item. My list is:…
-
3
votes2
answers56
viewsProblem with toFixed() Javascript method
The method toFixed(2) leaves the number with two decimal places, but when the number is finished in 5 it rounds up and I’d like it to round down. Is there any way? Example: let num = 10.125 num =…
javascriptasked 3 years, 10 months ago Vinícius Soares 31 -
3
votes2
answers368
viewsCount occurrences of a letter in a string that repeats several times to a character limit
In this problem I have to count the number of times the letter appears 'a' in string 'a' range 1000000000000, only that I have run time error when it is a very high number like this. for example: if…
-
3
votes1
answer648
viewsMake a histogram with a Gaussian curve in Python
It’s the first time I do a Python histogram, but I’m not getting the same Python histogram I got in Excel. Also, I wanted to put a Gaussian curve and the mean with the uncertainty of it next to the…
-
3
votes1
answer83
viewsError trying to install scikit-Learn
I’m trying to install scikit-Learn via Pip to python 3.9, but in the part that says "Installing build dependencies..." an error occurs every time. I have already installed numpy and scipy, which are…
-
3
votes2
answers50
viewsHow to avoid Greedy Repetition (.*) to search for string that has defined start, dynamic middle and defined end?
I have a log file that is searched via regex ^WebServer:.*endOfLine. Considering the log below this regex is generating 485 iterations (Steps): String: amet, consectetur adipiscing elit...Lorem…
regexasked 3 years, 11 months ago Fábio Jânio 3,407 -
3
votes2
answers97
viewsHow to filter rows where columns meet consecutive conditions in Python?
I’m trying to filter lines in which the columns comply with conditions consecutively. That is, if the row has columns with the conditions of after an L/I, the next column has a A/S, then return the…
-
3
votes1
answer61
viewsIs there a difference between list and "Symmetric array destructuring"?
I was looking for a new syntax, which was implemented in PHP 7.1, called Symmetric array destructuring, in accordance with the PHP documentation. Basically, this allows "unstructuring" an array,…
-
3
votes1
answer57
viewsFiles for nodejs settings
I’m trying to make a file with the settings but not quite sure yet how to accomplish this, in this way searching various contents, I found some features where facilitates me but it would not be my…
-
3
votes2
answers83
viewsObjects eligible for the AG
I have the following certification issue on the Garbage Collector: 1: public class Rabbit { 2: public static void main(String[] args) { 3: Rabbit one = new Rabbit(); 4: Rabbit two = new Rabbit(); 5:…
java objects instantiate-object garbage-collector jvmasked 3 years, 11 months ago Deivson Bezerra 149 -
3
votes2
answers311
viewsHow to use re.split() to pick only the words of a text, ignoring numbers and punctuation marks
I am given the following sentence:: texto = """ Em 2020 observamos, e catalogamos (com fotografias), os barcos que chegaram ao Porto! Até breve. """ for p in gerarPalavras(texto): print(p) I created…
-
3
votes2
answers277
viewsHow to capture a number in a string using regular expressions (or similar method) in Python?
I would like to know how I can select a specific part of my text considering that this part refers to a value that can change. For example, the string: # 44,739 % of all cache refs I would like to…
-
3
votes1
answer188
viewsHow to capture click event with mouse scroll?
My doubt is 'simple', but I can find no 'definitive' answer anywhere: You can specifically capture the mouse scroll click with JS? There is the function .click(), that I use a lot, but there is how…
-
3
votes2
answers44
viewsWhat is the "~*" operator for in a select in SQL?
I saw this line of code in some examples: SELECT * from produto where nome ~*'$texto_pesquisado';" But I don’t know what the function of ~*, I found no explanation. What is it for?…
-
3
votes1
answer119
viewsProblem using map with async and await in Javascript
I have a code block where an array type variable is defined and within a function map, I push some values to that array. Inside the map, I can print the array with the filled objects. However,…
-
3
votes3
answers171
viewsDoes the function not return the minimum value?
Make a Python function call min_max(t), which receives a list of numbers, and returns another list containing respectively the lowest and highest value of the original list. Follow the code so far:…
-
3
votes1
answer35
viewsHow to check the periodicity of a series in the R?
I have a database with 5182 series and I need to check if these are daily, monthly or quarterly. Doing this job manually would take a lot of time, so my question is: It is possible to check whether…
-
3
votes2
answers54
viewshow to take duplicates from a list of dictionaries
i have that input . txt: Brasil#ouro#futebol feminino Argentina#bronze#basquete masculino Brasil#prata#futebol masculino Argentina#prata#tênis masculino Brasil#prata#volei feminino China#ouro#tênis…
-
3
votes1
answer89
viewschange the distance between the bar and the Y axis in r
How can I change the distance of the bars relative to the y axis using ggplot? using the code: k <- c("a","b","c","d","e","f") j <- c(3,5,8,1,2,6) df <- data.frame(k,j) ggplot(df,…
-
3
votes1
answer55
viewsHow to avoid duplicate Javascript addeventlistener calls?
I would like to add an event to several different classes, example: exemplo1.addEventListener('click', function(){ //Evento bla bla }); exemplo2.addEventListener('click', function(){ //Evento bla…
-
3
votes2
answers131
viewsBreak string into array limiting the amount of times the break is made
I know we have the split to break the string in array, but if I want to split only the first time you find a certain feature? Example: const vogais = "a-e-i-o-u" const arrayVogal = vogais.split('-')…
-
3
votes1
answer177
viewsWeighted average with final examination
I need read 4 notes with weights of 2, 3, 4 and 1, respectively, for each of these notes and I must show this average accompanied by the message "Media: ". If this average is greater than or equal…
-
3
votes1
answer203
viewsIs there a data limit that can be passed in Websocket.send?
I built a server to implement the Websocket HTML5. In this implementation, I always send and receive data in the format JSON. But I have the following question: There is a limit size to be passed in…
-
3
votes4
answers2518
viewsHow to count occurrences of a value within an array?
How to take the amount of times a string repeats within an array? Ex: var teste = ["oi", "tudo", "bem", "oi"];
-
3
votes1
answer40
viewsshellcode amended "Segmentation fault"
Well I have a file called test.asm with the code (for windows): section .text global _main extern _printf msg: db "%d", 0 _main: mov eax, 10 add eax, 20 push eax push msg call _printf add esp, 8 ret…
-
3
votes1
answer873
viewsWhat is Broken Pipe Error?
What does the Broken Pipe error mean? And also what would be a Pipe in computing? This error has occurred to me several times and in various programming languages even when using some programs like…
networks language-independent computer-science tcp networkasked 3 years, 11 months ago Nakamoto 1,341 -
3
votes1
answer108
viewsWhat is the most efficient way to format code output to the user?
What is the most efficient way to format the output of my code? It is a classic exercise of the internet, but I would like to improve it. I want to leave the bars of "limit", (|) always with the…
-
3
votes1
answer60
viewsGeom_rect does not recognize alpha
I have a chart made with geom_rect, the problem is I’m using the argument alpha and he’s not applying the transparency on the chart. My code: dados %>% mutate(median_x = inicio + floor((fim -…
-
3
votes1
answer49
viewsHow to expose a set of functions that is within an object in the global scope?
I’m building a Javascript API that returns a set of functions accessible through an object. Every time I want to access some of these functions, I need to enunciate the object, for example:…
-
3
votes1
answer114
viewsHow to format an array for JSON output?
I have the following array: const products = ["camisa-PP", "camisa-M", "camisa-G", "camisa-GG", "camisa-GG", "camiseta-PP", "camiseta-G", "cueca-M", "blusa-XG", "blusa-XG", "blusa-XG", "blusa-P"];…
-
3
votes1
answer92
viewsRegular Expression for numbers between certain ranges
I needed to make a regular expression where I only accept the numbers of 11-14, 21-24, 31-34. I made the following regular expression: ^\A[11-14|21-24|31-34]{2}$ It is working, but why are you also…
-
3
votes2
answers63
viewsWhat does the %u do?
I’ve been doing a list exercise on strings and researched examples. One of the codes was this: /* strlen example */ #include <stdio.h> #include <string.h> int main () { char…
-
3
votes1
answer31
viewsClasses with Static attributes and methods that create themselves
Hello, today at the company I work saw a different way to create an object, I asked why? And I was told that the company’s standard is not to use static objects, I found it interesting. I tried to…
-
3
votes1
answer29
viewsHow to remove duplicate figures generated by the geom_errorbar function?
How do I remove the other tags generated by the function geom_errorbar()? I only need the marking that is circled in the image. Database dataset = structure(list(structure(c(1L, 1L, 1L, 1L, 1L, 1L,…