Posts by Maniero • 444,682 points
6,921 posts
-
1
votes3
answers729
viewsA: Receive two positive numbers and repeat the interval between them with while?
There is a problem in the condition of while and is not considering that the numbers are not necessarily sorted. You can do so: var num1 = Number(window.prompt("Entre com primeiro numero")); var…
-
4
votes2
answers855
viewsA: Modeling launches using customers and suppliers
I have to say I want to having an empty column is not the end of the world. But I wouldn’t go down that road. He has some problems and one of them is that it complicates extensibility, as Bacco said…
-
2
votes1
answer120
views -
6
votes1
answer3045
viewsA: Difference between If and Iif
Commando If The If is a command (statement). It decides whether to run a command block based on a boolean expression. It can decide between a block or another if there is a part of the Else. The…
-
10
votes2
answers513
viewsA: Reflection C#, how does it work?
The ideal to explain about this would be interesting a deeper understanding about the functioning of computers, compilers, executables and other fundamentals of computing, but I will try not to be…
-
10
votes1
answer1490
viewsA: Polymorphism or inheritance?
You’re doing both. When you put Comprador : Pessoa or Vendedor : Pessoa is making inheritance, ie the first name is defining a class that will be composed initially by the class referenced in the…
-
3
votes1
answer724
viewsA: Given two numbers A and B, creates a third C by mixing the first two alternately?
It’s not that it’s too bad, but it can be better. Some things are a matter of taste, others have more relevance. There is case that can be bad in a more complex application, but in something simple…
-
4
votes2
answers203
viewsA: Documentation on WPF with pure C# code
The documentation is Microsoft Docs, specifically the namespace Windows. The starting point of the documentation is FCL. WPF is 10 years old (on the date I wrote this) and is only used for desktop.…
-
3
votes1
answer716
viewsA: What is the difference between the "+" and "&" operators when concatenating strings?
Essentially there is no difference. The & is the VB way of concatenating (it is the legacy style of the language when it was only VB). The + is the VB.NET way of doing it (it was added to the…
-
10
votes4
answers3476
viewsA: When do I actually need to use the this operator in Java?
4 situations: Reference a class instance variable unambiguously It is possible but some people recommend to avoid using where it is not ambiguous. So if an instance variable of the class does not…
-
7
votes2
answers2146
viewsA: Is it possible to connect a C-based application to a database?
Why wouldn’t there be a way? Programming languages are just mechanisms for communicating with the computer. What communication does with databases is usually organized code in libraries. Each…
-
3
votes2
answers277
viewsA: Value of Enum C#
Constants An enumeration is a sequence of constants. In general constants must have their immutable state throughout the life cycle of the project (the answers in this question give the details).…
-
8
votes1
answer2572
viewsA: Makefile: what is it, and what is the purpose?
Usually associated with a utility called Make, or eventually some variation of it. It is just a configuration file that instructs what the Make must do. The Make is used to automate the process of…
-
6
votes3
answers8881
viewsA: How to import functions from another C file?
Unlike Java in C, the declaration is usually separated from the definition of functions. It is common for the definition to go in a file .c and the statement stays in a file called header .h. But…
-
11
votes2
answers426
viewsA: Is there a way to break in If?
There’s something called short-Circuit. Relational operators operate this way. They evaluate until they are sure of the result. When the other operands can no longer alter the result no matter their…
-
7
votes3
answers1926
viewsA: How do you know how many days are in the current month?
SELECT LAST_DAY(data) I put in the Github for future reference. Documentation.…
-
7
votes2
answers49607
viewsA: How to format a Datetime field in Brazilian dd/MM/yyyy format?
CONVERT(VARCHAR, DataAfr, 103) AS [Data Aferição] Documentation. If you are using at least SQL Server 2012 you can use the function FORMAT() with the Brazilian option. FORMAT(DataAfr, 'dd/MM/yyyy')…
-
8
votes1
answer305
viewsA: Impact of the Garbage Collector
When it’s good to clear your memory? Never. I’ve answered that before. The ideal time is when to open and close the screen? Never! On all screen buttons? Never! What problems can be caused by…
-
4
votes1
answer76
viewsA: Is it possible to delete "C:" using Directory.Delete?
Directory.Delete() is made to delete files and folders. It cannot erase a partition that is on a lower layer than the one you are using. It will try to delete all folders from this partition, but it…
-
9
votes2
answers5514
viewsA: Is there a correct way to comment on a code snippet?
I can’t imagine a case where a comment underneath the fact is useful. It is obvious that comments on the same line can only be made if the text is too short. When you learn when you comment you…
-
1
votes2
answers1002
viewsA: Return Enum C#
You have to take the attribute that has the text you want. You can use this: public static class EnumExt { public static string GetAttributeDescription(this Enum enumValue) { var attributes =…
-
9
votes4
answers2450
viewsA: What is the :: (two-point double) in Angularjs?
Is the Onetimebinding. This indicates that as soon as this value can be defined by framework it should already render the content and should not keep trying to recalculate it. So it disconnects from…
-
3
votes1
answer302
viewsA: Get cursor coordinates in C#
In Windows Forms you can use Cursor.Position. Out of it you will probably have to access the Windows API. A response in the OS teaches to do this. [StructLayout(LayoutKind.Sequential)] public struct…
-
19
votes2
answers4597
viewsA: What are the differences between HTTP 1.1 vs HTTP 1.0?
HTTP 1.1 passed require a Host Header. Previously it was optional. This made it easy to route the request between servers more easily and even share the same structure to multiple sites (virtual…
-
3
votes1
answer53
viewsA: Is there any way to shorten the property declaration?
The syntax should use the keyword Property: Public Property Propriedade As String That does the same as the question. It can be initialized, equal to C#: Public Property Propriedade As String =…
-
16
votes1
answer12831
viewsA: What are the main differences between VB.NET, VB6 and VBA?
VB6 VB6 is the sixth and latest version of Microsoft’s Visual Basic language. Which in turn is a visual evolution (facilitates screen creation) of BASIC which was the product that gave birth to…
-
19
votes2
answers10671
viewsA: What’s the difference between Union and Union All?
Basically it’s about lines duplicates. UNION will combine lines of the other combined tables that already exist in the result of the queries applied in the previous tables. UNION ALL won’t mind…
-
2
votes2
answers377
viewsA: How to generate a . of the implementation of a class . cpp without the main function in g++?
To generate the object is typically used: g++ -c main.cpp Where -c avoids link the executable and generates an object. For C it works the same, just call gcc. Documentation. You might want to use…
-
4
votes1
answer252
viewsA: Array with dynamic ability and how to invalidate other characters in reading
Arrays have fixed size. When you need unknown size you need to use a ArrayList. I used it because it’s the question and I might use it somewhere else later, in the current way or array, nor…
-
3
votes1
answer63
viewsA: Is there a way to create a private class in C++?
There’s no way to do this in C++. In fact in no language is there definitive protection to avoid use. When there is some protective measure in access to some part of the code only works if the…
-
16
votes2
answers5134
viewsA: What makes Join() so superior compared to other concatenation techniques?
Problem There is a problem that one of the creators of this site (SO) calls Shlemiel the Painter’s Algorithm. A painter paints the stretch of a highway. He starts very well, with high productivity.…
-
9
votes2
answers335
viewsA: How do the parameters that LINQ methods receive work?
Has the source code of it available. In the same file has all LINQ code. All . NET code can be seen and easily on this site. No . NET Core is divided into several files. There’s a question that…
-
4
votes1
answer55
viewsA: Error in anonymity function does not allow compiling
We’re missing a ; at the end of the variable declaration: $remove_acento = function($str) { $a = array( 'à', 'á', 'â', 'ã', 'ä', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ',…
-
3
votes3
answers163
viewsA: "Carry" variables between functions, appears strange character in place?
Variables are not carried from one function to another. Only values are copied from one function to another. And some of these values give access to some object available in memory. You needs to…
-
3
votes2
answers82
viewsA: Conversion of byte array to string when compiling revealing the string in C compiled code
It is clearly defined in code C. A string is a array of bytes, then it is set right there. It not only protects nothing, it is wrong (unless another stretch fixes the lack of completion of the…
-
4
votes3
answers451
viewsA: Is the Std::map structure in C++ a tree?
It is quite likely that the std::map be done with a tree. No guarantees. To specification does not tell how it should be implemented and should not even determine implementation detail. It is the…
-
2
votes1
answer87
viewsA: Where are the databases saved in SQL*Plus?
In no place. The SQL*Plus is a utility for using commands, mainly in scripts to manipulate databases. It is not a database, so there is no reason to be somewhere. Must have created databases on…
-
17
votes2
answers3267
viewsA: When and why should we use polymorphism?
I will answer what you give, because the answer that exists does not explain what was actually asked. Can’t tell if you’re doing something right without seeing what you’re doing. What you apparently…
-
9
votes1
answer146
viewsA: Can Observer be considered encapsulation break?
Some consider that yes, in a sense. This can be observed in a excellent response in the OS. But not in the sense of the question here. At least what is described in the OS response linked above is…
-
4
votes2
answers12313
viewsA: How to convert binary to decimal?
The best way The best way is to create a code that does this. C has only the basics. C is not C# or Java. You can look for a library that does this, but there’s nothing that everyone uses and is…
-
5
votes5
answers29254
viewsA: How to convert date to dd/MM/yyyy format?
If you’re sure of the form, one of the ways to do this would be to make a Parse() in American format: DateTime.Parse(data, new CultureInfo("en-US")); If you can fail and want to specify the format…
-
15
votes2
answers1101
viewsA: Entity Framework Core x Entity Framework 7
EF7 Since EF 7 does not exist, it has zero differences. EF 7 is EF Core. By a rare flash Microsoft named the product properly (for a time the unofficial name was EF 7). As the new version is a new…
-
3
votes1
answer51
viewsA: Conventions of when to use _ or $ in Java identifiers?
In a general way never at least one of them. $ is considered to be of internal use and only the compiler should generate identifiers with this character. Of course, exceptions can always be made if…
-
3
votes3
answers181
viewsA: Use of data type modifiers
What gain do you expect from it? If you think you have any gain you need to justify it. Normally this is used when you really need something with no signal, which is critical that it’s like this,…
-
29
votes3
answers881
viewsA: Is there a difference between reporting the size in the loop condition or outside it?
Overall the gain will be minimal in the case of ArrayList that calls a method and has some cost. Already did a test in the O.R.. The gain really is very low and it only pays to worry about it if the…
-
22
votes7
answers21016
viewsA: What does the term Fallback mean?
According to Wikipedia is a contingency option, meaning something is used when its original option is not available for some reason. This is a generic definition that serves computation well. Of…
terminologyanswered Maniero 444,682 -
9
votes2
answers6860
viewsA: How to number the alphabet and add its letters getting a result for each written word?
It’s pretty simple using math: import java.util.Scanner; class Ideone { public static void main(String[] args) { Scanner on = new Scanner(System.in); System.out.println("Digite a palavra: "); String…
-
1
votes3
answers797
viewsA: Count numbers 1 in binary number after decimal base conversion
A simple way to do it: #include<stdio.h> #include<string.h> int main() { char valor[1000]; long long int valor_i; int position = 0, count = 0; scanf("%lld", &valor_i); while (valor_i…
-
29
votes3
answers13759
viewsA: Difference between %i and %d
No difference, will produce exactly the same result. The difference occurs in the scanf() and its variations. The %d only allows input of an integer with signal in decimal format. The %i allows…
-
17
votes1
answer703
viewsA: Are classes that implement interfaces considered subclasses?
Concepts Let’s conceptualize things. Although not everyone agrees with these definitions, I will put an understanding that many have. Subclass Is the ability to reuse code of something existing.…