Posts by Guilherme Brügger • 588 points
22 posts
-
0
votes4
answers82
viewsA: How do I create a list for possible answers in python?
For simple conditions, you can use the if ternary of Python: print('obrigado, bom saber') if input('Você gosta de mim? ') in ['sim','claro','obvio'] else print('Que pena') Some people consider this…
-
1
votes2
answers55
viewsA: How to catch the smallest hints from the list, but only from Dice 0 to 1
If you only want to evaluate two indices, you don’t need to complicate using language functions, statements, or sequence slices. To compare two values, just use basic mathematics. With two values,…
-
3
votes3
answers176
viewsA: Doubt exercise with lists
Although the two other answers follow the same reasoning as the code shown in the question and contain algorithms to count positive numbers in a list, neither of them meets the question statement.…
-
2
votes2
answers166
viewsA: How to create the boolean AND condition in a . bat code?
If the two conditions have to be true, nestle one in the other. IF NOT EXIST "C:\Program Files (x86)\World of Warcraft\_retail_\Logs\WoWCombatLog.txt" ( IF NOT EXIST "C:\Program Files (x86)\World of…
batanswered Guilherme Brügger 588 -
2
votes1
answer38
viewsA: How to turn all Dataset into monetary values, or at least round them
but I got this>>> [<class 'decimal.ConversionSyntax'>] You are passing the entire column of the Dataframe as a parameter to the function format_decimal, who expects a number. Use the…
-
4
votes3
answers75
viewsA: Add Character at the end of the line
First, some considerations about your code: If you’re wearing one context manager with with open(..., you don’t need to close the file with f.close(). The context manager does it for you. I suggest…
-
4
votes2
answers328
viewsA: Print multiple numbers with a separator between them, but do not put the separator after the last
Without considering that you are not handling the input, an easy way to join the numbers would be to put them all in a list of strings and use the method join() to print the result. This method is…
-
1
votes1
answer126
viewsA: (NODE) What good is a processor with multiple nuclei if Nodejs only runs on one thread?
Node.js has the module cluster, which allows you to start Worker processes that split requests on the same port. In practice, you start a number of processes equal to the number of colors of your…
-
2
votes1
answer132
viewsA: List modification problem within a function (python)
Passing parameters by value or by reference The term "parameter" is used to indicate the names in parentheses in the function declaration. The term "argument" refers to the variables or literal…
pythonanswered Guilherme Brügger 588 -
1
votes2
answers528
viewsA: Apply dynamic filter to a dynamic dataframe in Python Pandas
df.loc[len(df)] = np.insert('Total', 1, df.drop('Nome', 1).replace('X|-', 0, regex=True).sum(0))
-
1
votes1
answer42
viewsA: Why user is created but password does not work?
When you use the command useradd passing the password, it should already be encrypted. Then do it using the command openssl passwd before. Capture the output of this command with the attribute…
-
0
votes1
answer1350
viewsA: How to execute Python commands inside cmd using a script
And if you do otherwise? You don’t need to start the Python interpreter from a program just to insert a function into it in the Spell and then take control. It is easier to start the interpreter…
-
0
votes1
answer86
viewsA: Sub query in a single SQL field
SELECT * FROM TABELA WHERE FIND_IN_SET($id, QUEMCURTIU) = 0 Even if it works, my comment on the question remains valid. If your argument is performance, this is much worse than normalizing the…
-
1
votes1
answer1994
viewsA: Upload and files using Rest API
If the file is small (some KB) and is always a plain text file (.txt) you can convert the content to Base64 and send to payload of the JSON object. The downside of this method is the effort to…
-
2
votes2
answers204
viewsA: Better structuring of object-oriented code
First of all, just as a suggestion to facilitate understanding of your model, I suggest you call your class "Discipline". Calling "Class" is confusing because they are all classes (in OO terms) and…
-
-1
votes3
answers1148
viewsA: How to concatenate strings without using a function?
You can iterate through the character array of the second string and add one to one at the end of the first string. char str1[100], str2[100], i, j; //Conta o tamanho da primeira string (poderia…
-
-1
votes3
answers227
viewsA: Mysql sorting by specified value Return all values
Make two queries and use the results in sequence: SELECT * FROM tabela where dia = $dia" SELECT * FROM tabela where dia <> $dia" "Ah, but I don’t want to make two appointments..." Then unite…
-
0
votes1
answer176
viewsA: Problems with spring mvc friendly url
It is not considered good practice to put the context of the web application or the full address hardcoded on the page. If you change anything, then you will have to search throughout the project.…
-
1
votes1
answer339
viewsA: Recover shopping cart after close and open browser
The session can only store attributes while the client is interacting with your application within the validity period of that session. In case of inactivity for a longer period than the validity or…
-
0
votes2
answers40
viewsA: Logout error, no connection class found
According to the error, PHP is looking for the included file in the path ./connect/Connect.php. This path is relative to the file path where it is being used, i.e.,…
phpanswered Guilherme Brügger 588 -
2
votes2
answers1605
viewsA: Calculate column date - 6 months of current date (SQL SERVER)
If it means not exceeding the last six months, try this: SELECT * FROM <TABELA> WHERE D_EMISSAO >= dateadd(month, -6, getdate())
-
3
votes2
answers412
viewsA: RFID BLUETOOTH PHP
Dealing with very specific hardware from high-level languages is usually a challenge, especially if it is in web applications. Some considerations about your problem and a suggested solution: The…