Posts by Maniero • 444,682 points
6,921 posts
-
7
votes2
answers1131
viewsA: How does the (anti-)EAV (Entity Attribute Value) standard work?
Functioning It is very simple. Instead of having tables and columns, as is well known in the relational model, there is some table(s) with basically two columns, a key pair and value. In the key…
-
5
votes2
answers895
viewsA: Junit unit test for default system routines
Introducing Tests of any kind need to test something. This example is testing nothing. You can test whatever you want in the test, you can access database without problems. Of course it is not ideal…
-
13
votes2
answers2762
viewsA: What is the purpose of the void parameter in functions in the C language?
In this case are definitions of functions. It defines that the function can only be called with any argument being passed. Without the void can call with passage of arguments. Look no working in the…
-
11
votes2
answers2090
viewsA: What is the IL code and where can I find this code?
IL is the Intermediate Language, i.e., it is an intermediate language generated by compilers who intend to run on top of the CLR and conform to the CLI. This code is a kind of assembly language. The…
-
8
votes2
answers1287
viewsA: What is the purpose of a static constructor?
I will not go into too much detail because various pertinent information to the subject has already been answered in other questions. I’m guessing you understand the difference between static and…
-
7
votes1
answer201
viewsA: Why are you giving this Static variable error?
Because the method is static and the variable being used is instance. There is no relationship between them. Static members have as "owner" the class. There is only one throughout the application.…
-
2
votes2
answers2610
viewsA: Date and time validation
The code posted in the question does not make sense. In fact it does not compile, it has parts that is even C#. The question also doesn’t make it very clear what the expected outcome is, but I did…
-
4
votes2
answers169
viewsA: Recursive code C++
The two codes do not do the same thing. Where the variable went c? Moreover it closed before the time because the condition is reversed. int getNumPastasColididas(int i, int c) { return (i <…
-
9
votes1
answer191
viewsA: Is it correct for a method to make the same exception for two different reasons?
Question modified after answer Everything in engineering needs to be thought out for what you’re doing. For once the answer is a huge DEPENDS. The first thing is to ask yourself if it will really…
-
5
votes4
answers934
viewsA: How can I decrease program processing time?
You can simplify a lot, then the performance will possibly be better. The code is very confusing and there is a lot of unnecessary stuff. But you have to measure it to see if it got faster, there…
-
5
votes1
answer1595
viewsA: Is it right to create my HTML tags?
First of all, you need to know that you’re not creating tag HTML. HTML is just what was defined by W3C with this nomenclature. HTML is a default that does not allow customization. You are creating…
-
5
votes2
answers479
viewsA: Competition and memory sharing between Threads
Piovezan’s answer gives a great explanation of the problem he is having in the use of the method, so I will just supplement with the part I understood different in the question (which in passing is…
-
5
votes3
answers25273
viewsA: Table and column nomenclature
In nomenclatures there is no right or wrong. In thesis you can do as you wish. Anyone who says it’s right or wrong for this is being biased. Of course there are some recognized parameters that work…
-
6
votes1
answer147
views -
8
votes2
answers4700
viewsA: How to find out if a number is odd or even?
Use the mod operator. If the rest of the division by 2 is 0, then the number is even. Example: If li Mod 2 = 0 then 'faça o que quiser aqui If col Mod 2 = 0 then 'faça o que quiser aqui I put in the…
-
4
votes1
answer301
viewsA: Is there a difference between Java platforms?
The language is the same, what changes is the environment, the extra libraries (the basic ones are the same). Now, when you talk about mobile, maybe you’re talking about Android, so you have to be a…
-
4
votes1
answer620
viewsA: How to get the line number in PHP?
Pass the number of the current line as argument for the method (it has to have a parameter to receive this argument). Or use the debug_backtrace() to get all call information (slower). Class Example…
-
2
votes1
answer1283
viewsA: Create exclude function in C project
This code has several other errors, so I didn’t even try to test. That answers the question, but it doesn’t make the code work. It’s kind of like this here: void eliminar() { //o certo é receber o…
-
4
votes1
answer498
viewsA: Prime number algorithm only works for the first verified number
The counter startup is in the wrong place, every time you check a new number, the counter has to be reset. I took advantage and made an optimization not to waste time when he already knows that is…
-
13
votes3
answers2619
viewsA: Can subqueries decrease performance? Myth or truth?
Subqueries always cause performance problems, or this problem may occur depending on a specific context? "Always" is a very heavy expression, it depends a lot on the case. And then not only the code…
-
9
votes3
answers709
views -
5
votes4
answers14489
viewsA: Invert string in C
The biggest problem is that you are forgetting to withdraw 1 in the final position. #include <stdio.h> #include <string.h> int main(void) { char buffer[] = "Hello"; size_t size =…
-
4
votes1
answer115
viewsA: Problem with calculation result greater than Int64
The solution really is to use the BigInteger. I used it and it worked, but I did the whole process with it. If the data source was the double, immediately convert each part before performing…
-
3
votes1
answer266
viewsA: How to execute arbitrary code in Python?
I have great experience with Clipper, I worked in the world’s largest user of this language who had privileged access to the language provider and participated in the group of Harbour developers,…
-
5
votes2
answers2348
views -
2
votes2
answers135
viewsA: How to capture information from a 64-bit process that is running?
How about generating a 64-bit application and being happy like that? This is the most suitable solution. If you still want to continue on 32 bits and just don’t want the error to stop the…
-
13
votes1
answer337
viewsA: How to declare an integer type variable in C#?
Just declare the guy before her name: int x; //declarando sem inicializar. Será inicializado implicitamente com 0 var y = 1; //usando inferência de tipo. Só funciona em variáveis locais int z = 2;…
-
4
votes2
answers407
viewsA: Completion of mandatory fields
It would be something like that: else ((txtNome.Text == "") || (maskedCPF.Text == "") || (maskedCEP.Text == "") || (txtNum.Text == "") || ((maskedCelular.Text == "") && (txtTelefone.Text ==…
-
1
votes2
answers224
viewsA: How to recover a previous value typed by the user?
One solution could be this: import java.util.*; class Main { public static void main (String[] args) { var s = new Scanner(System.in); var notas = new ArrayList<Integer>();…
-
3
votes3
answers271
viewsA: Change read-only property in class itself
May determine that the setis private, so: public class MinhaClasse { public string PropriedadeDeMinhaClasse { get; private set; } private void UmMetodoPrivadoQualquer ( ) =>…
-
6
votes3
answers120
viewsA: What is the syntax of literal objects in Javascript?
This is how to define an object. The members of the object are on the left side of the :, members' values are on the right side. var variavel = { 'teste1':'1', 'teste2':'2', 'teste3':'3' };…
-
4
votes1
answer628
viewsA: Code for earlier than expected
The problem is on this line: name.push_back(NomesVetor); It is in the wrong place and is not adding anything since it only adds if it is a repeated name, which is not what you want and should not be…
-
15
votes2
answers7839
viewsA: What is the difference between View and Materialized View?
A good part of this question is already answered more fully in What are SQL views? What advantages and disadvantages to using? (has example of use there and advantages and disadvantages of use of…
-
4
votes2
answers4980
viewsA: How to determine the last element of a list in a foreach?
I wouldn’t go this way. As LINQ said this is a case where the for might be a better idea, so just compare the index with the Count() or Length from the list (possibly curly). It is possible to use…
-
17
votes3
answers1771
viewsA: What is the purpose of the magical __clone method?
Deep clone Because cloning, in general, involves copying the entire content of the object in a profound way (deep). That is, it also copies the referenced objects within that object. Eventually one…
-
1
votes1
answer418
viewsA: Function int(*Cmp)(void*,void*)
The question does not give many details, but this is the signature of a function that will be received by the function parameter dllInsertAfterSpec(). This is an anonymous function. That is, it is a…
-
2
votes2
answers4231
viewsA: How to assign HTML code to a Javascript variable?
We can say that we can’t do without doing enough gambiarra. var html = ' <div> \ <span>\'Algo aqui\'</span> \ </div> \ '; If it has simple quotes she has to escape. Otherwise…
-
15
votes4
answers1231
viewsA: Very interesting switch/case on Swift - What other languages support this?
All languages that allow Pattern matching :P You know the term now. I’m not sure I’m taking the risk that all functional languages support this mechanism. Some in one way, others in another, some…
-
6
votes3
answers441
viewsA: How to concatenate string with null without explicitly checking?
You shouldn’t try to concatenate a null with a text. I even think java should either prohibit concatenation in this case, or adopt a string empty when it finds a null (each has pros and cons). As it…
-
3
votes2
answers69
views -
4
votes2
answers1808
viewsA: Assign a value to the pointer and multiply (directly)
The variables b , c and d are pointer types, so there will be memory addresses there. You do not want to multiply the address, just want to do the operation with the value. The first operation is to…
-
2
votes1
answer343
viewsA: Undefined error Reference to `print`
The error seems to be here: case 2:{ varrer(); print("\n"); // <===================================== faltou um f no nome da função printf(" medias calculadas com sucesso! \n"); }…
-
8
votes4
answers281
viewsA: Is there a C# feature similar to PHP __call?
You’re looking for class DynamicObject and others of the namespace System.Dynamic, beyond the keyword itself dynamic which tells the compiler not to check for possible errors in access to members of…
-
3
votes1
answer264
viewsA: I need to register several products
A very basic way to add this functionality: #include<iostream> #include<vector> #include<string> using namespace std; class Produto { //esta é uma forma bem simplificada public:…
-
5
votes3
answers823
viewsA: Method that returns parent class to daughter class
In a general way Andrew’s answer works, after all if you’re sure you passed a Funcionario for the method then knows what to make a cast of the returned object to Funcionario will work. Without that…
-
4
votes2
answers3911
viewsA: What is the difference between data types Enum, struct and Union in C?
Although they have similar syntaxes their functions are very different, the union is a chameleon structure, and an enumeration has constant data. struct A structure has a set of members, that is,…
-
5
votes3
answers2371
viewsA: How to use one if inside the other?
You do not want to make one inside the other, although this would even work, but it is not ideal, the best is to make them in sequence: int main() { int a, b; cout << "Digite quantos Gol(s) o…
-
6
votes1
answer92
viewsA: How does one method work within another? E.g: service.metodo(arguments). execute();
There is no method inside the other, there is a sequence of methods. With the object servicecalls the method getImageKeywords() passing some arguments. It will produce a result (in general methods…
-
4
votes1
answer87
views -
4
votes1
answer291
viewsA: How to model in a correct way
As far as you can tell from the description, it’s correct. It is always possible to reduce the number of tables. A few days ago I saw a case of an entire system that fit in a table :D It can even be…