Posts by Maniero • 444,682 points
6,921 posts
-
5
votes1
answer144
viewsA: The __fastcall, necessary or not?
Most of the time the calling convention is not considerable. When using the convention fastcall, the first arguments are passed through standard call registers. In functions too succinct or that are…
-
1
votes5
answers11566
viewsA: How to find the type of a variable given by the user?
The answer is in the question. There’s nothing to do. You will always know the type of the value, no matter how it is obtained and you will know the type of the variable at that time. In fact…
-
11
votes2
answers301
viewsA: What is serverless architecture?
One more marketing and wrong name. I like the idea of not having a server, but it is not the case of this term. It’s a way where you "buy" services and not structure. You don’t have to know anything…
-
1
votes2
answers1067
views -
2
votes2
answers519
viewsA: Validation in an ATM
For tag You want it to be object-oriented, right? Well, the code is far from OOP. I’ve improved it, but it’s not ideal yet. And of course I solved the problem reported in the question. I changed…
-
16
votes3
answers2012
viewsQ: Why does Scanner return error on something that is within the expected?
Note that I have typed a number, a text and a number, as you ask there. import java.util.Scanner; class Ideone { public static void main (String[] args) { Scanner entrada = new Scanner(System.in);…
-
4
votes1
answer5770
viewsA: What is the logic behind the trunc function?
To TRUNC() just discard the decimal part and keep the whole part. In this case it doesn’t matter to see something like "2.75". With the function would be only "2 years", which is debatable because…
-
2
votes3
answers342
viewsA: Why doesn’t the while stop?
Make the normal case the traditional way, ie a for and treat the exception that is exit by typing the S right after typing coming out of the loop. You can even do it another way (do-while), but so…
-
1
votes1
answer79
viewsA: Error in sorting numbers
I believe the order goes wrong by not considering all the items. #include <stdio.h> int main() { int quantidade; scanf("%d", &quantidade); int par[quantidade], impar[quantidade], qtdePar =…
-
1
votes3
answers400
views -
2
votes2
answers69
viewsA: For loop build error
There are several errors in the code, when solve this will appear others. We will arrange at least one part: #include <iostream> using namespace std; int main() { cout << "Quantidade de…
-
5
votes3
answers138
viewsA: In structures (struct) is it necessary to use getters and setters or only in classes (class)?
It’s not needed in either. And this good practice business is a fallacy. For example, in C++ it is not common to use this type of mechanism. There are those who use, but in specific application…
-
2
votes1
answer38
viewsA: Does Git have the feature that Subversion had keyword substitution or something?
Directly has no no. But it is possible to do scripts to do it for you. It makes available attributes which can be used in your script. Example: MYVERSION = '1.090' ## Call script to do updateVersion…
-
8
votes2
answers2606
viewsA: Check whether the previous day is a holiday and/or Sunday
You are not taking the closing date to subtract 1 day. It has to be cumulative. Note that I have greatly simplified the code. using System; public class Program { public static void Main() { var…
-
2
votes1
answer51
viewsA: No startup error
It has two errors, one is typing, the variable LENGTH is spelled wrong. The other mistake is that you’re trying to save an address for a string in a variable that is not a string. She would need to…
-
3
votes1
answer221
viewsA: Capacity of schools in Golang
A Slice is composed of 3 members: the address where it should start, which should be within a array in memory, that is, it is a pointer size so he knows where it ends, it’s an integer the capacity…
-
2
votes1
answer58
viewsA: Increment and decrement do not work in expected order
There are no guarantees about the order of execution of the arguments in the function call, so the intuition indicates that it will do in this order and the result would be "56655", but each…
-
5
votes1
answer64
viewsA: Compiler indicates non-existent Enum that exists
He’s got problems in both. The first is statistically importing the type and using the type name to access the members, or does one thing or do another. If you want to use the type name do not…
-
2
votes1
answer329
viewsA: How to allocate a dynamic stack with user-provided size?
It’s not like that. If it’s a pile then it would be something like this: Pilha pi = malloc(sizeof(Elem) * tam); You don’t need anything else but to decide what to do if there is an allocation error…
-
0
votes1
answer143
viewsA: "void *Reader(void *i)" What is the equivalent in C++?
Virtually every C code is a C++ code, so this is in C++. It’s not a code idiomatic. In C++ would probably use a template in place of a void *, would use a stream in place of printf(), it is possible…
-
4
votes3
answers178
viewsA: How to store a single character?
If you can guarantee that will always come between 0 and 9 is basically math: using static System.Console; using static System.Convert; public class Program { public static void Main() { var x = 2;…
-
1
votes1
answer64
viewsA: How to save the highest value of rowCount?
Actually this is unreliable. You should increment your own counter every time someone does the login, and decrease every time someone does the logout (manually or by inactivity). When increment it…
-
4
votes2
answers2674
viewsA: Handler? What is this and what is it for in C/C++?
There are no tutorials on this and it’s not even our goal. The question talks in HANDLER, which does not seem to be the case. The context indicates you want to know about the type HANDLE or the…
-
3
votes1
answer908
viewsA: What is and how does an RTA work?
What qualifies an application to be an RTA or not? Its runtime? I don’t like this idea of real-time application. An application can have parts in real time and parts that aren’t. If there is any…
-
6
votes1
answer392
viewsA: Randomly select lines
Complexity without explanation is subjective. Without context information has no value. Time of experience does not mean quality. "Do this" without explanation serves for nothing. "vc uses RAND(),…
-
5
votes3
answers927
viewsA: How to declare an attribute in interface?
What you really want is a abstract class and not an interface. If you really need it. Including by name, an animal should not be an interface since this mechanism is to indicate abilities and not…
-
10
votes4
answers814
viewsA: Why can’t we return a void call in a void return waiting method?
There’s something called Type System which is a set of rules that determine how the data will behave and what you can do with it. It is based on type theory. So all language data structures are…
-
1
votes3
answers187
viewsA: What do these operators " > " and " mean? "
> means greater than, equal in all languages and in mathematics (although it is usually a statement and in programming it is a question that will generate a Boolean result. In this case you are…
-
2
votes1
answer136
viewsA: Is it possible to omit the numbers of the "String.Format" formatting arguments in C#?
No, but you can interpolation: mensagem = $"Meu nome é {("Wallace")} e minha idade é {27}"; Of course, if it’s not variable or some expression that involves variable, it doesn’t make sense.…
-
5
votes3
answers1185
viewsA: There is no library called Math
If you use import math is providing the module math for your application to use. Then you need to call the function inside the module, so: math.sqrt(9) But if you use from math import sqrt Is…
-
2
votes2
answers463
viewsA: Struct definition in C
What’s the problem with using a type that hasn’t been defined yet? You don’t need its definition, just exist. Can not use before setting when use depends on setting, in this case only need the name.…
-
5
votes2
answers448
viewsA: The "Color.Name" property or indexer cannot be assigned, as it is read-only
The error is self descriptive, you cannot change the color name. Why do you want to change its name? This makes no sense. If you want to change the color, just change the color, don’t change its…
-
12
votes2
answers5134
viewsA: What is the meaning of the term "canonical" in the context of programming?
ca Nô ni co (Latin Canonicus, -a, -um) adjective Of the canon or of it. According to the canons or dogmas of the Church. [Linguistics] Which follows the most usual or more neutral structure in the…
terminologyanswered Maniero 444,682 -
2
votes1
answer663
viewsA: Login information validation does not work
Some remarks that will put you on the right track: Make sure the input is within the parameters, do not check if it is outside. It may sound silly, but just accept what can be accepted and keep the…
-
1
votes1
answer1680
views -
4
votes2
answers1166
viewsA: Searching an Arraylist in Java
This code has logic error and is not efficient, could do so: for (Fruta fruta : listaFrutas) { //eu chamaria só de frutas if (fruta.contains(pesquisa)) { System.out.println(pesquisa + "está na…
-
1
votes2
answers7816
viewsA: Consult in all tables of the database
Directly it does not, because when this is necessary it is because there is something wrong in the modeling of the database. It is possible to create a script read the database metadata…
-
2
votes1
answer271
viewsA: Using TLS 1.2 in . NET Framework 2.0
It is not possible, at least directly, only in 4.5 upwards. O . NET 2.0 has not been supported for quite some time and should not be used, it does not receive security updates. Who knows how to…
-
3
votes1
answer181
viewsA: How do I install Sqlite on Android?
Does not install. First because it is not a server or application. Second because the code that handles the file, or should be in your application (I don’t know how Android handles it, but it’s not…
-
0
votes1
answer105
views -
1
votes1
answer182
viewsA: Overwrite static method
I don’t know what the Java engine looks like, I’ll just answer part C#. What you want to do is not conceptually correct and therefore has no specific mechanism to deal with this issue. Of course you…
-
3
votes1
answer693
viewsA: Several UPDATES in the Firebird database
Essentially, it doesn’t have. There is nothing standardized in this code that can make it generic (there is no apparent criterion of what causes what), it is all individual. But if you can rewrite…
-
2
votes1
answer53
viewsA: Why use Kernel#loop instead of Begin-end-while/until?
I’m no expert on Ruby, but from what I’ve seen, it’s all about readability. When you read the code and find a begin You’re thinking, start from what? There’s nothing clearly indicating there. Worse,…
-
1
votes3
answers857
viewsA: Dollar next to number in Tostring format
You may not like it, but our symbol is like this. If you want to use another one you can format like a normal number (F or N) and additional currency symbol manually. Can change the symbol in our…
-
19
votes3
answers12885
viewsA: How do you know what language a program was written in?
In general, easy and guaranteed has no way of knowing. You can look at the binary in an editor that allows this (probably a hex editor) and search for binary signatures that deliver the information.…
-
1
votes1
answer139
viewsA: Grab all images from a subdirectory except for a folder
I think the easiest is to use LINQ. var arquivos = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories).Where(f => !f.Contains("Backup")).ToArray(); I put in the Github for future…
-
1
votes1
answer113
viewsA: Identify multiple numbers in a variable
Array It is not possible to store multiple values in a scalar variable as you wish. It is possible to store in a multi valued variable. A vector is the most obvious type to do this. An array can be…
-
6
votes1
answer169
viewsA: Intelligent Pointers
The error is in the original code itself, so you already know that the source is not good. In fact, when you go looking for information about technology and other things on the Internet, you should…
-
5
votes1
answer96
viewsA: How to create variables in C# in the same way as in PHP?
This is already a huge gambit in PHP. In C# it is even worse because it is a language that encourages solving everything at compile time. Almost always (99+%) that someone does this is actually…
-
2
votes1
answer7425
viewsA: Function takes as parameter a string array
One of the reasons for the error is that they exist strings in C. There actually is array of char ended with a null. If conceptualize it correctly it is easier to understand. Then there are two…