Posts by Gabriel • 1,909 points
91 posts
-
1
votes3
answers417
viewsA: Counter of a subsequence of repeated strings in C
First, note that your code has some warnings: main.c: In function ‘main’: main.c:17:5: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]…
-
0
votes1
answer42
viewsA: Optimizing Data Output
Use a bow tie for, just like you did to put together the list comissoes. for indice, comissao in enumerate(comissoes, start=1): print("\nValor da Comissão do %dº Representante: R$ %5.2f" % (indice,…
python-3.xanswered Gabriel 1,909 -
1
votes1
answer818
viewsA: I need to know the size of a file even before it is created
To generate a text file you need a string. texto = 'eu faço\nperguntas\nno SO-pt' You can generate the binary representation of the string with an encoding. btexto = texto.encode('utf8') Once you…
-
5
votes2
answers1275
viewsA: How to use the Graph Cycle Verification Algorithm?
There are several algorithms that can be used to identify cycles in graphs. The simplest is the produndity search (DFS). Just implement an in-depth search that returns true if you find an already…
-
1
votes2
answers947
viewsA: How to convert gray image to RGB?
As stated in the comments, there is no way to recover the original values only from the gray value. What you can do is store both the gray value and the RGB. For example, you will have a Pixel class…
-
1
votes1
answer101
viewsA: Algorithm for popular tables in Postgressql
You already have everything you need. Simply implement a recursive function that inserts a row into the FK table before inserting the row from the current table. It’s basically doing a tree search.…
-
4
votes1
answer2544
viewsA: How is the basic functioning of algorithm A*?
How algorithm A* can find paths in a graph? The algorithm receives: the graph the initial node the final node a function of heuristics Starting from the initial node, it takes all the neighbors of…
-
3
votes1
answer172
viewsA: Create a program that receives a line of text and counts the vowels showing the respective Histogram
Just iterate through all the vowels and put the logic inside the loop. texto = 'na proxima quarta-feira é feriado' for vogal in 'aeiou': n = texto.count(vogal) print('a:', '*' * n, '(', n, ')')…
-
2
votes2
answers38
viewsA: Compile string as code
If you want to execute an instruction that does not return a value, use Execute, example: Option Explicit Dim mensagem Dim codigo mensagem = "Oi!!!" codigo = "MsgBox mensagem" Execute codigo If your…
-
1
votes1
answer75
viewsA: Ghost repetition structure
This code searches for brute force in the labyrinth. He always tries to go first to the right; if it is not possible he tries to go down, but to the left and, finally, up. (Note that this is exactly…
-
1
votes1
answer627
viewsA: Pass value to component with Vuejs
Install Vuex Create a store for the user data Update the data employee when logging in Consume the data in any component…
-
3
votes1
answer253
viewsA: What is it, Reason?
Reason is a language that mixes Ocaml and Javascript. It was developed to make life easier for Javascript programmers (so they don’t need to learn Ocaml proper) and also to facilitate compiler code…
terminologyanswered Gabriel 1,909 -
6
votes3
answers482
viewsA: Rescue only 10 first Python object records
In your specific example, using the syntax indicated by @Thiagoluizs is the best alternative. I would just like to point out that not all eternal objects are "wearable". For example, this can be…
-
1
votes3
answers4127
viewsA: Calling attributes of an object in another class in python
I wanted to know what I call attributes of another object in another class The line you highlighted is declaring an attribute of the class. In Python, the statement is made in the first assignment.…
-
2
votes1
answer298
viewsA: Determine sequence of numbers with Bubble Sort from a python txt file?
First of all, let’s create two functions that to assist us. The first function takes a line from the file and returns a list of integers. def parse(linha): return [int(x) for x in linha.split()] The…
-
1
votes1
answer474
viewsA: Queue Logic - Python
See the following timeline. (12)-(123)-(1234)--------( 234)----------( 34)----------( 45)----------( 5)----------( ) ^^ ^ ^ 1 2 3 ^ 4 5 Each stroke is a minute gone by In parentheses is the customer…
-
1
votes1
answer645
viewsA: Python Error: 'int' Object has no attribute '__getitem__'
Add a print(oPop) on line 29 (before the error line), you will see that the first item of the oPop is an int, not a list. For this reason, within that dark expression the int is used as if it were a…
-
0
votes1
answer71
viewsA: Error installing module - egg_info
This package is not available for Python 3 and has not been updated for 5 years (i.e., it was probably abandoned.) https://pypi.org/project/Pattern/#history…
-
1
votes1
answer235
viewsA: Scroll through the entire record
Python has a module to access the Windows registry. It comes together in the standard library, no need to import anything external. import winreg This module has a function that takes an HKEY and an…
-
0
votes1
answer88
viewsA: main(String[]) exceeds 65535 bytes limit
As you have noticed, Java does not allow such long methods: package ordenar; import java.util.ArrayList; import java.util.*; public class Exercicio{ public static void main(String [] args){ double a…
-
0
votes1
answer43
viewsA: How do I create an installation menu with check box?
The following method takes the path from an executable, calls the executable and waits until it closes. public void AguardarAteEncerrar(string caminhoExecutavel) { var processo = new Process {…
-
2
votes1
answer98
viewsA: Automatically add items from an array
The algorithm that satisfies your request is trivial to be implemented. Here is an example I wrote: // Essa função gera recursivamente toda a árvore de possibilidades para // todos os trocos iguais…
-
0
votes2
answers95
viewsA: HTML alignment using Python
This is simple to do using lxml library. http://lxml.de Follow an example of code: from lxml import etree, html documento = html.fromstring('<li><a…
-
1
votes2
answers366
viewsA: Elements of a List are all the same
Your code does not work because you are not recursively comparing all elements. Try this version here: iguais :: [Float] -> Bool iguais [] = True iguais [_] = True iguais (x:xs) = x == (head xs)…
-
2
votes3
answers172
viewsA: Is it possible to find darker/lighter shades from a hexadecimal?
There is a very simple way, but it does not offer much control. To make it darker: (corEmHex & 0xfefefe) >> 1 To make it clearer: (corEmHex & 0x7f7f7f) << 1 If you want to have…
-
1
votes3
answers342
viewsA: Why doesn’t the while stop?
First, you want to compare whether the content received by gets is equal to the string "s". To compare strings you must use the function strcmp, returning 0 if both strings are equal. while…
-
1
votes1
answer157
viewsA: Doubt command in Python
No. In Python you should use repetition structures and conditional structures to control the flow of your code. To run lines of code if a drive is true, you do the following: minhaVariavel = 5 if…
-
3
votes2
answers155
viewsA: How to make Where ands dynamically with Linq and Entity Framework?
What you want is to add the Where only if the mdlParceiroFiltro.FiltroId is not null or Empty. IQueryable<ParceiroModel> entidades = _dbContext.TbParceiro; // Verifica o FiltroId é válido if…
-
0
votes3
answers94
viewsA: Because with Arrow functions the context is different from a common function?
You should use the concept of closures to get a direct reference to the thisfrom the external context to your Arrow Function. Just capture the this in a variable and use this variable within the…
javascriptanswered Gabriel 1,909 -
0
votes1
answer62
viewsA: Replica in datagridview (Vb.net and ms-access database)
How are you adding lines directly into DataGridView, you must call these two methods in sequence to remove all lines present in the object. DataGridView2.Rows.Clear() DataGridView2.Refresh() If you…
-
7
votes1
answer8878
viewsA: Generate table Insert script in sql server
Enter Management Studio and right-click on the bank to be exported. Access Tasks > Generate Scripts as per image Will open a Wizard. You choose the type of data you want to export (tables, views,…
-
2
votes1
answer132
viewsA: system with CRUD
Look at your logic: for(int j = i; j < qtdImoveis-1; j++){ imoveis[j] = imoveis[j + 1]; qtdImoveis--; imoveis[qtdImoveis] = null; } If the array has 1 element and you want to remove this single…
-
0
votes1
answer43
viewsA: Standard information of a record
Technically it works with any of the forms. You should check which of the two forms provides the best index on the bench. This will depend on the queries that are launched in the database, so you…
-
1
votes1
answer530
viewsA: Function returning None when finished
See your code. def superfat (n, x = 1): if n > 0: x*=fat(n) n-=1 return superfat(n, x) When n > 0, the following excerpt shall be implemented: x*=fat(n) n-=1 return superfat(n, x) But when n…
-
2
votes1
answer495
viewsA: Multiprocessing with python infinite loop functions
In your program window builder you should start a new thread with the microcontroller class (which is the class that contains the infinite loop that communicates with the microcontroller). To make…
-
2
votes1
answer357
viewsA: java.lang.Indexoutofboundsexception: Invalid index 2, size is 2
You are increasing the variable position each time you iterate for a package. In the third package this variable has value 2 (because it started in 0), only that the third packet standings array…
-
-1
votes1
answer381
viewsA: How to check null fields in sql?
You owe two Fks on the table reservas: One that points to utilizadores, otherwise you don’t know who made the reservation One that points to ofertas, otherwise you don’t know which offer was…
-
1
votes1
answer597
viewsA: Design Standards: Singleton Design Standards
Usually we use the Singletonin one of the following situations: Class consumes shared external resources We want to avoid overhead of instantiating the class in many different places For example,…
-
1
votes2
answers134
viewsA: Set the name of a property dynamically in VB.NET
I don’t know which library you’re using to deserialize JSON, but it probably offers a way to deserialize for a Dictionary. In this case you need to deserialize for a Dictionary(Of String, Object),…
-
0
votes1
answer1072
viewsA: How to take the Text of a Div Class and Put it inside a Label?
What you need to do is use a query xpath to specifically select the node you want. This Stackoverflow question shows how to use xpath with . Net’s Webbrowser (is in C#, but you can understand…
-
0
votes2
answers41
viewsA: I can’t get the stock down
You need to debug the code to find out which line isn’t doing what you should be doing. Reading the code from above, there are two points where the problem may be... First:…