Posts by Maniero • 444,682 points
6,921 posts
-
16
votes1
answer385
viewsA: Is the C# language recommended to be distributed online with a database?
The problem of security is in the programmer and not in the language. When using the wrong technique you will get the wrong solution. Executable safety In any language you can pick up passwords…
-
5
votes1
answer88
viewsA: Negative return from Array.Binarysearch()
The reason is simple, a binary search, as the documentation says, can only be performed in a sequence of previously classified data. Without this condition being met the result is determined as…
-
1
votes3
answers82
viewsA: Should I allocate the member of the date structure as well?
Yes, it should. Every object pointed by a pointer needs to be allocated somewhere. It can even be allocated to stack, but this is rare and would not work in this case. Then every object that will be…
-
7
votes1
answer615
viewsA: What does the term "String... string" mean in java?
This is called varargs. This is the way to indicate that the last parameter is actually a array of the type mentioned. Then the arguments in the method call can have a variable amount. That is,…
-
2
votes1
answer107
views -
11
votes4
answers5008
viewsA: Odd or even array in PHP
It’s simple, the check is comparing to the array and not with the element of array, as it should. That is, it always turns out false because a array, as a whole is always different from 0. Missing…
-
6
votes2
answers108
viewsA: Cast in sockets
Why use cast where you don’t seem to need Only with a passage can not explain much, but it is unlikely that it is only aesthetic, even because I have not seen where it is most beautiful. Cast…
-
6
votes1
answer1464
viewsA: Simple permutation algorithm
Since you are using modernities and ready-made functions that do the work for you, there is no need to complicate so much: public static int Teste(int number) => number >= 10000000 ? -1 :…
-
10
votes1
answer3570
viewsA: What is the purpose of using inline functions in the C language?
Any decent compiler in C today tries to force the functions to be inline whenever it is worthwhile to do this, regardless of the code given. Of course it is possible to control this via switch…
-
28
votes1
answer622
viewsA: At what times is it necessary to force garbage collection in C# for better application performance?
Never! Okay, if you have a complete command of how the current GC implementation works, are willing to pay the price if a change occurs and can improve when there is a change, it might be worth…
-
3
votes2
answers331
viewsA: I cannot enter user-defined values in Sqlite
First, use REAL to store monetary values is a mistake. If you want to insist, you need to convert the data received by input() in a floating point type to match the type REAL, thus:…
-
2
votes2
answers1246
viewsA: How to add elements at the "x" position of an Std::vector
You can use the method insert(), but you need to create an iterator: #include <iostream> #include <vector> int main () { std::vector<int> vec {1, 2, 3, 4, 5, 6, 7, 8, 9}; auto it =…
-
1
votes1
answer1282
viewsA: How to call builders with arguments?
The code is right but could do better: class Aluno { String nome; int idade; public Aluno(String nome, int idade) { this.nome = nome; this.idade = idade; } public Aluno() { } } class Principal {…
-
11
votes1
answer950
viewsA: Vector within vector. What does it do in this context?
The operator ++ is an incrementer. If you have a variable called x can do: x++; that the same as: x += 1; which is the same as: x = x + 1; which is the same as: ++x; The difference is that the…
-
6
votes2
answers212
viewsA: Problems to delete repeated numbers in an Arraylist<String>
You cannot remove items from the object being iterated, because it happens to have another structure during the initiated iteration. You have to create an auxiliary structure. If you want to do it…
-
10
votes2
answers625
viewsA: Is it really necessary to use mutator and access (Setter and getter) methods in PHP? What about performance?
The main reason to use methods getter and Setter is to have something other than simple access and attribution to the property. So if you don’t have a processing, shouldn’t you use it? That’s not…
-
12
votes3
answers307
viewsA: Is there a difference in performance between "echo" content and HTML content?
Pure HTML Pure HTML is absurdly faster. It’s a static file that doesn’t need any processing, load PHP to process it, nothing. Boy, boy, he asked, he sent. Using PHP If PHP is used to process the…
-
3
votes2
answers3727
viewsA: Greater and lesser number
A simple way would be this: import java.util.Scanner; class Ideone { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println(" Tres números:"); int a =…
-
2
votes1
answer1061
views -
5
votes4
answers832
viewsA: Create layout for PHP and . NET applications
The solution to this is more or less what is already in the question. Of course the ideal is not to use various technologies, if it did it would still be better to change all that, but it may be…
-
2
votes1
answer1038
viewsA: Sqlite android query() / like with accents and without
The solution presented even works, but is absurd. Sqlite works well by default with ASCII and lets the user cope with other options. If you are going to use accent need other text encoding. One…
-
25
votes4
answers2243
viewsA: Alternative to CPF (Foreign Users)
TL;DR CPF is not a good candidate for primary database key and is probably not ideal for "control", whatever that means for AP. In that case a replacement key is usually a better option. You will…
-
3
votes1
answer66
views -
7
votes1
answer156
viewsA: To create a function equal to C# Array.Copy in C++
C++ already has something ready that does this with std::copy(): std::copy(std::begin(src), std::end(src), std::begin(dest)); I put in the Github for future reference. Trying to translate the code…
-
5
votes1
answer1015
viewsA: How to translate a program into C for Assembly?
The Microsoft compiler uses option /FA. In the GCC is used -S. As for the "interaction" depends on the problem, ask another more specific question.…
-
8
votes3
answers596
viewsA: Round a number to Top 4023.8599999999997€
Actually the only way to actually solve the problem is to change the type of data you’re working with. Floating point values are not worked with money. This is a serious error. Other solutions only…
javascriptanswered Maniero 444,682 -
5
votes2
answers610
viewsA: Is it bad to use the standard PHP session engine?
As every resource you need to understand it completely, read all documentation and eventually look for undocumented information. Something complex like this can have a lot of details that can go…
-
5
votes1
answer1218
viewsA: Sort numeric vector without using Bubble Sort
The most commonly used sorting algorithm is the Quicksort. It is not good for all cases, but it is good in many and the most common. Unless you need extreme performance and know that the typical…
-
3
votes2
answers1359
viewsA: Specified conversion is not valid in Executescalar
I will consider that the type of resultados is double. So make a conversion instead of a cast: Convert.ToDouble(command.ExecuteScalar()); There’s no point in using the TryParse() here because this…
-
59
votes1
answer28542
viewsA: What are the most relevant differences between C# and Java?
In fact who works with only one will be biased towards her. They really are very similar, but the culture around them is very different. For example, Java tries to be more explicit, C# tries to be…
-
7
votes3
answers1114
viewsA: Working with lists without using Array() in PHP
By default it doesn’t exist. Nothing prevents you from creating new types that specifically implement each of these related structures and algorithms. Probably using the array concretely within the…
-
3
votes1
answer49
viewsA: What is the best way to perform a dependent addition/subtraction operation?
It really tastes like. Many people like the first because it seems clearer. For me both are clear. Those who understand the programming can understand well any one of them. Some people will say that…
-
6
votes1
answer1222
viewsA: Scanf is not stopping on repeat
I decided to respond to give a code cleaner and within the standards: #include <stdio.h> int main() { char op = ' '; char letra = ' '; do { printf("\n0) Sair\ \n1) Digite uma letra\ \n2)…
-
22
votes1
answer5487
viewsA: What is the difference between single quote ' and double quote " in SQL?
In standard SQL only apostrophes (single quotes) are recognized as literal delimiter strings or some other type of data (I believe that for other types it is specific and not standard). Specific…
-
5
votes3
answers8112
viewsA: Is there any way to pass methods as a parameter?
Generally speaking, directly, no. It is possible to create a class, which can even be anonymous, that contains this method and then call the method of this class according to some convention…
-
7
votes2
answers5642
viewsA: How to access variables present in different functions?
Everything you put inside a function is local to this function, you can not use elsewhere. There are some solutions. The first is to return the value - but not the variable - you want, and then…
-
11
votes1
answer778
viewsA: Does every processor use the same instruction set?
What you’ll find out there is theoretical, practice is to do, so do it, but how will you do it without knowing the theory? Unless you’re referencing the practice as the cake recipes that some post,…
-
4
votes2
answers8390
viewsA: Where is the constructor of the class in Python?
What is a builder This is a technicality and we can consider him as the constructor. In fact he is an initiator, as he had already written in previous question, but the initializer will be called…
-
9
votes1
answer986
viewsA: Is loading PHP into JS a good practice?
Initial definitions Good practice Good practices are bad. Doing the right thing for every situation is what should be done. There are cases where one option is better than the other, just analyzing…
-
2
votes1
answer802
viewsA: Pass array as parameter
The code is quite confusing and would need to make several changes to solve the problem. The first is to match the signature of the method that will receive the regions, missed to put the type:…
-
6
votes3
answers1803
viewsA: Tables/Temporary content in the database?
I think it’s all about creating temporary tables for this. Do everything on them and they can be discarded manually or automatically at the end of the/transaction section. You can create like this:…
-
1
votes3
answers492
viewsA: Using an operator on a switch case
This is simply not possible. You cannot put what you want into case. There fits only primitive constant values. It is not even possible to use a array, including strings. What you can use is:…
-
9
votes2
answers424
viewsA: What is the purpose of empty command blocks or which do not belong to any command?
As you can see, the definition of what a command block is already wrong. It allows zero or more commands (I don’t really like the translation of statement for command, but she the closest we have,…
-
2
votes1
answer1104
viewsA: Take and display data from a class attribute (class association)
The design is bad, is mixing things. I do not know if I understand what you really want. I will change to a form that is correct. It still won’t be so right because classes mix things that should be…
-
5
votes1
answer715
viewsA: File comparison
There are several ways to do this, each with its advantages. As there are no restrictions I will put what is probably the simplest way. I’m using LINQ: var arquivo1 =…
-
5
votes1
answer986
viewsA: How to create runtime formulas in C#?
Abuse of macros The use of macros in Clipper was a great gambiarra that brought several problems and was often abused, as is the case of the example shown. There’s no reason to do that other than…
-
5
votes4
answers3830
viewsA: Compare number within a numerical range
It’s much simpler than other options: private bool VerificaIntervalo(int numero) => numero >= 1 && numero <= 25; I put in the Github for future reference. Ideally the name of the…
-
16
votes1
answer1093
views -
6
votes2
answers388
viewsA: Will Websql really be discontinued?
Currently this technology is considered deprecated and should not be used. No one can say when and if a technology currently supported by any platform will be supported in the future. History…
-
23
votes1
answer25589
viewsA: When should I use __init__ in functions within classes?
You’re right. OOP is more complicated than it looks. Most people learn wrong and die doing wrong. I started apender in the 80’s and even today I have doubts if I’m doing it right. OOP poorly done…