Posts by Maniero • 444,682 points
6,921 posts
-
49
votes3
answers8111
viewsA: Nomenclature standard in code for C#
Adopt the same uppercase pattern of . NET according to the table below. When using acronyms, prefer to keep only the first letter capitalized for easy reading. The member being static, constant or…
-
6
votes1
answer296
viewsA: Differences between traits and namespace for loading
Namespaces are used to group, encapsulate functionalities. It is basically used to avoid name conflict. It works as a surname for your members, so you can have two Joãos in its application provided…
-
128
votes7
answers26094
viewsA: What is the difference between parameter and argument?
Parameter is the variable that will receive a value in a function (or method) while an argument is the value (that can originate from a variable or expression) that you pass to the function (or…
-
22
votes1
answer4728
viewsA: What is technical debt?
We can resort to wikipedia article to have an acceptable definition. Roughly speaking, all the activities inherent in development, but not directly defined functionalities in the project, are left…
-
5
votes2
answers280
viewsA: Pass two parameters to a function that accepts only one parameter
You are not passing two parameters. There is no way to pass more parameters than the accepted method. You are making a mathematical expression with two operands and passing the result as parameter.…
-
8
votes3
answers25526
viewsA: How to delete a character within a string?
You cannot enter a null character in the middle of a string. This will indicate the end of it even if you have other relevant characters after the null, they will not be accessible in normal ways.…
-
12
votes1
answer898
viewsA: What is the difference between puts() and fputs()?
It’s not a question of being better, it’s a question of where you need the writing done. puts() writes to the console, while fputs() writes through a previously opened file handler. see function…
-
6
votes3
answers1631
viewsA: Concurrency control in database insertion
From what I understand, roughly you’re experiencing what’s called race condition. In a race condition you start an operation and get some result. During the process or at the very end of it,…
-
36
votes3
answers72012
viewsA: Global variable in Javascript
Are you sure you want to do this? It is not a good indication. It is always preferable to find a solution to pass this value in some other way. At least encapsulate in a global function. If you…
-
7
votes2
answers2337
viewsA: How to make "Replace" replace all occurrences of a word without taking uppercase or lowercase?
You can use the Regex.Replace(). Something like that: string str = "Hello WorLLd"; //Substitui só os 'l' e não o 'L' str = Regex.Replace(str, "l", "EL", RegexOptions.IgnoreCase);…
-
16
votes2
answers256
viewsQ: How to solve special situations of unnatural value for a domain?
The question has a slightly more conceptual bias, so I’m going to use a simple generic example. There are cases where some column may be in a special situation, this because an information: is not…
-
22
votes1
answer2914
viewsA: Indexes in Mysql queries
For this query specific will use index if there is an appropriate index for it. This index should include columns status, account and data. Preferably in this order. There is no reason why Mysql…
-
1
votes1
answer474
viewsA: How to "call" an ASP.NET page without using IIS?
You can use the OWIN to have an HTTP server embedded in the application without having to install anything extra. On the page linked has the initial information and other associated technologies…
-
5
votes1
answer104
viewsA: More efficient way to use "Expression" in enhanced "for" cycles
Always the best way for you to figure this out is to measure. What may seem one thing in theory can be shown another in a specific real case. In fact this can be considered premature optimization.…
-
12
votes1
answer9094
viewsA: How to read folder and subfolder files?
If you are using at least the . NET 4.0 basically you need it: Directory.EnumerateFiles(fbd.SelectedPath, "*.*", SearchOption.AllDirectories)) Documentation Or you can use since version 2.0:…
-
2
votes1
answer195
viewsA: What is the size and coordinate measurement difference in C#Forms
The x and y coordinates are not the pixel distance of the upper-left corner of the screen? They are relative according to the size of the parent object? Yes, that’s it. x, y 0.0 means the top left…
-
31
votes5
answers680
viewsQ: What to do when a UI element cannot be used by a user?
It is common for a user not to be able to use all the elements of the interface. This can occur permanently (or semi-permanent, since some configuration or change of permission can change this) or…
-
10
votes3
answers392
viewsA: String contains a certain word
You can use the functions match or find to find the string you want. Both return a boolean value indicated by the presence of string string.match("oi\ntchau\nhi\nbye", "hi") Documentation match()…
-
33
votes1
answer522
viewsQ: Does the size of a function affect memory performance and consumption?
Does the fact that a function is higher or lower affect the performance of the application? Especially in PHP. If you need performance, it would be better to perform large or small? And memory…
-
34
votes1
answer522
viewsA: Does the size of a function affect memory performance and consumption?
At all times can affect performance. It depends a little on the technology used. Language, implementation. The same goes for memory consumption. But this "can" is relative. I will avoid talk about…
-
17
votes6
answers1673
viewsA: Big job or small job?
Since I started developing software (a long time ago) I see people talking about ways to evaluate when a function or method is too big. I bought all these shapes up to one day. This is normal, this…
-
4
votes2
answers1036
viewsA: Dictionary in C always returns "word not found"
I believe it was just an inattention. #include <stdio.h> #include <stdbool.h> struct dicionario { char palavra[21]; char definicao[51]; }; bool compararpalavras (const char palavra1[],…
-
6
votes1
answer702
viewsA: Command to display a record limit in a table
SELECT * FROM locacoes ORDER BY titulo LIMIT 9, 10; I put in the Github for future reference. It doesn’t have much information but it’s probably this. In this case does not use the WHERE because you…
-
5
votes3
answers25430
viewsA: SQL command to display specific records from the "id" field
Basically the same as your previous question. Only now uses the OR to select more than one, namely 22 OR 23 OR 25 OR 27, any of them will be selected. SELECT * FROM tabela WHERE id = 22 OR id = 23…
-
4
votes2
answers907
views -
8
votes1
answer3064
viewsA: Difference between null and clear on an Arraylist
Not. As the name itself says the first clears all elements (makes the elements null) and the ArrayList has zero elements (the size is changed) and you can continue manipulating it. It does not mean…
-
9
votes2
answers73740
views -
3
votes3
answers1504
viewsA: Copy file with progress
I found a simpler implementation in the response from Anton Semenov. public delegate void ProgressChangeDelegate(double percentage, ref bool cancel); public delegate void CompleteDelegate(); class…
-
6
votes1
answer625
viewsA: Does using Timer class features (System.Timers) cost a Windows service?
No, class is made for what you want. With it you will "sign an event" with the operating system and a flag will be sent to your application when given the given time and will transfer control to the…
-
6
votes5
answers2310
viewsA: Why are other encodings used besides UTF-8?
Because "ANSI" is more simple and solves most cases. For more details see my other answer on the subject. UTF8 is slower. It occupies more space in most cases. It is difficult to manipulate…
-
6
votes1
answer1941
viewsA: Change the . NET 4.5 project to 4.5.2, how to do it?
If you’ve installed the Microsoft . NET Framework 4.5.2 Developer Pack it’s all right and you don’t have to do anything else. You develop for version 4.5. Version 4.5.2 is just an update in-place…
-
23
votes7
answers1478
viewsA: Is using many interfaces a bad programming practice?
Abstract Class X Interface You started creating the class Pet with common properties among derived classes. Is there any reason not to continue doing this for methods and events? If I pass these…
-
22
votes3
answers1083
viewsA: To what extent is premature optimization a problem?
First let’s understand where the term "premature optimization came from: Premature Optimization is the root of all evil -- Donald Knuth You can see the quote on Wikiquote (and see that the source is…
-
28
votes2
answers31112
viewsA: When to use ANSI and when to use UTF-8?
When to use ANSI and how much to use UTF-8? Strictly speaking when you use UTF-8 is adopting the set of ANSI characters. But I think you are using the term ANSI erroneously. It’s not your fault, the…
-
9
votes2
answers1416
viewsA: What is the behavior of static variables in . NET?
Static data, not only variables, constants and codes as well, are stored in a heap special, called High Frequency Heap. It is an area managed by . NET, but its content is not collected. There is…
-
33
votes5
answers3667
viewsA: Is there any downside to always capturing Exception and not something more specific?
Much of what I could answer here can be found in the answer How to best treat exceptions in Java?. There are several links for other answers that if read together gives a good understanding of the…
-
5
votes2
answers3795
views -
5
votes1
answer256
viewsA: Is it possible to leave the <Summary> in English?
In fact you already know that the hints that Visual Studio shows are obtained in the descriptions of tags <summary> contained in the methods documentation. And you should understand that it is…
-
6
votes1
answer148
viewsA: Reflection Emit, what’s the point?
It is a rarely used resource. "normal" programmer will probably never use it. Essentially it serves to create an CIL. That is, it generates the "machine code" of the .NET. virtual machine. It is a…
-
15
votes1
answer441
viewsA: What is the purpose of Array and String Dereferencing implemented in PHP 5.5?
The example of documentation is unfortunate (what a novelty, right?). In the way it was placed, where everything is constant, there is no advantage at all. The documentation should help understand…
-
33
votes1
answer2772
viewsA: Are unnecessary bank ratings a problem?
Basically it’s because each new index requires more time to update the bank on any change affecting these indices. I’ve seen people suggest doing indices for everything. With only 6 or 7 fields, for…
-
6
votes1
answer293
viewsA: Assembly compatibility and architectures
Each processor architecture has its own assembly language, so it has been since the beginning of modern computers in the 1940s. The only way to better explore an architecture is to create a way to…
-
18
votes2
answers15418
viewsA: Doesn’t Java have multiple inheritance?
Correct conceptualization I think you are looking to know if Java allows multiple inheritance. In it the class can inherit from several other classes, whether concrete or abstract. Abstract classes…
-
23
votes3
answers13425
viewsA: What is an interpreted language? Is Java interpreted?
Interpreting An interpreted language executes the code directly from the source code. Interpretation occurs in a similar way to compilation (translation), that is, it has a process of syntactic,…
-
10
votes1
answer2694
viewsA: Connection to the database with App.config
I think this is what you want: <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="conn" connectionString="Data Source=.;Initial…
-
19
votes2
answers3105
viewsA: What is the question mark in a query?
This is a placeholder for a parameterized query (parameterized query). Is an anonymous parameter for the query. It is used to prevent SQL Injection same, but not only. With it you can’t inject parts…
-
12
votes4
answers1443
viewsA: Should an enumeration be constant in the lifetime of the solution?
Constancy Enumerations are only constants, more precisely a range of constants. Members must be constants and the enumeration must be constant. Some languages define well what is a constant, others…
-
3
votes2
answers159
viewsA: How to control the flow when an invalid value is entered?
If I understand, I think this is what you want: #include <stdio.h> int main() { int auxa = 0, auxr = 0, notas = 0, cont = 0; while (cont < 10) { printf("digite o resultado: "); scanf("%i",…
-
13
votes3
answers6549
viewsA: What are providers? What is the difference between OLE DB and ODBC?
ADO.NET To microsoft documentation tell me what it is. I’ll just summarize. They are components to give access (read) to data coming from a given source, probably a database. There are common…
-
23
votes4
answers5927
viewsA: Why split layers? What are the benefits of a multi-layered architecture?
Not to confuse multi-layer with multi-tier. Of course architectures multi-tier probably only work if the application is multi-layer. The more layers "the better"? I’ll start with the simplest. The…