Posts by Maniero • 444,682 points
6,921 posts
-
2
votes2
answers1578
viewsA: How to change position of all matrix elements by changing the row number by the column?
If you want to do inline just start checking the column from the stopped row. The problem is that if you start from 0 it reverses what has already been reversed, then back to the original place. So:…
-
2
votes1
answer65
views -
7
votes1
answer601
viewsA: What’s a B tree?
A tree is a data structure in a hierarchy system with a root, branches and leaves, that is, starting a point point will open different paths according to the data, until arriving at the data you…
-
5
votes2
answers1028
viewsA: How to query containing MAX and COUNT via LINQ
To query Are you sure? Is that what you want? Then in LINQ you will use Max(), Count() and GroupBy(). I can’t guarantee the exact way, but it’s something like this: var query = from s in…
-
4
votes2
answers6999
viewsA: What is generalization and specialization?
We can talk about the term in several contexts, even if we stick to object orientation at least in two situations can be used. In the inheritance the accepted answer already says well what is.…
-
5
votes2
answers335
viewsA: How to validate a wrong typed data?
In my opinion the booklet suggested in the other answer is a bad place to learn, she is one of the responsible for many people programming badly. Teaches bureaucratically, without structure and…
-
12
votes2
answers670
viewsQ: What is it, Prism?
What kind of Prism is that? Is it eating? Or programming? I’ve never heard of it. Tag: prism I don’t want to know everything, but basic information about what this is.…
-
3
votes1
answer179
viewsA: How does class inheritance work in C#?
Inheritance is a mechanism for reusing code, whether algorithms or data structures. Well roughly the inheritance makes a copy of the class it inherited and sticks to this new one, so everything in…
-
4
votes2
answers265
viewsA: Should I use a variable that takes an HTML element as global or local?
Behold Global variable in Javascript and Why using global variables is not a good practice?. So always use local variable. Although this is a case to think about if global is not advantageous. If…
-
40
votes2
answers45560
viewsA: What is the correct way to use the float, double and decimal types?
Non-integer numbers can be implemented based on binary or decimal. The shape can be with dot floating or fixed. Of course you can in other ways too. At the fixed point the type already indicates how…
-
6
votes2
answers112
viewsA: What is the best way to monitor a value in a database?
A Tigger is the only valid option if you want accurate notification. Something that runs from time to time may work in some very specific scenarios, but "always" will have a lower performance.…
-
5
votes4
answers258
viewsA: How is this operator not working in this code?
if I’m denying a false variable, it flips true correct? No, you are reversing the value contained in the variable, you do not change the variable. There I am saying, while i is smaller than the…
-
4
votes1
answer569
viewsA: Uninitialized variable used in this function?
There is no reason to pass the variables if soon after you will discard their values, when you are doing it without value cause this problem. The code can be greatly improved, understand everything…
-
1
votes2
answers3402
viewsA: Error: Not all code paths return a value
I made an improved code within the C standards#. I also commented that you need to implant the pattern Disposable in the connection class to ensure that the connection is closed even if an exception…
-
11
votes1
answer1944
viewsA: Is it possible to delete a folder inside a repository directly from the Github site without using Git?
Enter the file and click on the recycle bin as marked below: In theory this is the same as another Git client doing the removal and should keep track that a removal took place as if done by Git. Of…
-
7
votes4
answers1193
viewsA: Which DBMS to use so that it can be installed on the client’s computer to run a C#application?
Under the scenario described, the solution would be Sqlite, it does not need to install, will embedded in the application itself. Some people use the Localdb, but it is usually less suitable than…
-
8
votes3
answers2510
viewsA: When not to return Task in async methods?
I don’t know give many details without researching further, but everyone considers it a mistake to exist the return void in a method async. There is a different way to deal with exceptions that…
-
3
votes2
answers222
viewsA: PDO and mysqli are the only options to work with PHP database?
The PDO uses the native mechanisms of databases to access them. PDO is just an extra layer that provides little or no advantage over the original mechanism. Surely there is the downside of the extra…
-
5
votes2
answers9527
viewsA: Set Difference and Get in object-oriented programming
Assuming you want to know about a property or prefix method set and get, this pattern is used to abstract a state that must be internal to the object. They are used as facilitators in cases of…
-
6
votes2
answers4812
viewsA: How do I check if there is a special character or number in a string in C?
Some things can be improved and I commented on the code because I did better. From time to time I adopted the posture of teaching C in C. I think it is wrong to use C and program as if I were in…
-
8
votes1
answer148
viewsA: What is the importance of the interface in this particular code?
In this specific example it apparently has no role. Too many abstract examples do not teach the use of something, except in rare cases. The example may be fictitious, but when you analyze whether…
-
4
votes1
answer168
viewsA: How to skip all breakpoints without removing them?
Menu Debug -> Disable All Breakpoints Other than that, just erasing or in some cases not letting in where you have breakpoints with F10 or may terminate the execution of the current method with…
-
13
votes3
answers1793
viewsA: How to divide integers and get value with decimal part?
This is about typing. You’re splitting 2 integers, so you get an integer, if you want a result that’s not an integer, you need to split numbers that aren’t integers, you can make a cast, it’s safe…
-
14
votes2
answers1084
viewsA: How to use Traits in PHP?
There’s a question here that talks about the basics of trait. And also when choosing to use each structure. PHP actually allows you to use trait directly, but this is conceptually wrong. It’s PHP…
-
4
votes2
answers108
viewsA: If you are not checking the condition correctly
First, if returns nothing, it just decides what to do based on the expression contained in it. Floating point number does not provide accuracy, then its equality occurs in some cases, but not in the…
-
3
votes1
answer1522
viewsA: Change number of digits after comma depending on the situation
You have to use the %g. Behold all possible formatting. #include <stdio.h> int main(void) { printf("%g\n", 310.0); printf("%g\n", 310.1); printf("%g\n", 310.12); } Behold working in the…
-
3
votes2
answers475
viewsA: Untreated exception (index based on 0)
There is a more modern way to do this that does not cause this kind of error. Make use of interpolation, is much better. I took advantage and improved other things. See nomenclature standards used…
-
8
votes1
answer386
viewsA: Is it possible for a program to modify its own code?
First, you don’t need to change the code to avoid repeating the learning. I have no deep knowledge about AI, because it’s a lot more complicated than people think it is, but I know learning isn’t…
-
1
votes2
answers282
viewsA: Sum the random data
The question is a bit confusing, but given the accepted answer there is a very simple way to solve this. The array has no function in this algorithm, so just kill it. Also has too variable: int soma…
-
2
votes1
answer163
viewsA: Is it possible to have an operating system with multiple kernels?
If you are asking this you and your team are far from making a simple operating system, plus still a complex one like that. Keep in mind that no one did this not because they did not have the idea,…
-
4
votes1
answer118
viewsA: Is there any other reason to compress Javascript in the source code besides getting smaller?
People think that so no one will understand the wonderful code she wrote, which is still true, makes it a little difficult. In general, people who do this for this purpose usually don’t write such…
-
12
votes4
answers299
viewsA: What does the "do" function do in Javascript?
The same as in other languages, it is just a flow control. It is a marking for a loop to know where it starts. It is considered a label. Note that it is not a function, it is a keyword that…
-
3
votes2
answers6394
viewsA: Sum of even numbers and multiplication of odd numbers in a range
I was almost ready when I had to stop. I’m posting anyway since it has the code running and more organized and simplified. The main error was not initializing the variable impar with value 1. Two…
-
4
votes1
answer339
viewsA: Use IN or multiple OR? Which one performs better?
The IN is an internal implementation and can be better optimized. It should not have gained large, but it is to be faster for a large comparison list. But in general the choice should be based on…
-
4
votes4
answers2496
viewsA: Performance of COUNT(*) and COUNT(1)
Which database are you talking about? Which database? When it comes to performance, it is difficult to make definitive assertions. You can change according to the implementation, then SQL Server can…
-
7
votes3
answers321
viewsA: Why give new in class attribute?
The main reason to use it is equal to that of C++, indicate that an allocation in heap must be performed to support that object, then the variable present there will receive a pointer to the…
-
1
votes1
answer398
views -
3
votes1
answer110
viewsA: Does "Join" make the search faster?
It will probably get faster, the database can optimize, and bring less information. Just testing to know. But you need to do correct tests. But whenever you take a lot of information and try to…
-
13
votes1
answer489
viewsA: Why does the compiler require local variables to be initialized and fields not?
I couldn’t use it better reference than Eric Lippert: Use null in a local context most likely is a bug, and in this context it is easy for the compiler to detect and inform. I disagree somewhat with…
-
8
votes1
answer1301
viewsA: What is Harvard architecture?
There are two main differences for von Neumann architecture: Code and data are considered very different things and are managed separately, in different locations. Control of architecture…
-
9
votes2
answers259
viewsA: Optimization of multiple ifs into something more practical
If only lower case letters can make one array with 26 positions and keep in them according to what you find. In *string - 'a' is a calculation to find out the position of the array. You can almost…
-
5
votes2
answers1335
views -
42
votes2
answers2688
viewsA: Why do you usually declare a variable with default value?
General In some languages there is no initialization, is the case of C, there have to do manual. In C there is a raw access to memory and if the programmer does not take care of the initialization…
-
13
votes3
answers948
viewsA: What makes a JOIN bad in a database?
Linq’s witty comment (Jéf Bueno or whatever name he uses now) is true. A part of the problem is realizing the JOIN where you don’t need it. It’s an automatic mechanism that can fetch things you…
-
6
votes1
answer1113
viewsA: Problem with switch menu case and while
The switch has something called fallthrough automatic, ie it is not deleting, it will execute all options if the code leaves. To change this behavior need to put a break at the end of case, so it…
-
20
votes2
answers1336
viewsA: What’s the difference between "Compile time" and "run time"?
The Compile time or compile time is all that occurs during the compile process, all that can be detected, generated, optimized, performed when the code is being compiled. In general it is where one…
-
4
votes1
answer86
viewsA: How to know which exception can be cast in C#?
Reading the documentation or using some tool that helps you know which exceptions can be thrown. Although this is not so accurate, why capture Exception it’s not a good idea. If you’re going to…
-
2
votes1
answer1118
viewsA: Decimal to binary conversion in C language using ASCII table
The code is confusing, does a lot of unnecessary things. The question is extensive, but little useful information. One of the reasons you have difficulty is the code is too complex. Even the most…
-
5
votes2
answers1038
viewsA: How to omit parameters in the actual parameter passage?
The only thing that is wrong in your attempt is that the value default need to be in the statement and not in the implementation. So: minhaFuncao(int, int, float = 0); //declaração minhaFuncao(int…
-
10
votes3
answers329
viewsA: What are "code units"?
There it was purposely left vacant. Probably the smallest unit of code is the function, but I have doubts without any exceptions, who knows a lambda which is practically a function. It is also a…