Posts by Maniero • 444,682 points
6,921 posts
-
5
votes1
answer111
viewsA: How to print the name of the method, file and line that was called?
Use the class StackFrame. sf.GetFileName(), sf.GetMethod(), sf.GetFileLineNumber() If there’s a way release this information will not be available. There are techniques that can help, but in general…
-
4
votes3
answers390
viewsA: Is it possible to place objects in an Arraylist as soon as instantiated?
Not possible in Java. It is possible initialize the array with a specific size to avoid needing relocations when the list gets larger than the array available. The options cited in reply linked in…
-
4
votes1
answer157
viewsA: Is overlapping polymorphism mandatory?
It is not obliged and it is quite common that it is not. The only requirement is that it has the same signing. Some languages may have a signature that only considers the method name, which is very…
-
1
votes2
answers2574
viewsA: LINQ using function inside select new{} with lambda Expression
First need understand the LINQ, in full, before using. See more. When using LINQ To Entities C# codes need to be able to be converted to SQL efficiently. The best that can happen is not working.…
-
12
votes2
answers115
viewsA: How to know which parole is giving true?
It’s simple, if you want to know individually have to do individually: if (!condicao1) { //Faça o que precisa aqui } if (!condicao2) { //Faça o que precisa aqui } if (!condicao3) { //Faça o que…
-
6
votes1
answer142
viewsA: Is it worth using binary operators to gain performance?
In many cases, yes, in many cases, no. In general the recommendation is not to use them until the performance is not good enough or only the manipulation is suitable for the desired semantics, even…
-
13
votes2
answers1470
views -
13
votes1
answer560
viewsA: What is the operator '...' in Javascript?
It transforms an object that is a data collection into a data list. Its name is spread (documentation). Can be used to transform a array in arguments for input of a function, in other array, or the…
-
8
votes2
answers625
viewsA: Calculate the factorial by reference passage
I will answer what matters since the problem only exists because of another problem. Study pointers the right way. This case is not meant to use pointers and so everything gets confusing. You can…
-
6
votes1
answer255
viewsA: What is the need for an interface to have abstract methods?
We know that in an interface the methods have no implementation It’s not true. What is the need for an abstract method in an interface? None. Totally redundant. Interface methods are abstract,…
-
5
votes1
answer327
viewsA: Technology, Platform and Language, what are they and how do they relate?
Parlance I’ll tell you more about programming language, but there are other languages that we use in computing. The language itself is just one specification. Usually it can only be used when an…
-
14
votes2
answers327
viewsA: After all, is Java a platform or a programming language?
Both. There is the java programming language and a platform that people call Java as well. It can be a little confusing, but almost always the distinction is not important. Anyway I think I’d better…
-
1
votes3
answers98
viewsA: Error returning lower value
It says here min is the highest possible value: min = INT_MAX; Then ask if (min < elemento) If min is the greatest possible value ever he will be the least, never enter this if. If you do the…
-
2
votes3
answers4086
viewsA: Warning: control Reaches end of non-void Function - c++
There is a situation that has no return and this can not happen, the function has to return something in all situations, probably just remove the else in the end and will solve because if all…
-
7
votes2
answers419
viewsA: Is it possible to instantiate a class without storing it in a variable?
Yes, it is, but it is not very useful because the object will die soon after since it did not want to store it. In some cases it may be enough, but if it is, you probably didn’t need to create the…
-
3
votes1
answer56
viewsA: When to choose between using a string wide or not?
Hard question to answer. There is a tendency to use string on Linux and other platforms that use encodings that are guaranteed to be 1 byte per character or that characters are built by a set of…
-
3
votes1
answer384
viewsA: Extension . Class in PHP files
These files have a .class before. Really, that’s all that’s different, because you can use whatever name you want. There’s nothing that requires it. It’s a convention some people have adopted. What…
-
3
votes2
answers242
viewsA: Different views of the same variable in C Language
It’s not very secret, it’s different because the code asked to be different. Numerical representations for humans One thing I realize that people don’t understand is that there’s a huge difference…
-
3
votes1
answer81
viewsA: How to use more than two types in function parameters?
Do not type. PHP is essentially a dynamic language, you do not need to type: function parse(string $text, $callback) { if (gettype($callback) == "array") echo "é um array\n"; else echo $callback; }…
-
2
votes1
answer106
viewsA: Is there any sort algorithm that actually runs on O(n)?
It certainly does, depending on the scenario. With the right data (even in the worst case), with sufficient resources (memory or processors in parallel, for example) it is possible yes. If it pays…
-
2
votes2
answers97
viewsA: How to assign a class to the whole and not just attributes separately?
There’s no way in normal ways. And it looks like there’s a lot of things wrong there, starting with this class that doesn’t seem to be what she describes. It’s even hard to steer in the right…
-
4
votes3
answers2090
viewsA: How to add Count output from different tables in SQL Server?
There is no reason to complicate, if you want to add several things is a simple arithmetic operation. SELECT (SELECT count(*) from OBRAS) + (SELECT count(*) from TITULOS) + (SELECT count(*) from…
-
4
votes1
answer451
viewsA: Is it possible to query "INSERT INTO table SET field = 'value' " in Postgresql?
Is not possible. This is one of the problems of doing something out of the norm. Actually this is a great demonstration that migrating database used by an application is not something trivial and…
-
7
votes2
answers116
viewsA: Is that a Property, class attribute or what?
The original answer is below and is wrong because the new way of writing gave room to misunderstand (no one else noticed - curious how right things get negative and wrong things don’t). The certain…
-
5
votes2
answers1138
viewsA: How to use Try and catch with PHP?
In this case there is no reason to do so. It is using exception for flow control, and in the worst possible way. If an exception will be captured in the function itself that is thrown is wrong in…
-
3
votes2
answers2461
viewsA: Delete repeats of values in Arraylist
Utilize streams to filter: import java.util.*; import java.util.stream.Collectors; public class Program { public static void main (String[] args) { ArrayList<Integer> sequencia = new…
-
4
votes3
answers1943
views -
5
votes1
answer772
viewsA: Enum as Object Value in DDD
Why is Object Value meaning Value Object? If so, an enumeration is a Value Object (has everything he needs to receive this classification), so there is no dichotomy. If someone thinks an enumeration…
-
3
votes1
answer61
viewsA: Show photo of a listbox item gives me error Out Of Memory
The code is not releasing the fs, nor the ms, although the latter do not know if it could. There is no guarantee that the br will be released like this. It has other variables that hold objects more…
-
2
votes1
answer194
viewsA: Difference between Std::map, Std::unordered_map, Std::flat_map, and which one to choose?
Performance is relative. Performance in what? In access? In insertion? What is the point of having performance if the structure does not do what it needs? If you need a map with defined order you…
-
2
votes1
answer169
viewsA: What are the "User" and "Cancellationtoken" parameters for?
The parameter user is the user name you want to use to access the resource and the cancellationToken is used to ask for the execution to be stopped. Can’t any code do this, it needs to be one that…
-
2
votes1
answer63
viewsA: Error in string inversion
There’s a lot of mistakes there: Not passing the second argument, actually the parameter is not necessary Not returning something useful by use Not accepting spaces in data entry Some errors would…
-
2
votes1
answer114
viewsA: "min()" with two parameters
No, we have no way of knowing what it means, but by code the result should be a maximum of 6, i.e., if the day of the week is 7 (probably Sunday, depends on the culture used) then it will consider 6…
-
2
votes3
answers777
viewsA: How to read more than one record with READ TABLE?
There is no way to do it directly, you have to use a loop. Example from documentation: DATA itab TYPE STANDARD TABLE OF i WITH EMPTY KEY WITH NON-UNIQUE SORTED KEY sort_key COMPONENTS table_line.…
-
7
votes1
answer117
viewsA: How to use the MVC development standard?
In general it is the programmer who creates it. Of course there may be something that facilitates, may have a framework that already gives the basis and the programmer only needs to do the specific…
-
4
votes1
answer298
viewsA: Performance differences between structs and classes
In C++ there is no difference except the one already mentioned in the question, so there is no difference in performance of any type or memory consumption. They could have chosen not to have created…
-
4
votes2
answers280
viewsA: What’s the difference between creating a string with quotes and square brackets?
The square bracketed shape is more crude, it essentially does not work with special characters and considers "everything" as text, including when skipping the line. It’s like using the @ of the C#.…
-
3
votes1
answer113
viewsA: Controller needs to be a class?
As far as I know, technically it doesn’t have to be, but the way everyone implements it is through a class. If you do it another way, it might even be better, you might be innovating in a way, going…
-
2
votes1
answer61
viewsA: Non-existent C++ class pointers, how does it work?
In the form used has no meaning. This is called forward declaration, this is necessary in compilers that does the analysis of the code in just one step (interestingly this does not occur in C++, but…
-
1
votes2
answers1578
viewsA: Invalid characters in path in File.Move()
To string is not escaped, so the backslash has a special meaning and depending on what comes next will create a different character. For example, there is a \n in the text, this is telling you to…
-
3
votes1
answer81
viewsA: Perform tracking and debugging on . NET
In many cases use the mechanism of debug from Visual Studio is enough. It is extremely powerful and if people learn to use it they will be much more productive, they will make better codes and learn…
-
2
votes1
answer76
viewsA: Variable creation
Gives error because Python is a dynamically typed language, there are no types, all variables can be anything. Actually the code doesn’t even make sense because x has no value and should not be used…
-
1
votes1
answer33
viewsA: Using a connection for multiple methods in the same class and other methods
That’s essentially how it’s done. But it makes no difference, it’s already internally optimized. Note that it takes a connection, it doesn’t create a connection. Well, create if there isn’t one. Of…
-
2
votes2
answers466
viewsA: Is it wrong to mix struct with class in C++?
In C++ class and structure are the same thing. The only difference is that structure has its public members by default and class they are private by default. If you explain the visibility in the…
-
5
votes1
answer100
viewsA: How to use expanded property in C#
You have to create the private field to work, you are creating a loop infinite, because the property is used Idade to manipulate property Idade, which will then force you to manipulate Idade and so…
-
5
votes2
answers81
viewsA: How to restrict a set of a property?
Gambi Alert Use an enumeration: using static System.Console; public class Program { public static Naipe Naipe { get; set; } public static void Main() { Naipe = Naipe.Copas;…
-
2
votes1
answer142
viewsA: Performance Itextsharp
I answered about the problem in another answer (another). You can’t do it because the more you concatenate, the slower it gets, and it’s exponential, and it quickly becomes tragic. Then I’d have to…
-
6
votes1
answer1000
viewsA: What does __*(any word)__ or _* mean in Python?
Gambiarra :) These things were inserted into the language very late, as these identifiers might already be being used by existing Python codes needed to do something to not break existing codes and…
-
2
votes2
answers1323
viewsA: Can I replace Cout and printf?
In general, it should. cout is C++, printf() is C. They are completely different, but the goal is the same.
-
6
votes1
answer261
viewsA: Heritage in object-oriented programming
I’ll start by saying what I always say. Almost no one knows object orientation correctly, which includes me, but I’m making a huge effort to resolve the outstanding parts. And I’ve been wearing this…