Posts by Maniero • 444,682 points
6,921 posts
-
8
votes2
answers2547
viewsA: How to get out of a cycle in C#?
Assuming the condition is correct and you do what you want, you just need the break to get out of the loop there: foreach (var dr in dgvValetes) { if (dr.Cells["valor"].ToString() == "1") break; } I…
-
1
votes1
answer29
viewsA: Vector sorting of character vectors with qsort <cstdlib>
Maybe it’s not the answer you want, but I’ll give you the best solution. You’re using C++, right? Then use C++. Don’t use C. If you didn’t know this difference, you’re learning it now. If someone…
-
25
votes3
answers866
viewsA: What are "Magic Numbers"?
Definition of the term In fact this is true for any language. Are numbers with no clear meaning, numbers that seem to have been taken out of the hat. Assuming that a variable is just a name for a…
encoding-styleanswered Maniero 444,682 -
3
votes3
answers24766
views -
2
votes2
answers254
viewsA: Difference between relational table and online record
Have you answered. Although you can also count or other search types if you do a column with her categories. Whether you compensate depends a lot on what you want to do. You can almost always do…
-
11
votes1
answer578
viewsA: Why does iteration of a list with an anonymous object work with an array but not with List<Object>?
You are creating a list of Object. Look at the documentation of this class. See if there are members Id and Nome there in the documentation. It doesn’t. Will it magically appear? It won’t, it’s…
-
4
votes4
answers5492
viewsA: Difference between two dates, ignoring weekend - working days only
/// <summary> /// Calculates number of business days, taking into account: /// - weekends (Saturdays and Sundays) /// - bank holidays in the middle of the week /// </summary> ///…
-
8
votes1
answer480
viewsA: In a C#console program, where is the main class set?
When there’s only one class with Main() throughout the project (where it will generate a Assembly (executable file) the compiler turns to find which one it is since there is no ambiguity. The class…
-
8
votes4
answers492
viewsA: In C# is it possible to use a local alias for class or namespace?
It is possible to use several types of aliases in C#. You can use a simple: using WF = System.Windows.Forms; //só fez o alias do namespace Use: var botao = new WF.Button(); This can be more useful…
-
4
votes2
answers78
views -
13
votes2
answers560
viewsA: Why shouldn’t I change the "getter" s and "Setter"s?
First, it seems to me that the example cited is not even a case of using a Setter as it is usually defined. A Setter is a method that receives a value that would normally already go in a field,…
-
15
votes6
answers2755
viewsA: Is it bad practice to use only static methods in a class?
I decided to answer because the current answers do not talk about PHP that is the question, and the accepted talks about variables and not methods, will understand the AP. Good practice First I…
-
3
votes1
answer656
viewsA: Redo autoincrement on Sqlite
The question doesn’t help much but I would try to do this in importing the data into the new table: INSERT INTO novatabela (word, definicao, classe_gramatical) SELECT word, definicao,…
-
2
votes1
answer419
viewsA: Variable declaration problem to compile in Code::Blocks
In Code Blocks go to: Project -> Build Options -> Compiler Settings -> Other Options there puts the -std=99 or std=c11, as the compiler himself instructed him. So just follow the…
-
1
votes1
answer346
viewsA: How to use a kind of gettext(). toString() from Java in HTML with Javascript?
You can do this. But there are several other ways, depending on what you want. function getText() { input = document.getElementById('campo') //pega o elemento console.log(input.value); //pega o…
-
7
votes2
answers4801
viewsA: How to use multiple languages in a single program?
C++, simply speaking, is a language that always generates binary executable code for a processor after passing through compiler. Assembly does the same after going through assembler. They may be…
-
4
votes2
answers1740
viewsA: Query methods, classes and attributes in the C language
C only have functions, constants, defined types, macros (which disappear before the language itself is processed) and global variables (although rare, because it is unadvisable). One way to find the…
-
5
votes1
answer2017
viewsA: How to store data in RAM and make it available to any module or class in my application?
It has some forms. Each one with its advantages and disadvantages. In all if the use allows competition will have to control simultaneous access worrying that it does not have a running condition,…
-
3
votes1
answer174
viewsA: Source is not recognized in PDF generation
Only the source name is missing, which can solve at least this problem in the code: var font = FontFactory.GetFont("Arial", 14, Font.Bold); var p = new Paragraph(aluno.Nome, font); I put in the…
-
6
votes1
answer382
viewsA: Size occupied on disk by a table in Sqlite
If you need to know the exact size while running your code, it is chipped. The only way I see it is to read the whole table and add up the real size occupied. And this can’t even be done directly.…
-
4
votes1
answer1367
viewsA: Convert MER (Entity Relationship Model) diagram to VB.NET or C#
How about use Visual Studio same? Even because it seems to have been done in it. I know that it generates for C#. I do not know about VB.NET, although I have how to convert. It seems to me that this…
-
4
votes1
answer58
viewsA: Exception in Thread "Main" java.land.Nullpointerexception com.Login.Login.mai(Login.java:18)
This error indicates that you are trying to access an object that has not been initialized. It will solve by initializing the vector. Apparently 4 positions are sufficient. Maybe up to 3 if you…
-
3
votes1
answer118
viewsA: A variable without assigning value accesses the variable value in another function
Understand how it works to function call and memory stack. This code works, but it’s wrong. It takes advantage of a behavior that cannot be guaranteed. By pure coincidence the variable str of show()…
-
6
votes2
answers109
viewsA: Store values in Hashtable
First, do not use this data structure, it is considered obsolete and should no longer be used by any application. Prefer Dictionary<K, V>. Once this is done the problem will not occur. If you…
-
3
votes1
answer335
viewsA: Postgresql many processes
In 9.2 I do not know any way. In 9.4 onwards you can limit the maximum number of active processes with the configuration directive max_worker_processes (documentation). This can obviously limit the…
-
5
votes2
answers1543
viewsA: How to select fields in a lambda expression query?
Understand that LINQ is a single language. There are two forms and syntax but in essence they perform the same. The most declarative syntax is syntactic sugar on top of existing methods. So what you…
-
2
votes2
answers356
viewsA: Merge two items of an Ilist into one item by Id
With LINQ you can do this: var junta = vendas.GroupBy(x => x.Id) .Select(x => new { Id = x.First().Id, Venda = x.Sum(v => v.Venda), Devolucao = x.Sum(v => v.Devolucao) }); Behold working…
-
13
votes2
answers458
viewsA: Is there a way to create cross Platform programs in C++?
No compiling for each platform is impossible. But there is practically no language more portable than C++. It is more than Java, contrary to what marketing says. The motto of Java is "write Once,…
-
10
votes2
answers551
viewsA: What is the point of an explicit C#interface implementation?
In fact, the recommended is the implicit one. There are cases where explicit is necessary. There are controversies whether this is a good thing or not. Some say it shouldn’t even exist in language…
-
25
votes1
answer1530
viewsA: Property Vs variables
Great to have asked. It’s never cool to go around using things without questioning. Even if you get it right it will be by coincidence. The two property usage codes (the ones at the end of the…
-
3
votes3
answers516
viewsA: Error in POSTGRESQL Database Creation
This syntax is not from Postgresql, it is from the SQL of another database. Begins with the AUTO_INCREMENT. The correct would be the use of SERIAL. There is error that I did not identify, may have…
-
3
votes1
answer254
viewsA: Javascript function with Nan error
Be careful with these books, especially if they have bad examples. The function itself had no problem, except for the fact of trying to execute something with an invalid argument. The problem was in…
-
4
votes1
answer102
views -
3
votes1
answer977
viewsA: Error writing file stream
That one stream is only available for reading even, you cannot try to save it. The error explicitly says this. If you want to touch the metadata of Assembly is even possible, but it takes care and…
-
4
votes3
answers216
viewsA: What are the advantages of working with Fluent Interface with LINQ?
This query can be written in a simpler way using the the most imperative form known to syntax method, as opposed to query syntax. var consulta = lista.OrderBy(e => e.Nome); Behold functioning in…
-
12
votes1
answer208
viewsA: Is there any error suppression mechanism in C# similar to the PHP arroba?
There is, it’s the #pragma warning. Some considerations must be made. This only exists at build time since this is a build directive. Nothing will change in code execution. C# has the philosophy of…
-
1
votes1
answer273
viewsA: Error (T_variable) in php, how to resolve?
Putting the ; in the previous line. All lines should end like this so as not to affect the others, arrange this: $banco = "cadastrocli"; Although nothing will happen now, it is appropriate to do the…
-
4
votes1
answer740
viewsA: id returned 1 Exit status in C
The reason for the error is the use of scanf() incompatible with the type of data, in this case the unsigned int. Only use unmarked types if you really need to know the implications of this. A…
-
5
votes3
answers413
viewsA: How to replace dynamic chunk {{chunk}} of a string in C#?
If you can make it simple basically it’s using the method Replace() existing in .NET. If you need more sophistication, you would have to develop your own algorithm. var texto = "Texto dinâmico…
-
11
votes3
answers2952
viewsA: What is the concept of GTK? Is it recommended to use it?
This should be one more comment, but it would be too long. And deep down it answers the question, which is probably opinionated (I don’t know if it should be open). But at least I answered about the…
-
4
votes1
answer70
viewsA: Problem running eventhandler
First problem: don’t use HashTable, this class is obsolete and problematic. Prefer Dictionary<string, string>, or who knows Dictionary<string, int>. Are you sure you need this? It looks…
-
5
votes2
answers137
viewsA: Development in three layers
The term "3-layer development" is too generic to define anything. Even if he did define it would be just a rule to be followed without looking at the context of what he is actually doing. Rule…
-
2
votes1
answer90
viewsA: What’s the use of that line?
It is unlikely that the nocache is necessary at some point in this script, but only seeing what is inside him to say what. Apparently it was put (as its name already says) to the browser not cache…
-
4
votes1
answer142
viewsA: Nullreferenceexception when calling function
If this is a "formal" test you cannot access what you want. In fact in a test you should do the minimum necessary. Often it’s just the line of Assert even. This test doesn’t seem to make sense.…
-
4
votes2
answers112
viewsA: Help in Nullpointer Exception
I don’t know if it’s enough but something can fix it is to change this line: private HabilidadeDAO dao = new HabilidadeDAO(); I put in the Github for future reference. To help more would need more…
-
32
votes5
answers1775
viewsA: Why is it bad practice to have int attributes?
Good practice I’ll tell you what’s more important on this subject: they invented a plague on the developers' minds called "good practice". The world of development will be much better when people…
-
1
votes1
answer269
viewsA: Add sub property dynamically
Make like a array Associative is really a solution, even because an object does not cease to be one. I agree it’s a beautiful gambit and should be avoided unless it really makes sense. So just…
-
7
votes1
answer576
viewsA: In an MVC project, where should I leave the enums?
Without knowing the exact problem, you can’t answer it. It is absurd for anyone to say where to put something without knowing the specific need. This is because of the cake recipe culture that has…
-
2
votes1
answer193
viewsA: Problem with dynamic allocation
The main problem is that the relocation is using the same size always, is not increasing and is not assigning to a variable, this relocation is lost, this generates the error. There are better ways…
-
3
votes2
answers2126
viewsA: Access a function’s variable/parameter within another function
After the issue of the question that Bacco asked was that I realized that I had misunderstood. I went to the title and did not see that one function is inside the other, because the indentation is…