Posts by enzo • 1 point
42 posts
-
-1
votes1
answer33
viewsA: How to Clean Formalario in React
Use setValues within the function onSubmit: function onSubmit(evento) { evento.preventDefault(); fetch('http://127.0.0.1:8000/clientes/', { method: "POST", headers: { 'Content-Type':…
-
-1
votes1
answer27
viewsA: Problem with a game program (Rooster game in c++)
The problem is that you are setting functions within the function main. In C++ it is not possible to do this. To fix, just put your functions at the top level of the program, this way: #include…
-
-1
votes2
answers41
viewsA: How to map values with Dataframe pandas
You can do it this way: col = pd.Series(np.diag(val_df.loc[idx_df[0].dropna().index, idx_df[0].dropna()])) where idx_df corresponds to ele_genIdx and val_df corresponds to GenPart_pdgID. In the case…
-
-2
votes1
answer31
viewsA: How to pass more than one value to the value attribute?
Currently, you are passing the following value to the AuthContext.Provider: { { signed: !!user, user, loading, signUp, signIn, signOut }, { signedAdm: !!userAdm, userAdm, loadingAdm, signUpAdm,…
-
-1
votes1
answer33
viewsA: How to solve product scalar without using numpy library (python)
You can use a list comprehension: vetorC = [elemA * elemB for elemA, elemB in zip(vetorA, vetorB)] The function zip returns the elements of vetorA and vetorB in parallel for each iteration, then…
-
-2
votes1
answer35
viewsA: Why transfer the variable of entry into another?
Let’s assume at the end of the program you wanted to show the following message: print(f"O usuário fez o saque de R$ {valor} com sucesso") Also suppose the user provides 15 as input to the program.…
-
0
votes1
answer71
viewsA: How to implement the sine function using Taylor series in Python?
Taylor series for sine function is valid for every value of x, so there is no need to worry if the value is not in the range [-π, π]. Let’s use your example of π/6 and 5π/6 compared to the…
-
-1
votes2
answers69
viewsA: How to compare several different terms in a simplified way in Python?
You can use all: if all(termo != valor_aleatorio for termo in (termo1, termo2, termo3)):
-
-3
votes1
answer61
views -
2
votes1
answer48
viewsA: How to convert DDMMAYY to DD/MM/YYYY in C
You can do it using only math: #include <stdio.h> int main() { int data; printf("Digite a data em DDMMAAAA: "); scanf("%d", &data); int dia = (data / 1000000) % 100; int mes = (data /…
-
-1
votes1
answer35
viewsA: I can’t get all my options working
Let’s look at his execution sequence: oopt = input('O que voce deseja fazer? [1-4]') while True: try: if oopt == '1': # ... except ValueError: print('Digite valores reais') except ZeroDivisionError:…
-
-1
votes2
answers50
viewsA: Take a string snippet between two characters
You can use a regular expression: import re texto = '<http://informacaoquepreciso.com.br> "rel"="next"' padrao = re.compile('<(.*?)>') achado = padrao.match(texto) if achado:…
-
-1
votes1
answer39
viewsA: Save contents of a variable to a file . txt without saving the file just allow download
You can use the class Blob: function DownloadArquivo() { var data = new Blob(["Exemplo de Texto"]); var downloadLink = document.getElementById("aDownloadTxt"); if (downloadLink == null) {…
javascriptanswered enzo 1 -
0
votes1
answer94
viewsA: How do I know if my threads are actually running at the same time?
The problem with your code is that you are starting a thread and then JoinI walk it. You have four boomerangs and you want to launch them at the same time. You 1) throw the first boomerang, wait for…
-
-2
votes1
answer39
viewsA: How to extract information from a python request
You can use the library json: import json import requests url = "http://localhost/teste.php" headers = requests.structures.CaseInsensitiveDict() headers["Accept"] = "*/*" response =…
-
-2
votes2
answers70
viewsA: Error "cannot find Symbol" when creating an object
You must import the class Caneta in the class file Aula02: package aula02; import aula02.Caneta; public class Aula02 { // ... }
-
-1
votes1
answer54
viewsA: Error generation when trying to create a directory using Python: [Winerror 2] The system cannot find the specified file
Your current code will successfully complete if the directory geek exists, but will fail if it does not exist. The command os.chdir does not create a directory if it does not exist. This is the…
python-3.xanswered enzo 1 -
-1
votes2
answers36
views -
0
votes1
answer33
viewsA: Estimating Pi in Javascript
Some errors present in your code: start the variable t out of function start. In this case, the variable will be executed when the HTML is created, and in this step, the value of the text box is…
javascriptanswered enzo 1 -
1
votes1
answer45
viewsA: Transform a simply chained list code into a dual chained java list
You will need to add a new field to the class Celula: anterior: public class Celula { int valor; Celula proximo; // Adicione um campo que apontará para a célula anterior // Esse campo faz com que a…
-
1
votes1
answer71
viewsA: Read a txt file and add to a double-chained java list
First, let’s simulate a file, called txt file.. Your content will be as follows: T0;S0;P0;A0;E0;/P0 T1;S1;P1;A1;E1;/P1 T2;S2;P2;A2;E2;/P2 T3;S3;P3;A3;E3;/P3 T4;S4;P4;A4;E4;/P4 T5;S5;P5;A5;E5;/P5 You…
-
0
votes1
answer29
viewsA: How do I take a Long value in an Edittext and insert it into Firebase?(Android Studio)
Let’s look at the method setCodigo: public void setCodigo(Long codigo) { this.codigo = codigo; } See that he gets one Long as a parameter. Let’s look how you’re calling the method setCodigo:…
-
2
votes1
answer51
viewsA: Function that adds digits of a number - C++
You can create a function that computes the sum of the digits of a number and apply this function to all elements of your matrix. Your job would be something like: int raizDigital(int n) { int soma…
-
-1
votes1
answer104
viewsA: How to create automatic messages by Discord bot with constant updates? (python api)
I’m not familiar with the Discord.py API, but maybe it can be implemented that way: Create a list (or set) that will store all channels in which memes will be sent: channels = set() When a channel…
-
2
votes1
answer59
viewsA: The parameter of my function, when 1, assumes Boolean value and when False assumes Number value. How do I fix this? Javascript doubt
When you do if (par == (true || false)) you’re actually doing if (par == true) When making a comparison using == (equality comparison), some "unwanted" conversions are performed. For example, the…
-
0
votes1
answer29
viewsA: pycharm does not recognize mp3 file
The .mp3 is a binary file, not a text file, so you cannot view it in a text editor. You can open the file in a music player to check its contents or, in Python: play using the system’s standard…
-
0
votes1
answer23
viewsA: How to save a photo by creating a file with another name instead of replacing the previous file?
The problem is in on-click Istener button btnAbrir: // TimeStamp: 20210728_165608 String TimeStamp = new SimpleDateFormat("yyyyMMDdd_HHmmss").format(new Date()); // ImageFile: JPEG_20210728_165200_…
-
0
votes1
answer23
viewsA: Pandas - Problems with ". Loc[]" in multiple inputs
I think that can be done not on the call of loc, but yes when you get the variables from the user. First, we need to consider an entry that the user did not provide as None. Currently, you are…
-
0
votes4
answers58
viewsA: Image does not appear in the HTML project
You cannot have spaces in the path to the file. Try replacing the spaces by %20: <body> <header> <h1>Eu, Thaís Ketlen</h1> </header> <section> <header>…
-
1
votes1
answer22
viewsA: Hightlights inside the code on github
There is no Highlighter specific to the git commands, but you can use the gitattributes (does not work very well with special characters, however): How git commands are actually commands shell, no…
-
-2
votes2
answers29
viewsA: When trying to extract a PDF using Python Textract, returns an error
The problem is because you are treating the backslashes of the file path as normal characters instead of special characters. From documentation: The backslash character (\) is used to escape…
-
0
votes1
answer12
viewsA: How to insert a list of records into an adapter for filtering functionality in Android Studio?
The builder of the class DonoAdapter is defined as public DonoAdapter(List<Dono> donos, Context context) { this.donos = donos; this.donos2 = new ArrayList<>(donos); this.context =…
-
3
votes1
answer47
viewsA: Which mode is it possible to add 5 out of 5 numbers and display by removing the previous ones each click on the increment/decrement button?
There are some errors in your current code: In the attribute onclick of the buttons, you are not calling the function. By adding up the value inicio + 1 (of the numeric type) to the variable…
-
0
votes1
answer209
viewsA: Reduce Runtime Python3
Some tips: At least in Python IDLE, you don’t need to use the method strip in function input, since pressing enter the character '\n' is not taken into account. However if it is something that is…
-
4
votes2
answers1349
viewsA: Record runtime in python
You can use the moduletime. import time t1 = time.time() # código aqui tempoExec = time.time() - t1 print("Tempo de execução: {} segundos".format(tempoExec)) The line time.time() returns time in…
-
1
votes3
answers1916
viewsA: Find WHOLE word in a C string
In C, the function strstr in C returns a pointer to the first occurrence of the word to be searched. That is, after the word is found, all characters after this substring will be included in the…
-
0
votes1
answer58
viewsA: Arraylist of classes
If the ArrayList is of class MoedasList, you can do MoedasList[] moedas = new MoedasList[n]; where n is the number of items on the list. Then you need to start the objects of this class. moedas[0] =…
-
0
votes1
answer60
viewsA: Problems with averages
In charge return b, c;, the comma operator returns only the last element separated by the comma, and therefore has no logical meaning in your program. For example, in the function maior, instead of…
-
2
votes2
answers10417
viewsA: How do I multiply two matrices in python?
You can do two functions: getLinha(matriz, n) returns a list of line values n. getColuna(matriz, n) returns a list of column values n. Implementing, we have: def getLinha(matriz, n): return [i for i…
-
0
votes1
answer13
viewsA: Kotlin setting up font within Fragment
The exception NullPointerException is trying to say that the TextView is null. This can happen when the ID parameter used when you declared the variable using findViewById is not equal to the ID of…
-
2
votes1
answer113
viewsA: How to change parameters of a class within a thread
You are using multiprocessing. The shortest and simplest answer is that processes do not share memory by default. Try to use threading instead. import threading import time class Car: def…
-
1
votes2
answers62
viewsA: Vector Help in Programming Logic
The right condition would be or (represented by ||). if (X[i]== 3 || X[i] == 5) { band++; } That is, if the value of X[i] be 3 or be 5, the condition will be true.…