Posts by Maniero • 444,682 points
6,921 posts
-
3
votes1
answer52
viewsA: How is the encryption of a Securestring made and stored?
Just using it doesn’t do much good. And to think that it gives total security is nonsense. Read more in How, when and why to use "Securestring" in C#?. The implementation is detail, so it varies…
-
2
votes2
answers4220
viewsA: Adjust Form layout according to monitor resolution
That’s right. Winforms has everything fixed. And most leave this way. It is possible to use a flow panel to help her get more "responsive" (I made fun of her, I don’t like her using that word for…
-
3
votes2
answers1792
viewsA: How to turn this C++ code into C?
Except for the stream this code is already C, misspelled, but it is. It was not written the way C++, although Compile. Change cin for scanf() and cout for printf(). Don’t forget to include the…
-
6
votes4
answers2533
viewsA: How to split a string every 2 characters?
I would do so: import java.util.*; public class Program { public static void main (String[] args) { String texto = "99E65A78"; List<String> partes = new ArrayList<String>(); for (int i =…
-
10
votes1
answer72
viewsA: How to kill, remove or not initialize the SQL Server master database?
If you have privilege you can do this: ALTER LOGIN pnet WITH DEFAULT_DATABASE = meudb I put in the Github for future reference.…
sql-serveranswered Maniero 444,682 -
3
votes1
answer65
viewsA: How to save Strings from a file read?
Do so: List<String> linhas = Files.readAllLines("c:/teste.txt") I put in the Github for future reference. So much easier, right? Documentation.…
-
2
votes1
answer525
viewsA: Method of choice with while
It’s easier than it looks: print('''Choice your number [1] Banana [2] Apple ''') while True: option = int(input('Your option: ')) if option == 1: print('Banana choiced') break elif option == 2:…
-
4
votes2
answers1647
viewsA: Use of def function
def is a key word of language construction, it is not a function, it serves precisely to declare and define a function. Your code, by posting indentation, does not do what you want, Python is…
-
1
votes1
answer480
viewsA: BLOB column 'about' cannot have a default value (default)
What would be the default value for a BLOB since it can contain anything? Unable to set a default value cannot use this clause in this column type. On the other hand if the column accepts nulls,…
-
4
votes1
answer647
viewsA: Problems with the While Repetition Structure
Let’s make it simple (too bad Python doesn’t have one do or repeat: while True: sex = input('Digite seu sexo:') if sex == 'M' or sex == 'F': break Wanna keep doing it that way? sex = input('Digite…
-
9
votes2
answers74
viewsA: What is the best type to store area, volume, perimeter?
Generally speaking the decimal is the most correct. Even if you don’t need the exactness in it interact with other units that need the bad contaminates the good and everything gets wrong. Overall I…
-
5
votes1
answer95
viewsA: String Contains Empty returns true
We can say it’s a convention. The idea is that all string has a string empty. One string is composed of at least one string empty, and probably other characters in addition into the void. This…
-
5
votes1
answer25847
viewsA: Command to finish the program
Generally the end of the code ends the execution, of course if it is in a function called only the function will be finished and will return to who called. It is recommended to leave the intention…
-
3
votes1
answer345
viewsA: Is Hashmap possible with various values?
It’s simple, create a class with the members you need to use, so make the value be this object with all the members inside. Something like that (in a very simplified way): import java.util.*; class…
-
3
votes1
answer84
viewsA: Eliminate code redundancy in a while loop
Thus? from datetime import date def verificacaoData(): while True: dataForm = input('Digite a data atual no padrão dd/mm/aaaa: ') if date.today().strftime("%d/%m/%Y") != dataForm: print('Data…
-
1
votes2
answers1593
viewsA: How to insert sequence in non-automated field
If you can ensure that the vendor table has sequential code starting at 1 you can do: INSERT INTO contatos (cod, nome) SELECT (SELECT MAX(cod) FROM contatos) + cod, nome FROM fornecedores; I put in…
-
5
votes1
answer446
views -
5
votes2
answers156
viewsA: Execution of programs in pararelo WITHOUT use of Threads
how I know that the processes are actually running in parallel? Simple, if you have more than one processor, and today it is common to have at least 4, they are running in parallel. If there is only…
-
11
votes1
answer87
viewsA: Why does "int('1111', 2)" return "15" in Python?
You have created an integer based on 2, i.e., in binary, and 1111 is 15 in decimal. 1.23 + 1.22 + 1.21 + 1.20 8 + 4 + 2 + 1 = 15 If it were 1010 it would print 10. If it were 10000 it would print…
-
8
votes2
answers837
viewsA: What is the equivalent of the equalsIgnoreCase() in Kotlin?
The methods that make sense to have this option, and not only the equals() do so through a parameter indicating box ignorance (ignore case). See the documentation of equals(). See also the…
-
5
votes2
answers108
viewsA: How is jQuery built?
how this library can span all the complex Javascript language (functions, methods etc.) Simple, she doesn’t do this. The text seems to indicate that you think jQuery replaces Javascript, when in…
-
2
votes1
answer150
viewsA: Does Xamarin generate Java source code?
No, it uses its own infrastructure and only communicates with Java code where there is need for integration with the operating system, if I’m not mistaken they use the IKVM for this. So you can’t do…
-
5
votes2
answers444
viewsA: What are the advantages and disadvantages of creating a Windows service
Perks: It is controlled by the operating system and can start automatically on boot or on demand or restarting when there is some fault and can be done remotely directly No need to have a user…
-
4
votes2
answers171
viewsA: Delete and relocate index
I’m finding it odd to have these two tables separated, but since there’s no description of the case, you might actually need it. By the name and structure of the tables something tells me you don’t…
-
1
votes1
answer121
viewsA: Nullpointerexception in database connection
The error is not well in the code, but the code is wrong precisely because it hides the error. So it improves and at least treats the error properly. The failure in connection you will have to see…
-
4
votes1
answer143
viewsA: Method does not return true Boolean even if it is positive
Let’s demystify some things: first the Eclipse returns nothing because it is only one IDE. The code does things it doesn’t need, does things that give race condition problem, does things that should…
-
6
votes2
answers337
viewsA: How does the destructor ("__destruct" method) work in PHP?
Java has no destructor but has finishers and other mechanisms more modern and considered better. In fact the destructor was created more to finalize something, so the term is bad. Do not understand…
-
5
votes3
answers254
viewsA: Logic to compare four values and find the smallest
It can optimize and I think there’s a mistake: Se (A < B && A < C && A < D) { Escreva A; } Senao Se (B < C && B < D) { Escreva B; } Senao Se (C < D) {…
-
5
votes2
answers279
viewsA: Converting string to long int
I find it strange to ask for a long for that, but come on. By the statement the function must return a long and not a void. And you should not print anything, just return the value, and can already…
-
5
votes2
answers933
viewsA: If I directly copy the Visual Studio project folder gives any error? Or do I have to do something else?
Generally it’s supposed to work. If his VS is the same version. If more current form is likely to work, even if it needs an automatic conversion, in older versions than yours has a higher chance of…
-
1
votes1
answer687
viewsA: Working Flyway with Postgresql Database
Doesn’t actually create the table. You cannot take SQL from one database and use it in another, each one has a different syntax. Forget what you are doing. This code more or less converted to…
-
7
votes2
answers648
viewsA: Hyperfactor in C by recursion
I based myself in that formula and arrived at this algorithm: #include <stdio.h> #include <math.h> int hiperfatorial(int n) { double ret = 1.0; do ret *= pow(n, n); while (n-- > 1);…
-
2
votes2
answers1419
viewsA: Create and assign loop variables For
Whenever you have a variable with a common prefix and then you have a number forming a sequence, actually you shouldn’t have multiple variables, you should have a array, so the prefix is the name of…
-
2
votes1
answer419
viewsA: What is the best type of file compression to optimize server response?
It’s hard to say, every case is a case. Without measuring it has no way of knowing. Keeping files compressed will usually not bring benefits, even more on SSD. If the file is media it probably…
-
11
votes2
answers3969
viewsA: What is Garbage Collector and how does it work?
I will answer in general and use the CLR GC as the basis. The second question has already been answered. Memory management is something very difficult. There is a definition that only 3 things…
-
3
votes1
answer69
viewsA: Raising numbers financially
You can use the Round(). I hope you’re wearing the decimal on the payroll. There are cases that need to deal with the leftover rounding by law. Imports System.Console Imports System.Math Public…
-
4
votes1
answer350
viewsA: How to initialize an array in this constructor?
Use string and be happy, it’s much more C++. If you still want to use this form you will have to live with this limitation or initialize directly on the object: char Name[100] = { 0 }; I put in the…
-
5
votes1
answer535
viewsA: What is an Over-posting attack?
This bears some resemblance to the SQL Injection, only now because of an automation that a framework provides to decrease coding work. It usually occurs with MVC and ORM. What usually happens is…
-
3
votes1
answer258
viewsA: Obfuscating a string in the source code
It depends. You want to hide it from a curious person and if you’re discovered it’s okay? Then it’s okay. Do you want security anyway? Information can’t be discovered? So it doesn’t tickle. This is…
-
7
votes1
answer100
viewsA: Can a desktop program be considered client-side?
Any applications of any kind that serve to access something that is served externally to the "main" application can be considered a customer, need not even be on another machine. Outlook is a…
-
4
votes1
answer93
viewsA: Why use a pointer to that algorithm?
You want to sort a sequence of values, right? If you pass one int is only passing a value. If you create a sequence of values somewhere you can just pass the address of where this sequence is and…
-
0
votes1
answer28
viewsA: 2 different paths in compilation output
You can create a compilation event that makes the copy, something like that: Project Properties -> Build Events -> Post-build event command line You can put any command the operating system…
visual-studioanswered Maniero 444,682 -
3
votes1
answer39
viewsA: Value of one of the array fields
You have a array inside of another then can not pretend that does not have this array middleman. $array_exemplo = array( 0 => array( "primeiro" => "1", "segundo" => "2", "terceiro" =>…
-
19
votes1
answer3054
viewsA: What is a pure function?
A pure function is one that does not cause side effects, that is, it does not change any state in the application. But not only that, it always needs to generate the same result with the same…
-
1
votes1
answer782
viewsA: How to know that the attribute is not null in the Postgresql database?
I’ll answer what you asked though the question should be about what you’re doing wrong to have accepted NULL. He’s looking for the column is_nullable, table information_schema.columns is it that…
postgresqlanswered Maniero 444,682 -
5
votes3
answers9397
viewsA: How to pass arguments by reference in Python?
Python works the same as all languages, everything goes by value. What is different is that some values are accessed directly and others through a reference, ie have objects that are already placed…
-
3
votes1
answer346
viewsA: What is a YAML file and when should we use it?
No context was given, but if you’re talking about YAML is a serialized data format that we can say is a competitor of JSON. It is simpler and more economical. You can use it whenever you think it…
-
7
votes3
answers1476
viewsA: Is it necessary to create a primary key with auto increment?
You want to know if it’s better to use one natural key or substitute (surrogate). Only leave the registration field as the primary key. That’s a natural key. Do you control that number? Will it ever…
-
2
votes1
answer60
viewsA: Parameter name does not match with the variable passed
The function is completely independent of its call. One of the ideas behind the concept of function is precisely this. Function serves as an abstraction, so you just need to know the minimum…
-
1
votes1
answer1216
viewsA: How to read a keyboard number without using "enter" in C++
Basically use the get() of stream input. It is he who picks up a character without waiting for others or a key that ends. #include <iostream> #include <string> using namespace std;…