Posts by Maniero • 444,682 points
6,921 posts
-
11
votes1
answer1740
viewsA: What are the differences between the concepts of polymorphism and superscript in OOP?
They are related things. The superscript is used to achieve polymorphism. It is not the only mechanism but it is the most used in most languages mainstream. Polymorphism is the characteristic that…
-
5
votes2
answers84
viewsA: Return the path value
Use the Path.GetFileName(). var nomeArquivo = Path.GetFileName(path); Try this: var arquivos = Directory.EnumerateFiles("%PROGRAMFILES% (x86)\MyApp", "*",…
-
4
votes2
answers156
viewsA: Error: Cannot find data type long
The guy long does not exist in SQL Server. Use bigint in place, it’s the same thing.…
-
16
votes3
answers637
viewsA: Is it correct to state which interface solves the multiple inheritance problem in Java?
The question posed in this way is somewhat controversial. The multiple inheritance itself is already controversial, since some people say that it is not even necessary in fact, that things cannot…
-
3
votes2
answers128
viewsA: Use of conditions in matrices
#include <stdio.h> int main() { int valores[4][4]; int i, j, soma; for(i = 0; i < 4; i++) { for(j = 0; j < 4; j++){ printf("Informe os valores de [%d, %d]:\n", i + 1, j + 1); scanf("%d",…
-
9
votes1
answer5003
viewsA: Is it correct to create a constructor method in an abstract class?
It’s correct, of course. Unless the builder is not necessary. And it isn’t always. Many programmers create constructor without need. Others stop creating when "it’s required" to have. But if the…
-
2
votes2
answers100
viewsA: I define a value in a class, when I instate the same value is another
You declared the class member Animal as bool and as he put no value on it, the value default of this kind is false. Then there’s nothing wrong. Certainly your intention was not this. And you think…
-
2
votes1
answer1459
viewsA: How to force the maximum table width?
There is, of course, if you want to go straight to HTML: <table class = "tabela" style = "max-width:100px;"> <tr> <td>teste de tamanho máximo da largura de uma tabela </td>…
-
3
votes1
answer673
viewsA: Range of dates VARCHAR/DATE
I think the best way is to do the conversion. I would have to create a new column like DATE and make a UPDATE to record in this column the date taking from the old column that is still as VARCHAR.…
-
2
votes1
answer2946
viewsA: "Uncompiled source file" error
You are mixing C with C++. The first thing to do is to decide whether to program in one language or the other. Since it looks like C++, I’ll try to get it right for her: #include <iostream>…
-
11
votes1
answer716
viewsA: Should I extend from an abstract class or a concrete one?
There is no better option, you extend the class you need to extend. Whether it is abstract or not, it makes no difference to its code other than the fact that an abstract will possibly have methods…
-
3
votes2
answers376
views -
10
votes4
answers570
viewsA: Extend x Superscript, what’s the difference?
Extend (extend) is a class concept and broader. You extend a class by probably putting new members (not just attributes) into it or doing something else in existing methods. Whenever we create a…
-
6
votes2
answers422
viewsA: Create dynamic news site optimized for Google
Where did you get the information that this is not good practice? There is no problem in doing this. All sites do, the search engine accesses the page as if it were a browser. How page generation…
-
1
votes3
answers1132
viewsA: Problem with vector in C
It seems to me that the problem lies more in the understanding of the problem than in the programming. I saw no error in the program but in what is intended to be done. Anyway, have you chosen one…
-
8
votes1
answer497
viewsA: What is DNX really?
This is no longer valid with the implementation of CLI - Command Line Interface Gradually all the technology that emerged from the opening of the code . NET and more modular architecture is…
-
3
votes1
answer79
viewsA: How to organize arrays
No, it’s the same thing. There’s no more organized than this unless there’s some specific situation that helps. You can skip a line to separate blocks that make sense, or you can reevaluate if you…
-
4
votes2
answers468
viewsA: Checkbook batch sum, total value and validation
It has several errors and is incomplete: #include <stdio.h> #include <stdlib.h> #include <locale.h> int main() { setlocale(LC_ALL, "Portuguese"); int qtde, aux; float valorCheque,…
-
7
votes2
answers1630
viewsA: Modeling of a database
The answer was invalidated by the edition of the question, but it stays here who wants to see on top of the original. It is always difficult without knowing the real requirements. What can be right…
-
3
votes1
answer329
viewsA: How to write bit information to SQL Server database?
Do this: Parameters.Add(New SqlParameter("@Ativo", SqlDbType.bit)).Value = Convert.ToInt32(chbAtivo.Checked) I put in the Github for future reference. The property is a booliano, has a true or…
-
5
votes3
answers197
viewsA: What is the function of this 'and' that is passed as a parameter?
This is a parameter. An argument will be passed for him. I imagine that even not knowing the correct terminology, know what serves a parameter. In this case the e will receive arguments sent by the…
-
7
votes3
answers467
viewsA: What is the best method for exceptions?
There is no better "method" to capture exceptions, there is only one way: try { //faz coisas aqui } catch (SpecificException ex) { //faz algo para se recuperar da falha ou indicar o erro em log ou…
-
3
votes1
answer270
viewsA: Cardinality in class diagram
It is always very difficult to talk about generic and abstract cases like this. The concrete case may be different. As far as I understand there’s no need for the doctor to have patients. So it…
-
9
votes2
answers860
viewsA: What are the Exceptions?
I agree with what you have in this answer by Eduardo Binotto. It is a mechanism that signals an exceptional event. Achoachava that everyone agrees with this. But there are some people that I think…
-
5
votes2
answers884
viewsA: What to write in an Exception Class (Exception)?
Most of the time you will create exceptions just like that. At first it seems weird, but think about the semantics you want to pass. It’s no different than you saying there was a Exception and a…
-
3
votes2
answers49
viewsA: Make a new framework based on another open source with GPL license
If there is total separation, if the code of the one that will "market" (even if it is not money at all) does not contain anything that is in GPL, nothing at all, then there is no problem. You can…
-
2
votes2
answers805
viewsA: Is it correct to use JSON to store data that does not need to be in a database?
It is hard to say without seeing the concrete case, abstractly there is nothing wrong, even today all modern application configuration files use this format. Used to be the famous format ini, or…
-
5
votes3
answers847
viewsA: Factorial is not being calculated
Solution without using recursion (which is pragmatically not the solution for everything) since you should not understand what this is yet: #include <stdio.h> int main(void) { int matriza[5],…
-
19
votes4
answers3187
viewsA: Should one use break in going?
I don’t know if he’s speaking any specific language. I’m going to speak in general terms. Some people are dogmatic. This option even makes sense. Semantically the for would indicate that you want to…
-
6
votes1
answer823
viewsA: What is the Null Object standard for?
It is an object created to simulate another object with the same contracts, but without any functionality. No state and no real behavior. The two types are compatible with each other since they meet…
-
7
votes1
answer299
viewsA: Prepared statements with Mysqli does not require validation of data entry?
Hazards Risks are everywhere. For example, the code shown is assigning 'sim' for $campo. And having something printed that will never be printed out. It may seem silly to observe, but failures occur…
-
36
votes2
answers1659
viewsA: Meaning of terminology: "Object oriented"
Alert: I’m going to make some simplifications and I’m not going to follow the strictly academic definition, let alone a universal definition - if there is a. I will talk about what every programmer…
-
3
votes3
answers339
viewsA: Connection to the bank is open in static method?
I would question whether it really needs that the class needs to be static. Often we think it needs but in reality it doesn’t. But I’m not saying that this is a problem in itself. I don’t really…
-
5
votes2
answers10665
viewsA: How to get time difference between two Datetime variables in C#
It’s quite simple: using System; using static System.Console; public class Program { public static void Main() { var data1 = DateTime.Now; var data2 = new DateTime(2015, 9, 23);…
-
4
votes2
answers987
viewsA: How do I count the number of files in a folder with PHP?
Use the function glob() to get the files: $arquivos = glob('/*.*'); //diretorio e padrão de arquivos que deve pegar if (!$arquivos) echo count($arquivos); else echo 'houve um erro'; Behold working…
-
5
votes4
answers630
viewsA: How do I use the F2 key to open another form?
Really have to check the key code and not ASCII table: private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyCode == Keys.F2) { //sua rotina aqui OPERACOES OP = new OPERACOES();…
-
2
votes1
answer190
viewsA: Git repository replication on local machine and Github
Git has a decentralized feature just to be able to do this kind of organization. You can establish a flow where everyone on the team uses the local server to centralize changes in the repository.…
-
3
votes4
answers2109
viewsA: "Filter" equal records into a list by adding their quantitative
I made it in three different ways to choose the one that suits you best: using System.Collections.Generic; using System.Linq; using static System.Console; namespace ConsoleApplication10 { public…
-
3
votes1
answer156
viewsA: How to get Timezone?
I would do this: using System; using static System.Console; public class Program { public static void Main() { var minhaData = DateTime.UtcNow; WriteLine($"Hora universal…
-
5
votes3
answers115
viewsA: Is there any way to generalize library imports into Java?
Yeah, you can do that: import Banco.* This form imports all existing classes in the same package. Documentation.…
-
8
votes1
answer702
viewsA: Use a void function as a parameter of another
If I understand what you want, you need to declare the parameter as a pointer to a function. So: #include <stdio.h> void comeco_fim(void (*func1)(void), void (*func2)(void)) {…
-
3
votes3
answers1025
viewsA: problem in C with rest of the division
Just missed you make the split by 2 to know if it’s even or not. You can’t stop the math expression in between. #include <stdio.h> int main(void) { int matriza[10]; int matrizB[10]; int…
-
12
votes3
answers21968
viewsA: What is the purpose of the Serializable interface?
It gives the class the ability to produce a format in which the object data is used externally to the code, in general it is persisted in some form of temporary or permanent storage or is…
-
9
votes3
answers18598
viewsA: How to find the rest of the division?
In math, you can only find the rest when you think of whole numbers, so the guy can’t be float. #include <stdio.h> int main(void) { int num1, num2, resto; printf("\n digite um valor: ");…
-
4
votes1
answer110
viewsA: Model comments
It seems to be all right according to the information provided. Of course the rules of what you can or cannot do, how to present (including links), will be determined by code (even if inside the…
-
6
votes5
answers2441
viewsA: How to concatenate String within a repeat loop?
I made the first form following the example put in the original question, repeating the value. I doubted it was this, but I answered it anyway. There are simpler ways to do this. The second is the…
-
6
votes3
answers261
viewsA: What is the advantage of using the Set<> method?
In this specific case there really is no advantage. Use the second way. This method was created for situation where you don’t know what kind of data you are working with, i.e., when writing generic…
-
18
votes6
answers22962
viewsA: How to calculate percentage?
This is basic math. To calculate percentage is divided by 100 and multiplied by the desired percentage. $total = 4000; $pctm = 30.00; $valor_descontado = $total - ($total / 100 * $pctm); //os…
-
14
votes3
answers437
viewsA: Database should follow the OO standard?
In a general way you nay shall apply object orientation rules to a relational database. CPF But to tell the truth I found the example of the CPF a little strange, unless it was exactly to show a…
-
25
votes2
answers3688
viewsA: What are the advantages and disadvantages of minifying Javascript scripts?
Upside The gain is quite obvious, the file gets smaller and loads faster. Some will say it gets harder to read the code and be repurposed, but I don’t think this is a real advantage and there are…