Most voted questions
150,413 questions
Sort by count of
-
3
votes1
answer52
viewsWhat does this point in the structure code mean?
int main(){ char buff[129]; WSADATA wsa; WSAStartup(MAKEWORD(2, 0), &wsa); struct sockaddr_in caddr; struct sockaddr_in saddr = { .sin_family = AF_INET, …
-
3
votes2
answers110
viewsHow to edit a li with Javascript?
Objective: Get the contents of <li>, play in the text field, change, return pressing Enter and clear the field. Upshot: The closest I can get is to take the content, edit it in the text field,…
javascriptasked 4 years, 7 months ago Diluxa 33 -
3
votes2
answers515
viewsJava 8 stream - performance improvement
I am implemented a method that receives an integer value k (representing the amount of "vacancies") and two lists (p and q) of Integer and perform some operations. Using stream, check which elements…
-
3
votes1
answer179
viewsPrinting tabular form lists with generators
I have a list that represents 5 one-month periods with 31 days, and each period contains daily target values for a retail seller. Only for elucidation purposes would the empty structure be like…
-
3
votes1
answer108
viewsError when calculating decimal value
I need to calculate the interest value, this is the code: public async Task<decimal> CalculatesInterestAsync(decimal valorInicial, int meses, decimal juros) { var valorFinal =…
-
3
votes2
answers399
viewsExtracting words from a long text and creating statistics on them. What’s wrong?
We have the book "Pride and Prejudice by Jane Austen" of the project Gutenberg: http://www.gutenberg.org/ebooks/1342 The goal is to extract all the words of the text, creating statistics such as:…
-
3
votes2
answers679
viewsRegular expression to validate a password with Python
Passwords must contain at least 5 words (word = 1 or more letters), each separated by a hyphen, a space, a dot, a comma or an underscore. Example: a-b-b-c-d-d OR Passwords must be at least 8…
-
3
votes3
answers183
viewsRemove repeated elements using two lists
How would you remove without using collections and while, only with for. I wanted a search structure element by element, because I already know how to remove this way. So I want to use at least two…
-
3
votes1
answer94
viewsWhat is the "y" flag in regular expressions? What is its function?
Some time ago I discovered that regular expressions can also use the flag y, call for Sticky. I did not understand very well its function. What is its purpose? Is there any relation with another…
-
3
votes2
answers57
viewsFormat string for (dd/mm)
I get a 4-digit string (numbers), and I need to break it in half, and put a "/", to format in type (dd/mm) <input [(ngModel)]="contato.birth" class="form-control" type="text"…
-
3
votes1
answer167
viewsCapture and treatment of exceptions in a generic way
In general the most common is to capture the exceptions specific and do some treatment with it, right? Example: try { //Algum trecho de código } catch (MyException myException) { //Especifico para…
-
3
votes1
answer259
viewsHow to link to SVG objects?
I have this path: <path…
-
3
votes2
answers235
viewsHow to run all my tests at once?
How to run all unit tests at once on the flutter? Each test has only the option Run as in the image: So I’d like to know how to run all my tests at once without having to click each one.…
-
3
votes1
answer98
viewsWhy when ordering a list with Sort(), returns None?
The following script sorts a dictionary: d = {'a': 10, 'g': 15, 'c': 67, 'z': 90, 'e': 144} ordenada = list(d.keys()) # gera uma lista das chaves do dicionário (protegida por uma tupla)…
-
3
votes2
answers261
viewsPython Mysql Connector 2 cursor
I just started with python and I’m trying that: import mysql.connector mydb = mysql.connector.connect( infos.. ) cursor = mydb.cursor(buffered=True) cursor2 = mydb.cursor() query = ("SELECT * FROM…
-
3
votes2
answers256
viewsConvert string to date
I have a date frame whose column that shows me the date has the format 'nov/19' and it’s an Object, I need to convert it to the date format. I know that in the documentation of datetime it is said…
-
3
votes4
answers1030
viewsSum the n odd terms ,using Loop for ,without using list, allowed functions:input,int,print and range
n =(int(input("Digite o número de termos:"))) for i in range(n+n): if i%2>0: print(i) #Não sei como prosseguir depois,como pego esses valores e somo eles…
-
3
votes2
answers228
viewsHow to make a program of tables with command structures restriction?
This program is for axiliar a person to see the tables, the intention is to offer 2 options: Case 1: Table 1 to 10 is returned; Case 2: No the multiplication table of a specific number. However the…
javaasked 4 years, 8 months ago Patrik Rufino 51 -
3
votes0
answers21
viewsWhy even without creating a variable referencing the elements in HTML the code still works?
let demo = document.querySelector("#demo"); let button = document.querySelector("#button"); button.onclick = () => { demo.innerHTML = "Novo texto!"; } <p id="demo"></p> <button…
-
3
votes1
answer629
viewsKeyerror: '>R' in Google Colab Python
I copied the following code from a data visualization tutorial in Python, but it does not perform properly, warning Keyerror as seen in the title. Can someone help me? There’s something wrong there?…
-
3
votes2
answers384
viewsHow to call a function in javascript by Android keyboard enter?
Good night. I’m studying and I really need three things, but if you can help with just one, that’s good, I tried to search and applied many tips from various websites but I was not successful. I…
-
3
votes1
answer51
viewsHow would I let this expression of mine beyond the character - (less) be accepted the + (more) as well?
I have an expression on a input, using pattern, that has some rules, among them: Accept uppercase letters, lowercase, minimum of 5 characters, do not accept special characters (only accept the -).…
-
3
votes1
answer85
viewsHow does this loop work to check duplicates?
The code below creates another filtering array so there are no duplicate values: var array = [1,1,1,2,3,4,4,5]; var models = []; for ( var i = 0; i < array.length; i++ ) { if ( array.indexOf(…
javascriptasked 4 years, 8 months ago Null 523 -
3
votes1
answer231
views -
3
votes2
answers1637
viewsHow to print 4 triangles patterns next to each other in Python?
I need to write a program that prints 4 triangles patterns, one next to the other, separated by three horizontal spaces, as in this image below: To solve this, I wrote the following code: for i in…
-
3
votes2
answers187
viewsDoubt about Python’s rstrip function
Any idea why the Python command 'i3-7023'. rstrip('-7023') result only in 'i', while the command 'i3-8819'. rstrip('-8819') result in 'i3'? One would not expect the first command to also result in…
pythonasked 4 years, 8 months ago Mairan Thales Macedo 53 -
3
votes2
answers1231
viewsHow to add text to a specific line in Python txt file?
I am trying to store data in a txt file, but I need to save it in specific lines. How to proceed? I’d like to do something like: data = open('arquivo.txt', 'a') data[linha específica].write('Texto…
-
3
votes2
answers244
viewsWhich package should the "@required" annotation be imported from?
I need to put the note @required in a builder: class Pacote { final int id; final int nCodigos; final String tabela; Pacote({@required this.id, @required this.nCodigos, @required this.tabela}); //…
-
3
votes1
answer106
viewsVue NUXT.JS, multiplies functions in asyncData
I’m a beginner in Vue with Nuxt, wanted to understand what the problem in this code that only the first function works: async asyncData () { const {data} = await axios.get('/api/skills/view') return…
-
3
votes0
answers39
viewsNotion Big O and small O, Big Omega and Small Omega, applied to very similar exponential functions
In the academic book we use, asks us to relate what a function A is of a function B (ex: A = O(B)) You have a relationship that I can’t understand the resolution of the answer To = (1,21)^n B =…
asked 4 years, 8 months ago Pirategull 659 -
3
votes1
answer42
viewsHow to handle an error within any Python class?
If I do something like: class Foo(object): pass print(Foo().python) **OUTPUT:** AttributeError: 'Foo' object has no attribute 'python' How can I treat this exception within my class, rather than…
-
3
votes2
answers339
viewsHow to remove an object from a list during an iteration over the list itself
I need to remove an item from a list during an iteration over the list itself. The reason to remove during the loop is that if this item remains may end up triggering other triggers within the loop…
-
3
votes1
answer71
viewsIs there a better way to group "Ors" in Python without having to type the variable all the time?
Example: letra = input('Digite uma letra: ') if(letra == 'a' or letra == 'e' or letra == 'i' or letra == 'o' or letra == 'u'): print('Vogal')…
-
3
votes1
answer36
viewsQuery to find duplicate by DATETIME (MYSQL)
Good morning to all. I need help to better understand how to apply a query that I’m developing. I would need to formulate a SELECT to seek certain records within a period involved (DATETIME). On DB:…
-
3
votes1
answer65
viewsPCA method for Feature Selection - How do I resolve the raise Exception("Data must be 1-dimensional" error)?
I am trying to implement the PCA method for Feature Selection from the following functions: #Função que permitirá rankear as features mais importantes em um barhplot def ranks_PCA (x_train, y_train,…
-
3
votes0
answers475
viewsCORS policy Delphi Rest Full
I am creating a Delphi Rest Full server to be accessed with Angular front-end, I can apply the POST, PUT and GET but in the attempt to run a DELETE I get the CORS error implemented treatment as many…
-
3
votes1
answer157
viewsWhat is the Datatransfer property for?
I am learning drag and drop in Javascript and I’m not really understanding what the property is for DataTransfer, for example her syntax would be something like:…
javascriptasked 4 years, 8 months ago marquinho 489 -
3
votes1
answer100
viewsAsync functions inside setInterval giving Syntax Error in HTML
Good morning/evening guys, I’m having a really boring problem, I’m creating a website for a school biology project, about cells. On this site I have to make a loop that performs an action, wait X…
-
3
votes1
answer263
viewsWhat is the logical port of the user in PHP?
What is "logical port"? And how to detect the logic port of the user using PHP? Would that be? $porta = $_SERVER['REMOTE_PORT']; Source:…
-
3
votes2
answers609
viewsRegex for full sentence in capital letters
I’m going through the first column of the body of an HTML table and extracting the text from each of the cells using Javascript and testing against a Regex. Regex has the function of identifying…
-
3
votes0
answers36
viewsObject comparison in "Flyweight Pattern"
I was reading that question, and I was left in doubt as to how the comparison is made between the objects, thus determining which object would be equal to the other, and which would be a new object.…
-
3
votes0
answers59
viewsWhat is the best way to read a json in flutter?
I’m entering the world of development and learning Flutter to program for mobiles. The basic operation of my app will be to read a JSON from my server and play on a list in the app. Doubts: What are…
-
3
votes2
answers185
viewsWhy pass Event in a function as a parameter?
I have this doubt for a long time, but I’m posting it now. I’ve seen several times in codes the programmers use as a parameter in functions event and I always wonder if it has any relevance in using…
javascriptasked 4 years, 8 months ago marquinho 489 -
3
votes1
answer77
viewsCopy and split a List in Python3, Merge Sort
I was trying to write the merge sort in python on my own, but returned a list nothing to do with several repeated numbers. When checking the solution code online, I was left with doubts about how to…
-
3
votes1
answer69
viewsReact Native Hooks
I have these two classes and want to move to two functions without using this. Only with Hoocks(useNavigation). Página Home: import React, { Component } from 'react' import { Text, View,…
-
3
votes1
answer1275
viewsError 403 github
I created a new Github account and when I try to give a git push -u origin master it returns an error saying that I am not allowed to access that repository. It appears as if my old account was…
-
3
votes1
answer79
viewsWhat is the difference between calling a function and returning a function?
I have, for example, a function myFunction() to be called in the element <body> when the event onbeforeunload occur: <!doctype html> <html lang="en"> <head> <meta…
javascriptasked 4 years, 8 months ago user178466 71 -
3
votes2
answers301
viewspython np.Where with two conditions
Hello, I have the following dataframe: import pandas as pd import numpy as np x = pd.DataFrame({'A': [1,2,3,0], 'B': [5,0,0,1]}) What I want is to create a column’D', which is True if the two…
-
3
votes1
answer86
viewsIs it correct to use a static method of an abstract class?
During a work assignment I came across the need to use an abstract class method to avoid code duplication. In this case, I came to a question whether it is correct to use a method of a class, which…
-
3
votes1
answer85
viewsObject access bracket notation does not accept String object
I am trying to call a function which is a property of an object, passing a parameter to it. For this I use bracket notation plus this: (parâmetro). Thus: afraid[day](num.toString()) But returns…