Posts by Maniero • 444,682 points
6,921 posts
-
25
votes4
answers33277
viewsA: Using the keywords Throws and Throw
Checked Exception throws is part of the method statement, of his signing. It defines part of the API. It indicates that a chunk of code that calls this method must necessarily capture a possible…
-
22
votes3
answers96047
viewsA: What is the use of a static or final variable in java?
How are you using private I will understand that you are talking about fields of a class and not variables. A static field is the one who is available in a unique form class for the entire…
-
12
votes1
answer2703
viewsA: What are the recommended values for Mysql database (id, user, password and email)?
It seems to be talking about the structure configuration of a table and not the values of a table. The correct concept helps to understand the problem. You need a lot more information to be able to…
-
13
votes4
answers18454
viewsA: How to replace a certain string within another string in Javascript?
The simple form is through the function replace() type string. Documentation in English. var linha_nova = "EU TENHO UM CACHORRO"; var linha = linha_nova.replace("UM", "MEDO DE"); console.log(linha);…
-
5
votes2
answers634
viewsA: How to group text file according to first line parameters in C#?
As an example in this answer, a dictionary is the solution for grouping items. In case you now have two levels of grouping, then the use of nested dictionaries is necessary. You have the dictionary…
-
6
votes2
answers281
viewsA: Yield Return inside a using
I don’t know if there’s any other implicit issue, but if it’s just this, there’s no problem with the yield return. He is still one return. Generally speaking, there’s no way the routine can go past…
-
6
votes4
answers1315
viewsA: How to group code and add existing amounts in text files with C#?
I adapted to previous answer for this case. I haven’t thought of all the possibilities. You have not given criteria to solve file malformation problems, if there is how to validate the codes and…
-
8
votes4
answers2855
viewsA: How to merge multiple text files into one?
As the approach does not seem to be good, I decided to make a compilable example that would solve the problem in a generic way. using System; using System.IO; using Util.IO; public class MergeFiles…
-
42
votes4
answers6910
viewsA: How does namespaces work in C#?
Function Namespaces are confused by many programmers. There are two useful understandings. First to organize your types logically. It is as if you put certain types (classes, structures,…
-
30
votes5
answers2270
viewsA: Using unused affect performance?
Understanding the using and the namespace First let’s make it clear that there are two types of using in C#. There is the statement which is used for resource completion. See a little more in that…
-
35
votes2
answers1067
viewsQ: Is there a problem using Unicode characters for code identifiers?
Today it is common for compilers of programming languages to allow the code file of their programs to accept code with Unicode characters. This is useful, especially for those who use Portuguese and…
-
25
votes3
answers1710
viewsA: What is the role of architecture standards in object orientation?
I will add another approach to what has already been said. What is a design standard and the [not] relationship with OOP. Architectural patterns or design patterns, the famous Patterns design, in a…
-
42
votes6
answers10591
views -
75
votes1
answer19312
viewsA: What’s the difference between Struct and Class?
Summary Structs are types by value (Section 11.3.1). All kinds struct implicitly inherit from the class System.ValueType (Section 11.3.2). Assignment to a variable of type struct creates a copy of…
-
23
votes6
answers8712
viewsA: How and when to use Finally after a Try?
Other answers have already answered the most important question. Complementing, the most common use for the finally is the cleaning of resources. When you use a variable declaration with using is…
-
25
votes3
answers1131
viewsA: String and its efficiency
I decided to answer because one of the answers is right in its essence but gives a wrong reason for slowness. How is a string Is correct the idea that a string in Java (the same goes for C# and…
-
64
votes2
answers5844
viewsA: Coffeescript, Typescript and Javascript
Ecmascript This language that everyone calls Javascript actually is the Ecmascript. Her best known implementation is known as Javascript, so everyone uses this name. It is the first implementation,…
-
6
votes3
answers910
viewsA: Error in fgets function
#include <stdio.h> #include <stdlib.h> #include <string.h> int main (int argc, char **argv) { FILE *fp = NULL; char f_name[100]; switch(argc) { case(1): fgets(f_name, 100, stdin);…
-
17
votes2
answers4380
viewsA: Linux C programming - IDE vs. editor + command line
Most of what I will say is for any language. I will make reservations when necessary. I understand you’d like to see a comparison between a IDE complete and the option to use a simpler code editor…
-
45
votes2
answers6578
viewsA: Business Rules in the Database - what are the advantages and disadvantages?
Perks It’s all in one place. It’s easier to maintain. Can performance gains. Software is optimized for this. Serves many applications using various technologies and languages without problems. Even…
-
8
votes2
answers4464
viewsA: Getting the full path of a client file in ASP.NET
After several changes in the initial proposal of the question I have to say that it is not possible to pick up the path of a local file in a browser on a service that is on a server except for an…
-
225
votes4
answers41133
viewsA: What are they and where are the "stack" and "heap"?
One stack (or stack), in this context, is an optimized way to organize data in memory allocated in sequence and abandoned (yes, there is usually no misallocation) in reverse sequence to the input. A…
-
12
votes2
answers949
views -
14
votes3
answers17303
viewsA: What is the best way to read an XLS file?
What is the best way I can not say, because what is best for one case can be worse for another. I can give options. In addition to the method already cited by Reiksiel, there are some other options:…
-
25
votes3
answers1858
viewsA: How to know the right measure of comments?
Documentation Although the posted example officially calls it a documentation comment and has a comment semantics even, that is, the compiler in its normal operation ignores it completely, consider…
-
67
votes3
answers5608
viewsA: What does "immutable" really mean?
Variable X value Values may be changeable or immutable, variables that contains values are always, by definition, mutable. Variable refers to something that varies, that changes, that is mutable. It…
-
26
votes2
answers5203
viewsA: Methods and properties in C# - advantages and disadvantages
To initial recommendation is always use the existing resource in the language until there is a reason not to use. Functioning of the property Understand that a property is just syntax sugar, i.e.,…
-
24
votes2
answers2225
viewsA: Compile string as code
Well, it’s already possible to generate arbitrary code and run it at runtime. But not in a simple way, not in this fluid way. You already had reflection or introspection as some prefer to call in…
-
64
votes3
answers57228
viewsA: What to use require/include/require_once/include_once?
The difference between include and require is how an error is dealt with. require makes a mistake E_COMPILE_ERROR, which closes the execution of script. The include only produces a Warning which can…
-
4
votes1
answer1677
viewsA: Direct printing on the door
I can’t tell exactly to your printer because I don’t know you but essentially you need to write directly to the door, normally PRN or LPT1 or COM1. Sending directly to the port avoids going through…
-
30
votes1
answer1329
viewsA: Is it good practice to make an exception in these cases?
Good practice First, it is a "good practice" to do what is right and not because something is good practice. And what is right depends on the situation. What people often call good practice is what…
-
29
votes1
answer1280
viewsA: Differences between declarative and imperative form of LINQ
Performance I’ll put another form of the program that measures performance: using System; using static System.Console; using System.Collections.Generic; using System.Linq; using System.Diagnostics;…
-
15
votes2
answers5714
viewsA: How does it work and use the Stack in C#?
I won’t repeat what the Miguel Angelo well said. A stack is so called by in abstract concept. It is evident that physically in memory there is no data being stacked anywhere. A pile or stack is a…
-
5
votes2
answers2674
viewsA: Receive indefinite amount of parameters in C#
Lucas Nunes' answer is correct and well completed. I will only offer alternatives that can be useful to other people today and in the future. It may not be necessary to have a completely…
-
11
votes1
answer1238
viewsA: Does C# support GPS?
C# itself does not have this support. There are libraries for working with GPS that work with C#. But what it seems that you are accessing the API of some service that informs the location of a…
-
29
votes2
answers7111
viewsA: What to do if client can be both PF and PJ?
First: why does it need to be object oriented? There will be some gain in this way? PJ and PF are separate entities The second approach is completely wrong since if the client is a legal person he…
-
47
votes5
answers2269
viewsA: Is Nosql as troublesome as it seems?
First I ask you: have you done complex operations like Nosql? Have you properly measured performance in all situations? Right tool There is a popular expression that everyone knows: "If the only…
-
25
votes1
answer671
viewsA: Visual Studio 2010 lag
You plan to use VS 2010 material and install and use VS 2013? Using the 2013 If so, it is not to be so problematic. Of course they are different, but essentially they do the same thing. You will…
-
39
votes2
answers4996
viewsA: Memory allocation in C# - Value types and reference types
The location at which memory allocation is made is only determined by its lifetime and not by the data type. In C# there are instances of two forms of values: value types (the value itself) and…
-
21
votes3
answers1436
viewsA: How does method management work in C#memory?
Summary State (fields) and behavior (methods) are distinct things and are in different memory areas. A method is not part of the internal data composition of a class or structure. Method is just an…
-
133
votes7
answers5450
viewsA: How to write easy-to-maintain, readable code?
First to be objective I have to suggest something subjective. Teamwork You say "make it easy for anyone to touch the code after". That "who" is very important. As much as you have a correct way of…
-
24
votes5
answers573
viewsA: Why are you wearing shorts?
In general there is no reason to use a short in applications, especially on . NET. A case to use is if you have a volume much large numerical data within the range that fits into a short (-32768 to…
-
10
votes4
answers1531
viewsA: How to assign a value to an Enum with binary notation?
The C# 7 has native binary representation syntax. You can use: int x = 0b0111_0100; You can even use separators for easy reading. Separators can be used in other numerical representations as well.…
-
49
votes4
answers9003
viewsA: Best way to deal with Exceptions
Attention, I will make some simplifications below, the space does not allow to talk about everything that the theme asks. And mostly I will use the words "generally" and "probably"a lot. There are…
-
42
votes3
answers19793
viewsA: Functional Programming and Object-Oriented Programming. What are they and what are their main differences?
The mgibsonbr response is excellent and I could not have done better. I’ll just put something a little different: Functional OOP Based on mathematical functions Based on forms and behaviors of…
-
32
votes2
answers6682
viewsQ: What would be the way to validate the CPF checker digits in a DB using only a SELECT?
Finding information on how to calculate the CPF check digits is not difficult. Any Google search gives numerous results. Most are reliable and even have a well respected source which is the entry on…
-
217
votes4
answers41133
viewsQ: What are they and where are the "stack" and "heap"?
What are these such stack and heap that so much is said about memory management? This is actually portions of memory as some people speak or is just an abstract concept to facilitate understanding…
-
61
votes5
answers7848
viewsA: What is the difference of string vs string?
It has already been said that string is just one alias for the guy String. To be clear, there is no difference in performance or how the code is generated. There is exactly zero difference in the…
-
37
votes8
answers3054
viewsQ: When to use Waterfall and when to use Scrum?
There is a clear way to determine when a software development project should be conducted using a methodology Waterfall or use Scrum? What criteria should be observed to choose one or the other?…
-
12
votes3
answers1569
viewsQ: How to create multiple entries in an index based on columns in the same row?
I have never found a good way to index multiple columns of a row as index entries or simulate this feature in Mysql. The problem arises when you have fields working as tags or a similar concept.…