Posts by Maniero • 444,682 points
6,921 posts
-
3
votes1
answer109
viewsA: What does << in Ruby mean?
This is the operador de concatenação. It can be used in data collection contexts. In the example shown it is adding a new item to a array. He’s the same as writing array.concat(item) that does what…
-
3
votes1
answer269
viewsA: How do functions that receive callbacks be executed in a specific order?
I answered what was in the original question. Which was even answered equal, but briefly in How to determine the order of executing callbacks functions without resorting to anonymous functions and…
-
3
votes2
answers1305
viewsA: How to store product lists of an order in a database table?
You need a table of order items. This is called associative entity. This table would be linked to the request and an entry in it only exists because there is a request. This is normalization basic.…
-
7
votes2
answers97
viewsA: How to see the implementation of the Typescript code?
Typescript is a language that runs on top of Javascript. At least she was designed for this, nothing prevents her one day to change course, but the goal is to continue like this. She uses a…
-
6
votes3
answers124
viewsA: How can a pointer point to a function?
A function is where? In memory, right? And all memory is addressable, right? So the question is why can a function be addressed? In fact a function is always addressed, even if you don’t see the…
-
8
votes2
answers180
viewsA: Incorrect value in vector when binary search
Although you want to use the method Arrays.binarySearch() to find a value in a array not classified (the correct term, because ordered the array is, it has an order, data entry order) and this…
-
6
votes2
answers129
viewsA: What is the difference between LINQ research forms with Datetime.Now?
At first the question was not clear, now I am highlighting this part after editing because this is the problem. The second part is a complement to people better understand LINQ. Search in a database…
-
6
votes1
answer221
viewsA: How to validate if ternary operator was used in the implementation?
TDD is not that TDD is not what you seem to believe it to be. It is a development methodology used to better understand the problem and formally specify how the code should result in. It happens…
-
8
votes2
answers303
viewsA: What are computed names ("dynamic" structuring) in Javascript?
As you can see, an object property in JS is actually an index key of a array associative, then every code symbol (which can be naturally confused with an object variable) used to access a property…
-
11
votes1
answer55
viewsA: Do I need to declare all classes in your files?
Work? It works. The problem with people wanting to do something object-oriented is that they don’t want to learn object-oriented programming, they just want to create meaningless classes to say that…
-
4
votes1
answer64
viewsA: Problems using null coalescing
The operator of null coalescing can only be applied on annuadable types, which were standard before C# 8 for types by reference, or if specified in type in any version (could not specify in types by…
-
8
votes2
answers116
viewsA: What happens when we assign the default value to objects?
As the name itself says, a default value of that type is assigned to the variable. This may vary but is usually a value equivalent to a zero, a simple initialization. In types by value would be the…
-
17
votes2
answers764
viewsQ: What is the difference between a map, a dictionary, an associative array and a hash table?
These terms refer to structures that have very similar, if not equal, characteristics. They often seem to be used interchangeably. This would just be different nomenclature depending on the…
-
5
votes1
answer188
viewsA: Instantiate a class from its name in a string, without using "Eval" and in Chrome (V75+)
I actually saw this happen. It worked and it doesn’t work anymore. I can’t say yet if it really worked without being official or if they broke compatibility irresponsibly. It’s not only in Chrome…
-
12
votes1
answer87
viewsA: How does the compiler know the difference between the type I’m using in downcasting?
First let’s start using the correct nomenclature of things, what you call an attribute is actually a field, then is repeating the same thing in the statement, improving your question and…
-
11
votes3
answers179
viewsA: Two different parameters that an accepted function can classify as having O(n²) complexity?
It’s enough to say it’s not O(n2) for a basic reason, if you have two dimensions and each one can have a different size (yes, it is possible), only use one n doesn’t make much sense. In fact it is n…
-
7
votes2
answers130
viewsA: Result Undefined when calling function in calculator
Because you are not passing the arguments to the function. I took advantage and improved the readability of the code, putting together what is together, putting ; because it works but there is case…
-
10
votes2
answers318
viewsA: "-" operator cannot be applied to a string
The problem is precedence of operators having their table seen in the documentation. The numerical negation operator has a lower precedence than the member access operator. Applying precedence the…
-
4
votes1
answer140
viewsA: Function to void pointer conversion*
It is allowed to do this by default, only it is not mandatory, so some compilers may or may not leave it and may even leave it only where it makes sense. Even if the compiler leaves it may not make…
-
4
votes2
answers115
viewsA: Concept of blocking directories in robots.txt
The robot.txt only prevents the search engine (Google) access to content, not from the normal browser. And even then only if the search engine wants to do this. This is not a universal protection,…
-
7
votes1
answer117
viewsA: Can I create function parameters like string?
This is not a parameter, even less it belongs to a function. This is an object, if it were a parameter it would be in parentheses, for example the n there in the function factorial() is a parameter.…
-
5
votes1
answer346
viewsA: What would be the standardization and specification of a programming language?
What would be a specification of a language? I think it’s already explained in Specification and Implementation and How a programming language is developed?. And for the Javascript example: What is…
-
4
votes1
answer67
viewsA: What kind of data entry is this? scanf("%m[ ]
It is not standard and most compilers do not accept this, so it is a good reason not to use. If using GCC you can apply to the scanf() allocate the memory needed for the data that will be stored in…
-
8
votes1
answer132
views -
3
votes1
answer92
viewsA: Why does an error code not execute the parts without error?
In this context, at the moment that there is an error in the code it does not have because it keeps running, everything else is compromised. It may be that some cases are not, but it is difficult to…
-
8
votes1
answer169
viewsA: What is formal documentation?
This means that the comment will be used to create documentation. The formal documentation comment should be public and is often used to create external documentation in a more presentable way for a…
-
5
votes1
answer140
viewsA: "null" is a value or a state in which the property is located?
A database does not return null. A method from any library you are using can return null and you can store this value in a variable. Not all languages allow this, but I understand you’re talking…
-
8
votes3
answers329
viewsA: Why does my "Try" in Python not work?
You ask for the die and try to do the conversion (the function int() does this), and if the conversion is not possible (because the typed text is unsatisfactory to create an integer) an exception…
-
7
votes1
answer150
viewsA: Is there any way to decrease the size of a function’s call?
It even exists but in general it doesn’t pay. You do what we call abstraction, so you create another method that calls this one and then give it a smaller (better) name. In some cases you may even…
-
9
votes2
answers151
viewsA: Operator ! in if ternary
In this code the use of the negation operator is an error or at least abuse. Even if it produces the expected result does not make sense and only does not give error of execution because PHP is a…
-
8
votes1
answer159
viewsA: "if" elegant in PHP
The first attempt to make it more elegant: if (file_exists($pathFize)) { But if you are going to use this data many times then it is better (or the most correct way possible by doing so): $response…
-
4
votes1
answer89
viewsA: Is it possible to replicate a Union in Java?
General behavior is possible through a library that has a structure that simulates this, but replicates the specific behavior of a union of C is not gives, the language has no mechanism for this…
-
8
votes1
answer128
viewsA: Why is Javascript not showing the decimal home number?
Because you didn’t show it. A common mistake that people make is to think that what you’re seeing are numbers. Nothing you enter or order out of an application for a human to manipulate are numbers…
-
4
votes2
answers197
viewsA: When to use Lazy<> from C#
What is not so clear in all of this is that this class should be used whenever the data may or may not be used in the execution of the moment. It’s not just a question of leaving it for later, it’s…
-
10
votes1
answer1262
viewsA: What does "string" mean?
The translation or even expression in English may have several meanings and I have not seen "line" at all that I had access to. The most common is rope or some variation of this. A possible…
-
9
votes1
answer428
viewsA: What are the differences between the methods "equals()", "compareTo()", and even "=="?
An obvious difference between equals(), compareTo() is that they return different things, the first returns a boolean and can already, for example, be used in a if, whereas the second returns a…
-
5
votes2
answers139
viewsA: How to test if the free(); function worked correctly?
If you’re talking about checking if the function has played its role correctly then you don’t need to check anything, it always has, there’s no way it fails to be by a catastrophic situation on the…
-
11
votes1
answer1711
viewsA: Is there a pointer in Javascript?
Pointer exposed to you does not exist, but indirect, values accessed by reference have. It would be almost impossible to make some useful code without having such a form. Pointer is an indirect…
-
5
votes3
answers2675
viewsA: Is it possible to include more than one variable per input in Python?
It is not possible, the function input() only returns one value always. Even what you are trying to do is not to return 3 separate data, it is returning a value and is breaking it down to 3 right…
-
7
votes1
answer404
viewsA: How does type "Unknown" work in Typescript?
My understanding of this is that the any works like the dynamic C# (I already explain to those who don’t know the language) and the unknown is the object, or almost this. With the any You can try to…
-
6
votes4
answers140
viewsA: "Enum" should be used to indicate business rule options?
See the difference between something being constant and something having the forbidden modification: What is the difference between const and readonly?. It’s C# but it’s just to understand the…
-
2
votes2
answers201
viewsA: Associative class with double dependency
This thing of right or wrong is something that people don’t understand right. There is only right within a context. You didn’t use the word but you’re looking for a good practice, which is a plague…
-
7
votes1
answer458
viewsQ: Is webview useful to use as an application UI?
Context I saw a Steve Sanderson’s article about an experimental project called Webwindow that uses a Webview component available on the operating system to use as the UI of an application. This is…
-
3
votes1
answer149
viewsA: SQL Server Data Types
You’re confusing textual representation of the number with the number itself. If it will hold the number 1.5, it has no semicolon, it has an entire unit and half a unit in the decimal part. The…
-
4
votes2
answers155
viewsA: Variable receiving trash
After further analyzing the question, the problem really was another. In fact the if was right, but as it was done in the illegible way I quote below I ended up confusing myself, I’ll leave because…
-
5
votes2
answers1086
viewsA: Adding list elements during a Python loop always returns the same value
A list is a type with semantics by reference and not by value, which you are adding to someList with the append() is a reference to current. The reference of current does not change at any time so…
-
6
votes4
answers1891
viewsA: Sum of pairs typed interval
There are some problems with the code. Must accumulate the values of i and not of x. Actually it was not accumulating, it was just adding up the initial value with the first value of the loop that…
-
3
votes2
answers120
viewsA: What is the correct place to store the validation messages in a . NET project?
It’s not always easy to answer these things. I’ve done them myself in different ways. Today I like to do it in a way that I don’t even indicate because it takes a certain cancha to make it right…
-
1
votes2
answers106
viewsA: How to put the response of a function as a parameter in another function?
You’re calling soma() and taking the result to print on the console, not holding anywhere, so you can’t use this value unless you call the function again. As the function is pure would have no…
-
2
votes2
answers156
viewsA: What is the correct way to do an Replace in a string-like variable?
If I do it this way, 9 different instances of the string? That. The second way seems more suitable because it does not make the allocations and allocation costs more expensive than people imagine*,…