Posts by Maniero • 444,682 points
6,921 posts
-
6
votes2
answers863
viewsA: Convert binary to decimal without using "parseint()"
The biggest problem is that you’re not taking the characters in the correct order, you’re taking the first one and doing the exponent with the smallest magnitude when the first character is the…
-
4
votes3
answers391
viewsA: What are literal types in Javascript?
Literals are not types, this term is wrong. Literals have a type, it’s different. So it’s not like there’s no difference to a "normal guy," there’s no relationship, and there’s no normal guy, like…
javascriptanswered Maniero 444,682 -
1
votes1
answer39
views -
4
votes1
answer225
viewsA: Ratio of threads to number of processors
It’s not that simple. It means that your computer has the ability to run 4 threads (is the number of Logic Processors indicated) at each time in parallel, that is, at the same time of truth. It does…
-
6
votes1
answer348
viewsA: What is Pattern Matching?
What is the Pattern matching? This is not specific to Elixir, and even to functional languages, although it makes more sense in them. All serious language mainstream, especially those who like…
-
4
votes2
answers146
viewsA: Error concatenating string from path
This job is a little weird. If you are practicing then it would be interesting to practice what is most important and at the same time easier because it is not even programming itself. If you make a…
-
9
votes2
answers355
viewsA: Would using underline in C# be good practice?
It’s neither good nor bad practice, it’s style. Not to mention that good practice is usually a rule without explanation, so one takes it as a good thing without even knowing why and ends up becoming…
-
1
votes1
answer54
views -
1
votes1
answer50
viewsA: Bind amounts in PHP and other languages
Along with security (preventing injection attacks and other errors) it is a facilitator to put the value in query without mixing things up and working the right kind, but most only use it because it…
-
7
votes2
answers1125
viewsA: What current languages are used for Windows application development?
Essentially all can be used from Javascript to C, going through the ones mentioned in the question, and obviously C++, Delphi, Python and others, it makes no sense to list all. Then we fall into the…
-
6
votes2
answers398
viewsA: What are the differences between a type and interface alias in Typescript?
Interface The interface is still a type, but it is a contract only, it is not a type to be instantiated. You can create a type that conforms to an existing interface so there will be a new type that…
-
3
votes1
answer54
viewsA: Implement only direct methods from an interface
it is possible that I only implement the interface methods LandVehicle? It’s not possible, you have to implement everything, somewhere. Nor would it make sense to allow it. An interface is a…
-
5
votes1
answer210
viewsA: What is the difference between %p and %d in C language?
The correct way to print a pointer is the %p. Some compilers require you to make a cast for void *. Documentation. Some implementations and depending on the compiler configuration allow using the %d…
-
1
votes2
answers153
viewsA: Without the if explanation
It is not true that the else you should only come with one if, He can come to the situation when a bond has not been iterated to the end of what is expected. He was created precisely for the…
-
2
votes1
answer66
viewsA: Why is the comparison of objects with the same content false?
Objects are types by reference, so the basic values of objects are pointers that indicate where the value of the object really is, is a form of indirect. When comparing the values of the variables,…
-
7
votes2
answers171
viewsA: Besides structures like "for", "while", "goto" or recursion, is there any other way to repeat something in the programming?
Iteration Actually the first three he used is the iteration. If you consider everything as one thing, other than recursion, as far as I know, there are only these two. There are other ways to…
-
2
votes2
answers175
viewsA: How to show value typed in Alert()?
Just print the variable, without anything else, you only use quotation marks to put a text, if you want a symbol of the code to be solved and used its value then it should appear direct. There is…
javascriptanswered Maniero 444,682 -
1
votes1
answer799
viewsA: How do I use if inside the for, without the outside if appearing?
The best way is using a function since without it would have to create a flag that is gambiarra, and the function better isolates what is each thing. You want it to show the user if they find it and…
-
6
votes3
answers162
viewsA: Another alternative to not repeat this "function" three times?
Whenever you want to generalize a processing that seems repeated you should take this model and parameterize the variable parts. And of course when I’m talking about parameterizing the function…
-
9
votes1
answer197
viewsA: Deno and Node.js - Compatibility
There is no full compatibility and it is not possible to have it. The product has fundamental differences and was not made for compatibility. What I understood there is that they want some…
-
3
votes1
answer48
viewsA: Cardinality of MVC on desktop
The idea of MVC is just not to be one for one. Many problems, many of them are so, so it is clear that MVC should not be used. It’s not that I can’t, but you can do something simpler with that…
-
3
votes1
answer89
viewsA: Console input is not treated correctly
There is one problem that is almost syntax (it is not keeping anywhere the converted value), and another that is reading a key and not a data, read the documentation before using any in your code.…
-
3
votes1
answer164
viewsA: In what order to dispose the methods of a Java class?
That’s taste, there’s no technical reason to choose one way or the other. However there may be a logic that not everyone will agree, and I myself do not always agree with everything I preach, some…
-
7
votes2
answers103
viewsA: Why is this loop infinite?
This code does not make much sense and is very inefficient, but if you really want to do what is described in the question it would be like this: text = 'abcdefghij' t = 10 for i in text: print(i) t…
-
6
votes3
answers264
viewsA: Receive a string and put keys in it
Maybe you got confused with f-strings who use this syntax and thought it would put the keys, but it’s just the opposite, they’re special in this mechanism. It is possible to use it and I still got…
-
6
votes1
answer68
viewsA: Difference between query with and without Inner Join
In general we can say that it is syntax only. A syntax that makes it clearer what you want to do a merge can be more interesting for readability. It’s possible that some database mechanism does some…
-
1
votes1
answer61
views -
3
votes1
answer52
viewsA: What does this point in the structure code mean?
In this context it is a way to indicate which members are to be used. It ends up serving to disambiguate whether that is a normal variable or a member of the structure. Without the point it could be…
-
3
votes2
answers74
viewsA: Differences of boolean return
To understand better you must read What is a variable?. Knowing what is a variable the question to be asked is whether you need to store its value somewhere. Why store the value in a variable and…
-
4
votes2
answers183
viewsA: How to resolve "There is no default constructor in ..." error in Java?
The first and main mistake is to think that there is a builder’s inheritance. It does not exist, you have to create builders of all classes, and I strongly advise doing this. Builders are static…
-
2
votes2
answers225
viewsA: How to initialize a string vector within a struct?
I didn’t see any problem, it could be the compiler configuration you are using. But if you are using C++ then use the type string and not a array of char. Better yet, use a vector to store the…
-
7
votes1
answer108
viewsA: Error when calculating decimal value
Your formula is wrong, the correct one: using static System.Console; using static System.Math; public class Program { public static void Main() => WriteLine(CalculatesInterest(100M, 5, 0.01M));…
-
1
votes1
answer359
viewsA: Recover sequential auto increment after deleting some column
That doesn’t make sense, the ID should be used precisely to be a stable indicator of that line and so be able to use anywhere in the database, and even outside it in some cases, and be sure to…
-
6
votes1
answer94
viewsA: What is the purpose of the module in Elixir?
What is the purpose of the module in Elixir? Basically group functions that are related and create a scope for their use, so the functions within it can only be accessed through his name. A module…
-
6
votes3
answers307
viewsA: How to use if, Elif and Else
The statement says exactly what you should write in the code, and it’s not written, there are 3 conditions set and you put 4, even repeat the same action for two different conditions: n =…
-
4
votes2
answers145
viewsA: What are the disadvantages of protecting a string of objects from a nullPointerException using the optional map?
The biggest drawback I see is that it’s not very readable. But legibility has to do with context. If everyone does it can become normal. But I look at this and I don’t know what it does even though…
-
4
votes1
answer54
viewsA: Error in variable type
To solve the problem described you must change the type of the variable categoria for string, the type you used only allows a character and not a whole text. Don’t forget to do the include…
-
2
votes1
answer61
viewsA: Function within a function
You don’t have a function there, you have a method, at least by the convention adopted that if you have a self as parameter is a method, so methods can only be called through an object, cannot be…
-
2
votes1
answer44
viewsA: Provenance of calculation
The problem is the typing system. The variable total is whole and depending on where it is will use the integer operator, which results in an integer and depending on where it has "contaminates" the…
-
1
votes1
answer160
viewsA: Negative, positive and zero numbers do not return as expected
If you are programming in C (the question is C++), you should use the input formatter %d. but even not doing this is not to give any problem in any compiler (some will prevent compiling, but if…
-
2
votes2
answers699
viewsA: Multiples of 2 numbers in C
There are several problems in the code and I hope to have understood the problem. Some things I changed because it gets better just. I’m not sure but I doubt I should start the 0 so I started the 1.…
-
0
votes1
answer92
viewsA: Problem with my Rock, Paper and Scissors game
The biggest problem is that it created a array needlessly and is comparing his element which is a text with a number, it makes no sense, just compare the drawn number with the desired number in that…
-
1
votes3
answers503
viewsA: Sum of geometric progression terms
Since you need the terms and of the sum, it is not complicated and nothing other than getting the terms. I improved a few things: #include <stdio.h> int main() { int a1, q, n, soma = 0;…
-
3
votes1
answer167
viewsA: Capture and treatment of exceptions in a generic way
I haven’t seen such an important question on the site in a long time. In general the most common is to capture the specific exceptions and do some treatment with it, right? If it makes sense in that…
-
4
votes1
answer139
viewsA: Functions with different return in Go
The method declaration in the interface as shown is an invalid syntax, you need to declare the whole signature of the method. And doing this can only conform to the interface if you implement a…
-
1
votes1
answer86
viewsA: Mathematical and logical operators in Visualg
Let’s make it a little more Portuguese than it is: If average is more or equal to And average is less than 8. Then the two comparisons must be true so that the whole expression be true, this is the…
-
0
votes1
answer75
viewsA: Creating database in Visual Studio
if I create the database of my project in Visual Studio it will always use the T-SQL language to create the manipulate? It’s not that simple. T-SQL is the default language for stored procedures. But…
-
1
votes1
answer64
views -
6
votes2
answers46
viewsA: Interpretation of Dive into Python on exceptions
You need to read: What are and where are the "stack" and "heap"?. So the functions are called and organized like a stack, and when an exception is thrown, until it is captured by some function, it…
-
2
votes1
answer62
viewsA: Two loop algorithm complexity
The complexity is linear, which is usually represented by O(n). And can be calculated with expression that is already in code, the n complexity is precisely the sum of the sizes of the two arrays.…
computer-scienceanswered Maniero 444,682