Posts by Maniero • 444,682 points
6,921 posts
-
1
votes2
answers58
viewsA: Organization for future code maintenance when I have two similar functions
What you must do only you can decide. I always prefer the simple, without being simple. It is not always easy to say what is simple. And you have to look at other things, in some cases it’s best to…
-
1
votes1
answer302
viewsA: What is the SQL Server compatible command for Mysql SHOW CREATE TABLE?
There’s no way, you can get the information you want in other ways, for example sp_help customers Or exec sp_columns customers I put in the Github for future reference. Or you can get something…
-
3
votes2
answers86
viewsA: How does ORDER BY draw columns in case of a repeated value?
Since he didn’t use a tie-breaker he’ll look for the easiest way possible for that query, which may even vary depending on a number of criteria, ie if you want a specific or repeated order then be…
-
12
votes2
answers5589
viewsA: Why should we use PHP_EOL?
It is not what you should use, you use if you want and need. First, you will only use it if you want to jump a line in the generated text. Is that what you want there? You know why you’re gonna jump…
-
2
votes1
answer57
viewsA: How to set a Returnpath in SMTP email sending
You should add a header correct in the message, something like that: mail.Headers.Add("Return-Path", "[email protected]"); I put in the Github for future reference. The Sender That’s not it, actually…
-
4
votes2
answers113
viewsA: Is there any difference between the two ways of making an exception?
There is no bigger context but for me it is a mistake to do both. If you have a mistake and can check it then do it right there. Do not use try-catch unless it is necessary. Launch a Error almost…
-
3
votes1
answer143
viewsA: Error: a property or an indexer that cannot be passed as an out or ref parameter
The mistake is exactly what is written, you can’t do what you did. The solution is to create a normal variable and then assign its value to the property you want. A variable passed by out can only…
-
11
votes3
answers731
viewsA: What is the advantage of using getters/setters in Javascript classes?
General advantages The advantage is more or less the same as the use in other languages from the conceptual point of view, since it is necessary to do something relevant there, which does not have…
-
2
votes1
answer66
viewsA: Follow the OCP principle or use "instanceof"
Has some solutions. One of them is to violate the OCP. Who said that it is inviolable? There is a reason for it to exist, but it is not to follow it at any cost. This is usually the simplest…
-
4
votes1
answer82
viewsA: What are the differences in backend and frontend?
There is no such relationship that you think you have, that is language mechanism to work with asynchronous execution, it knows nothing where it is running this, if it is back or front end. Contrary…
-
2
votes1
answer195
views -
6
votes1
answer816
viewsA: Printing an array with all elements on the same line
You are using an inadequate resource. One of the things that few people understand is that there is the data and there is the textual representation of the data. JS, like other languages, have a…
-
2
votes2
answers99
viewsA: Why can’t I print according to the state?
There are some gross errors in the code, it seems random things, when it solves this compiles and works (I think, I don’t know what I should do). There’s a lot of stuff out there or that doesn’t do…
-
6
votes2
answers107
viewsA: How does a function know how to take the elements of an array if they are not being passed to the function?
The implementation of forEach() that’s how. Internally she calls a function that she doesn’t yet know what it is, but she knows which contract that function should have, i.e., she knows what that…
-
10
votes2
answers285
viewsA: To what extent does hardware affect programming?
Most of the time we are writing several lines of code that will be converted into machine language and thus give life to what we write This happens with some programming languages, not all. nowadays…
-
3
votes1
answer289
viewsA: Chr$ equivalent function in C#
Just make a cast of the number to char, something like that: (char)27 But I should probably do something different, the semantics of the language changes so it’s not usually just translating an…
-
6
votes1
answer110
viewsA: How do computers store and interpret floating point numbers in binary?
It doesn’t really exist and it doesn’t make much sense. What one does is separate the whole and decimal parts with a comma, but in the computer this is not how these numbers are represented. Binary…
-
2
votes1
answer127
viewsA: Error when adding side-by-side objects in an array
The mistake is that the method add() only accepts one argument and you are trying to use several. This is the error, so using one will work. I know it’s not what you want, but it’s what you can…
-
2
votes1
answer549
viewsA: CS7036 error on C# calling a function
If you pay close attention to the error message already has clear what the problem is, just missing the solution. And someone naive could say that he has to call the method by passing two arguments…
-
1
votes2
answers85
viewsA: Performance between creating multiple objects or just one
It depends on a number of questions, can not answer without knowing the implementation details of each thing. In fact it is likely that the second is more performative because it not only does not…
-
16
votes3
answers296
viewsA: What are God Objects?
God Object is not far beyond what is said there. These objects are able to do many things, they do not follow the principle of single responsibility. Often the person creates them without realizing…
-
1
votes2
answers638
viewsA: presentation of fractions in javascript
If I understood correctly it would be something like this: for (let numerador = 480, denominador = 10; denominador < 41; numerador -= 5, denominador++) { console.log((denominador % 2 == 0 ? "+" :…
javascriptanswered Maniero 444,682 -
6
votes2
answers214
viewsA: Why does the value always return 0?
There’s no such thing as what you’re thinking of doing. The guy char or even unsigned char have 1 byte and therefore can only represent 256 different values, but nothing prevents using values other…
-
5
votes1
answer210
viewsA: Make a parameter change the value of the variable with pointer
I imagine you are talking about pointer or reference, that is, you want to be able to change the variable within the function and the value is reflected in the original variable used as argument of…
-
7
votes3
answers253
viewsA: Cannot implicitly convert "decimal" type to "int" in C#function code
It’s the same problem as previous question but now the solution is different. The return type of the method has to match what is being returning, so if the method really has to return int return int…
-
4
votes2
answers1559
viewsA: CS0029 Error - Cannot implicitly convert "int" to "bool" as a function of C#
The error is exactly what it is showing, you are trying to return a number where one expects a boolean. And looking at the code doesn’t make any sense even to make that return. It would be…
-
4
votes1
answer106
viewsA: What can be done to improve this code?
It is very complicated to talk about good practices, you have a lot of opinion about it. Nor can you talk much without knowing the requirements, the concrete case. There is no good practice in an…
-
1
votes3
answers99
viewsA: Return method asks return that has already been given
And if you don’t even get on for? This mechanism will only be executed if there is an element in the collection, if the data collection is empty or enters the loop, then it goes to the end of the…
-
1
votes1
answer1402
viewsA: Manipulating class within another class and saving in array
First let’s agree that what you call an attribute is actually called a field. You have to create an object Endereco in your code and then pass that object to the object Pessoa, nor would you need to…
-
15
votes2
answers142
viewsA: What does byte* mean?
byte it doesn’t have much secret is a data type that has 1 byte and the possible values of it go from 0 to 255, it is as if it were a int, only has a smaller representation capacity of different…
-
1
votes1
answer66
viewsA: How to change the value of an entire argument passed as a reference in Julia
I’m not an expert on Julia but for what I researched it has no way to do this and should not do it, even this code does not make sense, if you want to generate a result give a return and if you want…
-
1
votes1
answer909
viewsA: Error returns Uncaught Typeerror: Cannot read Property 'substring' of null by clicking the button
First you are wanting to get an HTML field then you have to use your name, in case you want the field "cpf" and not the variable cpf as field name, missing quotes there. I do not know how much is…
-
2
votes2
answers658
viewsA: What is a Python hash map?
It’s just another name for one dictionary that Python already has so you just map the letters as keys to that dictionary. Why should I use this I don’t know, have to ask who sent it because it’s a…
-
5
votes1
answer70
viewsA: Does the char vector have a minimum size?
You have fallen into an error that almost all programmers fall and most will continue to fall even knowing this because there is too much stubbornness. Now you can learn the correct way to learn…
-
5
votes4
answers89
viewsA: Repetition is not equivalent to one second
There is no way to make this prediction even because each computer will take a completely different time, worsens the fact that there is IO in the operation. You can put the process to sleep for a…
-
4
votes1
answer371
viewsA: Protection of sensitive data in your database
The only way to do this is by using the original database encryption. Even so, the entire infrastructure is expected to be well protected because if there is an invasion in lower layers it will open…
-
2
votes5
answers2164
viewsA: Square root manually in Javascript
This code is too complex and confusing and this gives room to create several errors. Your algorithm doesn’t compute the square root of any number, but I imagine you only want the ones that can be…
-
0
votes1
answer118
viewsA: Relationship between different file tables
It is possible yes, but not recommended because it loses transaction capacity and competition, so if you think it will improve the competition is doing the opposite. Note that I talked about…
-
4
votes1
answer74
viewsA: How does CPU cache performance work?
For the programmer this matters little, even more if not using languages that allows very large control of memory, even these can not make use of cache directly, it is the processor’s prerogative to…
-
3
votes1
answer77
viewsA: Were the Wrapper classes depreciated in Java?
The class did not happen, nor would it make sense, almost all codes that do no trivial things use these classes. But some methods of these classes are now considered obsolete and should use another…
-
2
votes1
answer83
viewsA: Numerical comparator
This code has a huge amount of errors. Some cases are not quite errors but it leaves the code not so readable or it is not common to write so: I have no idea what those variables are sim andnão, I…
-
3
votes1
answer110
viewsA: What are the benefits of peer programming?
The summary of the benefit is usually: Two heads think better than one. In complicated problems there can be advantage, especially if used punctually. People don’t get stuck too much in something,…
methodologyanswered Maniero 444,682 -
2
votes1
answer60
viewsA: Correctly print a double value using Tostring()
If you want a monetary value you use a decimal and not a double. If you want in the current culture you have no reason to specify this. using static System.Console; namespace AtividadeRepeticao {…
-
20
votes5
answers1841
viewsA: Why are there so many programming languages?
One of the reasons is that there are many different problems, needs that cannot be met by a single programming model. But this involves a certain degree of fallacy, I’m going to go further down. The…
language-independentanswered Maniero 444,682 -
1
votes1
answer69
viewsA: Comparison of index (get) in Array List not working properly
The code is a little too complicated and even so has errors. The first thing I did was change the name of the variable that holds the answers because that’s what it is, it’s not a question. I would…
-
2
votes1
answer219
viewsA: What is the "real" meaning of the key word 'extends' in Java?
These things you can never affirm with certainty unless you have a document that says why this choice was made, which I don’t know exists. Most likely by this choice is that the most correct…
-
2
votes2
answers1459
viewsA: Traverse two arrays in parallel
The error occurs precisely because you are trying to add up two incompatible things. You cannot add up a list to a text. But what you want is not even this, you want to add an element of a list to…
-
3
votes3
answers1087
viewsA: Function to return letter frequencies in an array
The if in itself there is testing a condition of a dictionary. A dictionary is an object that has several elements indexed by a key and this key can be any valid value. He looks a little like a…
-
5
votes2
answers164
viewsA: Is it worth using Assembly, C and C++ in the same program?
Almost everything done in Assembly is slower than in C and C++. It is possible to do it faster, but it is very difficult and it happens less than people imagine. In fact, only naive people believe…
-
3
votes1
answer203
views