Posts by Maniero • 444,682 points
6,921 posts
-
3
votes1
answer4068
views -
6
votes5
answers15940
viewsA: How to create a directory in Python?
The right way to avoid running condition would be: import os try: os.makedirs("./temp") except OSError: #faz o que acha que deve se não for possível criar I put in the Github for future reference.…
-
3
votes2
answers91
viewsA: Using a variable as a C file name
You need format the string to put the value of the variable inside it. You can even concatenate string, but it’s a scam*. I wouldn’t make a loop infinite, just a big one. It’s not to have…
-
6
votes2
answers417
viewsA: Is using HTML5 tags as CSS3 switches a good practice?
Objectively it does not have to use. The use is only necessary when it has a technical reason, has a purpose in why it there. To better understand have some readings: What is the purpose of the "id"…
-
5
votes1
answer64
viewsA: Enum is expanded by the compiler into a class statement?
It can be understood that a Enum is a class with special features. The compiler will always treat this type in a specific way. It has optimizations for some scenarios such as the use of bits, it is…
-
6
votes1
answer1153
viewsA: What’s the head of the chain list?
It is the initial address of the list, it is the first element that is necessary to know where to start walking through it. This information needs to be in the data structure (the instance of the…
-
12
votes2
answers1281
viewsA: Good practices in declaring variables in a for
Good practice So I can say that either you didn’t understand what they said about declaring variables, or they taught you wrong, and that happens a lot. I really see a lot of things that made sense…
-
5
votes2
answers1267
viewsA: Variable declaration before the main() function and after the main() function in C
int number = 0; int main() { printf(" The number is %d\n", number); return (0); } Here number is a global variable. It has lifetime across application and visibility, scope within the entire file…
-
23
votes1
answer639
viewsA: What happens when we call a function?
Introducing I don’t know if you know, but every C code is compiled for a machine code that will instruct the processor to do something. This machine code is ideal for the computer, but difficult for…
-
1
votes1
answer172
viewsA: Function return type for a chained list
The first may be well suited because it probably modifies pessoa with the new element and do not need to return anything. The second is only useful if you are not changing the data structure or if…
-
28
votes3
answers10445
viewsA: React Native or Ionic?
You should know that they both try to solve the same problem of facilitating development cross-Platform using web technologies. React Native tends to be faster because it uses the native components…
-
4
votes1
answer172
viewsA: When to use a scripting language?
That’s not how you respond, and, yes, you’re a little "paranoid" about performance. It should be analyzed, there should be criteria, but the concern should be in the real case. What gives most…
-
6
votes1
answer247
viewsA: Is my code object-oriented?
As far as can be done PHP object orientation, the class Post is well OOP, just not anymore because it is not using inheritance and polymorphism, good. There is encapsulation and some abstraction.…
-
9
votes2
answers2784
viewsA: What is the argument limit of the IN operator in SQL Server?
There is no set limit in documentation and I could not find an answer that determines the exact size, so we can consider that there is no specific limit. It is certainly not unlimited, but the limit…
-
20
votes2
answers1267
viewsA: What is the difference between String[] args and String args[]?
None. It is only a permissiveness of the language to write in both ways. A (String args[]) is to facilitate for those coming from the C or C++ and is accustomed thus, the other (String[] args) is…
-
2
votes1
answer152
viewsA: "Output" with special characters
Probably need to use a setlocale() to allow the use of accented characters. #include <stdio.h> #include <locale.h> int main(void) { int positivo = 32767; int negativo = -32768;…
-
5
votes1
answer79
viewsA: Type modifier: Type modifier
Essentially it is no longer needed. Compilers are able to decide when to put in the register better than the programmer. Its use can even prevent some optimizations that can bring better benefit. In…
-
3
votes2
answers206
viewsA: Where to place the View Model rule
I agree with Gypsy that the approach looks good, it just wouldn’t do the private default constructor since every time you create a constructor with parameters, the empty default constructor is…
-
3
votes1
answer87
viewsA: Why can I access normal functions before the declaration, but not anonymous functions?
In accordance with answered about PHP the compilation is done in two steps. Unlike the normal function that is a statement, the anonymous function is part of the algorithm and is not analyzed in the…
-
11
votes1
answer120
viewsA: Why in PHP is it possible to access the functions before the line they were declared?
I can’t say with authority about the exact functioning of PHP, but I know about compilers (an interpreter is still a compiler), and everyone I know who allow the function to be called before it is…
-
3
votes2
answers2268
viewsA: What is the difference between Tolistasync() and Tolist()?
The method with Async in the name is asynchronous, ie it has ability to run without locking the current run line, so if it had been called in the correct way soon after its inception the code could…
-
4
votes1
answer161
viewsA: Is it possible to copy files without using a stream buffer?
In my conception, after some evaluation, if I understood the question, is not possible. The copy without the use of buffer is possible using DMA, so it doesn’t even go through your memory. This…
-
2
votes1
answer70
viewsA: Factor numbers from 1 to 9, accumulating variable printing wrong number
I won’t touch the structure of the code much, but I will write in a way that is readable and in a more correct style. The problem is the for. The numbers placed there appear to be random. The first…
-
3
votes2
answers1169
viewsA: Value-finding function between Javascript variables
I’m going to make an improvement on the original code, but I don’t think it’s ideal, I just don’t want to change its structure too much. You can test, it’s working as you wish. You don’t need to…
-
6
votes1
answer658
viewsA: Can C++ and C# be used using C programming?
No compiler reads all three, even those working with C and C++, or compiles C or compiles C++. If you are compiling C++, almost everything you do with C syntax will work because the language has…
-
3
votes1
answer61
viewsA: How does the operating system distribute the processor across the various programs?
Introducing Almost always the operating systems allowed to work like this. Of course some do not, but do not need to have multiple processors, physical or logical, so that various processes or even…
-
5
votes2
answers510
viewsA: Create class instance in threads
Object instance is object instance. Thread is thread. Except for the fact that a thread is a specific object, one thing has nothing to do with the other. Threads are finished when no longer being…
-
3
votes2
answers607
viewsA: What is the difference between initializing a constructor or doing attribution within the constructor?
In this example it is indifferent since int does not have a default constructor. Construction is done directly by the compiler in the assignment. It would be different if the member type to be…
-
9
votes2
answers3616
viewsA: What is the difference between a file . c and . cpp?
Nothing requires to be, but by convention, until usually understood by default by some compilers, that .c be C language code files and .cpp is for C++. Just like many people use .h for C++ header,…
-
1
votes1
answer100
viewsA: Nested for conversion to threads
Try this: Parallel.For(0, original.Height, j => { for (int i = 0; i < original.Width; i++) { Color corOriginal = original.GetPixel(i, j); int escalaCinza = (int)((corOriginal.R * 0.3) +…
-
4
votes1
answer382
viewsA: What is the difference between reverse list (Inverted index) and reverse list (Reverse index)?
Reverse index As far as I understand, it is only the index with classification contrary to what is natural, ie from the highest to the lowest. I may be mistaken for lack of a larger context where…
-
3
votes2
answers81
viewsA: Is it possible to make Postgresql database data visible or not, without erasing it?
You can do this in the application. You can create a column with a status to indicate that the row is disabled and does not show anywhere. Or you can use an existing column to specify this.…
-
3
votes1
answer1026
viewsA: Does the scanf record string on pointer that does not have a defined size?
Run X right Understand that C lets you do everything, and requires you to take responsibility for everything. This is both a positive and a negative point of language. She is close to Assembly. So…
-
9
votes3
answers3964
viewsA: What is Threadpool all about?
Is a set of threads ready for use. They are not usually released, and are available there (in Idle) for recycling. In fact the process of creation and destruction is a little more complicated than…
-
4
votes2
answers2545
viewsA: Move file list between folders
The first big change to make is just move the file and not copy it, that’s a huge waste of resources. You can just ask the operating system to rearrange your file system organization without even…
-
10
votes5
answers3128
viewsA: What is CDN and how do I enable it in my Javascript files?
IS Content Delivery Network or content delivery network. In fact it is used more for static content. In general it is a worldwide network of data centers (points of presence) that makes a "kind of…
-
1
votes1
answer116
viewsA: How do I collect a String and use it in an if?
First, you have to organize the code, not just throw everything anyway. Second, to compare a variable with a text is only possible if this text is expressed in its literal form, that is, it must be…
-
17
votes1
answer1515
viewsQ: What is the difference between ordered, unordered and Sorted?
These terms are used in some data structures to define how elements are inserted and maintained, which means each? Sorted and ordered wants to say the same thing? Unordered means it’s random?…
-
18
votes1
answer1515
viewsA: What is the difference between ordered, unordered and Sorted?
Ordered Or ordained, means that the structure’s data collection is in some order. In general this means that the input order is used. But it is not defined that it is exactly so, only that it has an…
-
5
votes2
answers229
viewsA: What does the PHP "new" actually do when instantiating a class?
It has no other function, it is used to indicate that you must create an object and call the builder. I mean, you’ll call the __construct(). In a static class it should not have one, but if it has…
-
2
votes3
answers1381
viewsA: What is the difference between Data Annotations and Fluent API?
The mechanism of attribute has always been very limited. It is solved all in compilation and used with reflection, which prevents doing much. In addition, the annotations available in the Entity…
-
8
votes2
answers502
viewsA: What is the difference between "String(1)" and "new String(1)" in Javascript?
A basic difference is that the String(1) acts as type by value and the new String(1) works as a type by reference, since it is an object. This gives difference, because if you have two strings of…
-
21
votes2
answers1906
viewsA: What is the View in the MVC standard?
What is the View in an MVC model? View is the presentation of data, is the output, is how the user will see what was produced by an application action, and is how a data entry will occur and…
-
9
votes2
answers202
viewsA: Which is faster to read and edit, a database or a . txt?
A text file flat It’ll always be faster, he doesn’t have to do much of anything. A database performs a monumental set of things to ensure data integrity and do this in an easy and standardized way.…
-
4
votes3
answers155
viewsA: Access a property’s value through a String
You can see that you understand that property names are just texts as keys to a array associative. They are different properties at different levels, so one should access as different keys. var…
-
7
votes1
answer201
viewsA: Does the keyword "async" really make the asynchronous method?
In fact declare a method as async does not guarantee anything. This is saying to the compiler only that the method can be called asynchronously, ie it can be used with a await. This is the command…
-
13
votes1
answer1374
viewsA: What is the difference between a statement and an expression?
Statement Statement to statement is usually an imperative way of saying what the code should do. Roughly it’s a command. It generates a "execution". The word in English does not quite indicate what…
-
4
votes1
answer821
viewsA: Reduce a string in C language
Like strings in C end with a null, just put a null right after the text that should stay. How to know that what should disappear are the last 4 characters just put the terminator in the size of the…
-
4
votes3
answers73
viewsA: Field inside a variable dynamically?
If you want to insist on it you can do something like this: var img1 = false; var img2 = true; var img = eval("img" + 1); if (!img) console.log("ok"); But avoid using the eval(). The right thing to…
-
4
votes3
answers312
viewsA: Transform a string into multiple substrings whose contents are between apostrophes
Obviously you have an apostrophe to use as char would have to escape it to not confuse the compiler and mix what is character delimiter and character ('\''). But since you have more than one…