Posts by Maniero • 444,682 points
6,921 posts
-
19
votes3
answers5035
viewsA: When to use Sqlite?
Before you start using a tool you should study it deeply. And after studying it you will have information to decide on your own whether it is viable for your case or not. Don’t trust random people…
-
8
votes3
answers178
viewsA: How to capture a Nullreferenceexception?
This is a programming error so you should not capture any exception. To do this would be to try to throw the dirt under the mat. This error is not normal, it is the symptom that there is something…
-
8
votes2
answers781
viewsA: What functions are form tags in HTML5?
In fact it is possible to use div instead of these tags, but they give better semantics to what you’re doing. This is good to document your project better from a development point of view and also…
-
2
votes1
answer99
viewsA: Transform class with static methods into interface
The first thing you’d have to do is stop using static elements in this class. It makes no sense to use an interface in an essentially static class. I find it strange to have a database update method…
-
8
votes2
answers331
viewsA: How to implement a "slim" controller
I imagine you’ll have a hard time doing anything that can be called "thin" when you talk in so many layers. Lasagna does not go with thinness :). Take away the business rule from the controller It’s…
-
1
votes2
answers282
viewsA: I can’t divide with a vector element
I don’t know what the goal is but this is basic math. The code is running when NUM is 0 and this operation is not possible according to the mathematical rule. Probably shouldn’t wear one array For…
-
5
votes5
answers156
viewsA: Type induction for any type of object
PHP is a dynamic language. Its normal is to accept any type, so just do not specify any type that will be accepted: class Produto{} class Usuario {} class classeExemplo { public function…
-
5
votes4
answers750
viewsA: How to limit the resources used by the system?
The first task you should do is to think about whether you have a better way to do this, I doubt you need such a heavy algorithm, or it’s not that heavy. Without a full context it is not helpful and…
-
4
votes2
answers185
viewsA: How to pass an array as argument with the user defining the column number?
Decide whether to use C or C++. In C you can do this in most compilers: void recebeValor(int size, int mat[][size]) { mat[0][0] = 2; } int main() { int lin = 3; int col = 3; int mat[lin][col];…
-
19
votes1
answer1007
viewsA: What programming languages support Linux and Windows?
Essentially all. In fact it is an exception to have languages that run only in one of them and not in the other, in general few known languages. The biggest exception might be Delphi. Even so it is…
-
8
votes3
answers2045
viewsA: Inserting record and recovering ID generated by SQL Server 2012
Will change the query to (the OUTPUT is in the middle): cmd.CommandText = "INSERT INTO Venda(ID_Pessoa, ID_Caixa, ID_PDV, ID_Deposito, Data, Itens, Valor, Desconto, Valor_Final, Cancelada,…
-
5
votes1
answer155
viewsA: Port Visual Code C++ to another language
The question is not very clear and maybe a little broad, but what you’re trying to do doesn’t make much sense. You can get rid of Visual Studio but cannot get rid of Windows which is a closed and…
-
16
votes2
answers1239
viewsA: What is the difference between *var++ and *var += 1?
This occurs because of the precedence of operators. The += has low precedence, so the pointing operator occurs first, then it increments the pointed value. The ++ has higher precedence, so first it…
-
35
votes5
answers7637
viewsA: Is Excel a programming language?
What defines what a programming language is? You will find several settings. In Wikipedia: A programming language is a standardized method for communicating instructions to a computer.1 It is a set…
-
15
votes1
answer10939
viewsA: What is parse, and how the parse of DOM works in HTML5
Parsing The parser is a parser. Its function is to read an input of data that has certain specific rules - in general it is a text recognizable by humans - and assemble a structure of what its…
-
4
votes3
answers66
viewsA: Class attribute does not generate error when commented
I don’t think anyone can explain why designers of the language have chosen to do this in addition to themselves, but I know that they have resolved that if you refer to a member that does not exist…
-
10
votes4
answers1876
viewsA: What is the sense of an attribute being private and Static at the same time in a class?
It is not because its definition is wrong. The understanding of what the private does is correct. But the static does not say that it is visible to other classes, it says that the member belongs to…
-
5
votes1
answer248
viewsA: What is the most appropriate way to store a reference in an object?
Do you want to learn the right way or the right way? I’m going for the right. So I modernized your code using C++11/14. Do not mix C with C++. And if you’re going to use C++, use the most modern…
-
2
votes2
answers423
viewsA: How to manipulate instance properties of a class that is in a List<T>?
You have to create a new object of this class and add it to the list: listaPessoa.Add(new Pessoa("João", 18)); Complete: using static System.Console; using System.Collections.Generic; namespace…
-
4
votes2
answers253
viewsA: How to work with a Datetime instance without the time information
It’s even possible to have a guy with just the date, but it’s not necessary, just have the time reset. This can be built manually or if you’re going to pick it up from somewhere outside, you have to…
-
5
votes3
answers972
views -
5
votes2
answers460
viewsA: What is Closure Object and how do I get the anonymous function return as parameter?
Just call this variable as a function: $classe->exemplo['parametro2'](); Behold working in the ideone. And in the repl it.. Also put on the Github for future reference. I just switched to public…
-
1
votes1
answer63
viewsA: Error when compiling: "attribute not allowed"
The problem is that you are using the C++/CLI compiler, which is a managed language that uses .NET. This is not the C++ language you expect, it’s another one. You need to configure Visual Studio to…
-
10
votes1
answer195
viewsA: Application of more than one Pattern design
You probably haven’t studied enough about it and are still clinging to the rules you artificially created about it. You already use design standards all the time, even without realizing it. Forget…
-
7
votes1
answer902
viewsA: How to use Javascript to manipulate data from a database?
I believe you are putting the car before the horse. You do not choose the technology you will use and then see what problem you will solve. That’s why you made the initial statement that it makes no…
-
5
votes1
answer71
viewsA: Why can’t I display Messageboxbuttons if it’s not a string?
Because this syntax does not exist. There is only one method that accepts MessageBoxButtons if there are 2 parameters string before (the second is caption): result = MessageBox.Show(texto,…
-
14
votes2
answers241
viewsA: What is the purpose of the => operator in the use of lists?
None. This is used to create a lambda, which is an anonymous function. This can be used in any situation where an anonymous function/method is expected. It is not related to the list. i =>…
-
9
votes2
answers1768
viewsA: What is and what is php.ini for?
It is a settings file. It has directives on how PHP should behave regarding memory usage, paths, installed modules and its own settings, which parts of PHP can be used and how they will be, various…
-
14
votes3
answers8338
viewsA: What does %=mean?
It is the compound operator of assignment and calculation of the module (getting the rest of the division). Essentially it is the same as saying: id = id % 1000 This is splitting up id by 1000, and…
-
2
votes1
answer85
views -
4
votes2
answers4252
viewsA: Error: Undefined object reference for an object instance, how to resolve?
I don’t know if I’ll help you because these error messages in Portuguese get in the way and information is missing that might indicate why the error. I’ll guess you don’t want the FieldCount after…
-
6
votes8
answers1094
viewsA: Is it recommended to use constants for configuring a PHP project?
I don’t think this can be considered God Object, doesn’t seem to me even an object, maybe I wanted to talk about something else. This is not the best practice but it is much practiced without…
-
3
votes3
answers1491
viewsA: How to round Double values?
There’s no way to have control over the decimal places in a number like double, this is characteristic of it. If you need this, you need to use another data type. In this case it would be the…
-
4
votes1
answer49
viewsA: Is it possible to enable light Bulbs in Visual Studio?
Directly by VS not because it is a new feature. You can have similar effect and even with more options using the Resharper. Obviously this is not the only extension and you can also develop an…
visual-studioanswered Maniero 444,682 -
16
votes3
answers481
viewsA: Difference between location and internationalization
The terms have no canonical definitions and are used in different ways by different sources. Internationalization Also known as globalization is the addition of ability to software to do…
-
19
votes7
answers811
viewsA: How to write variables in PHP?
You have to ask him. Maybe try to look at the context. I, for example, don’t usually do either of the two things (okay, some cases I do). Most do as in the second example because they learned to do…
-
2
votes3
answers527
viewsA: Precedence of operators
Because there is also the associativity that is left to right. It does not analyze all operators and chooses which one will run first. He does this with the operands, usually in pairs, from left to…
-
13
votes3
answers228
viewsA: I need an explanation about what a code I don’t understand does
It increments the variable $i divide by 2 and take the rest. If the rest is 1 - if it is odd - it uses the string 'class="colored"', otherwise uses a string empty. In this case he is assigning the…
-
2
votes1
answer119
viewsA: Pointer use
I’ve said a few times that organizing the code helps you understand what’s going on. Besides being difficult to understand, meaningless names make it difficult to know where you want to go. Also,…
-
7
votes2
answers525
viewsA: When is it recommended that a class implement Idisposable?
You can implement, of course. You can do whatever you want. There is processing cost. Whether it will be a problem or not, it is necessary to evaluate. The best way is not to implement. After all it…
-
7
votes2
answers5645
viewsA: Remove special characters and spaces from a string?
Someone will give a solution with Regex, but I prefer so, using extension method: var texto = "(99) 9999-9999"; foreach (var chr in new string[] {"(", ")", "-", " " }) { texo = texto.Replace(chr,…
-
10
votes1
answer206
viewsA: Why do Dbms use their own paging when the operating system already has one?
Because the goals are different. The operating system creates pages of bytes, the database creates pages of data with specific purpose. He knows better what is in there, his pages have a specific…
-
4
votes1
answer2296
views -
5
votes2
answers191
views -
16
votes2
answers8942
viewsA: How to verify if a variable is float, decimal or integer in Javascript?
According to the MDN documentation there are few types. The numeric type makes no distinction whether it is integer, decimal or has binary decimal point. So there is no way to obtain this…
-
7
votes1
answer141
viewsA: Is there a pattern similar to Singleton?
I will not answer anything from the beginning that is not very relevant because it would take a lot of time and deep down you will not want the solution I have, but it is all wrong. It’s not a…
-
4
votes1
answer448
viewsA: Application of the Singleton standard for small/large design
OOP You chose to use PHP because you are probably making an application that is not very complex. Dynamic languages are not very suitable for complex applications, Low-grade gets worse. OOP is also…
-
13
votes3
answers753
viewsA: Does Java have a class to work with command line arguments?
One of the most well-known libraries that does this is Commons.CLI. With it it is possible to treat arguments as the AP wishes. With it it establishes what options are possible, the format and then…
-
1
votes1
answer152
views -
10
votes5
answers267
viewsA: Store arithmetic operator in variable
There are several ways to do this, but the best is not to invent, is to do the obvious using a comparison. Example: $operator = "+"; $value1 = 10; switch ($operator) { case "+": $value2 = $value1 +…