Posts by Maniero • 444,682 points
6,921 posts
-
6
votes1
answer426
viewsA: Warning compared between floats how to proceed
You really can’t make an accurate comparison with floating point. If you need this accuracy use another type. But if you want to minimize the problem, do a function that performs an approximation.…
-
3
votes4
answers498
viewsA: Full byte type cast
Note that the original question gives a misleading hint of what was actually asked in the contest. Now it’s not very accurate either. In anything, but especially in contests it is essential to have…
-
17
votes3
answers2385
viewsA: How important is the use of the word "this"?
It depends on where. In many places it really doesn’t need to be used. But if there is some ambiguity (same name) between the local variable and the instance variable, how will you know which of the…
-
10
votes4
answers426
viewsA: Contest question: logic error and semantic error?
I would mark answer A and then would appeal first to try to accept my answer, and if it is not possible to challenge the question. Unless, of course, someone officially justified the answer in a…
-
16
votes1
answer721
viewsA: What is dynamic code and static code?
Code analysis is something that looks different from what is being treated. There is static analysis (a compiler-like tool does this in source code) and dynamic analysis that tracks actual code…
terminologyanswered Maniero 444,682 -
3
votes1
answer248
viewsA: ASP.NET vs Intraweb
Of course you can do this. In classic ASP.NET has the Master Pages. In ASP.NET MVC, which is much better, has the layouts or sections or you can create your own components with tags Custom HTML, at…
-
6
votes2
answers5991
viewsA: BIT(1) versus TINYINT(1) for boolean values
According to the documentation no problem, on the contrary. A bit-field type. M indicates the number of bits per value, from 1 to 64. The default is 1 if M is omitted It says you can store 1 to 64…
-
4
votes2
answers3629
viewsA: Error trying to remove a temporary table
It has already been deleted. To avoid the error, check before if the operation can be executed: IF OBJECT_ID('tempdb..#Temp') IS NOT NULL BEGIN DROP TABLE #Temp END I put in the Github for future…
-
4
votes4
answers156
viewsA: How to avoid repetition in LINQ queries?
I do not know if it fully meets what you need because the code presented is very lacking context, would have been easier if you had placed a MCVE. But I think this will do: public static…
-
8
votes2
answers9108
viewsA: How to insert multiple values into an array?
Remember that as everything is private, the class that will inherit this will not have access to these members. Maybe you want to change to protected. You’ll add that to the class Aluno: private int…
-
6
votes3
answers2164
viewsA: What is the use of the two points in Javascript?
In this specific context it is the separator between the name of a member and its value, in the initialization of an object. Is used in Object literals. So in this case the imprime is the name of…
javascriptanswered Maniero 444,682 -
4
votes4
answers7150
viewsA: In inheritance with private attributes, does not the daughter class take its attributes from the mother class?
Private members are always restricted to the class in which they were declared. Even when there is inheritance, they are not accessible to the daughter class. This class even welcomes the private…
-
14
votes6
answers3282
viewsA: Is there a Javascript class?
Ecmascript 6 is the most recent specification of what is conventionally called Javascript has classes. Previous versions work with prototypes that can perform the same in a different way. So they…
-
8
votes2
answers289
viewsA: New C# 6 functionality "Auto-Property initializers" is just a facilitator?
Both the automatic properties available since C# 2 and their initialization available since version 6 are only syntactic sugars. It can even create the property more "manual" and initialize it in a…
-
6
votes2
answers168
viewsA: Clause similar to Mysql LIMIT in MSSQL
SQL Server uses the syntax TOP: $SqlTabelaAtual = "SELECT TOP 1 * FROM BusinessCadTabPreco RIGHT JOIN BusinessCadTabPrecoItem ON BusinessCadTabPreco.CdTabela = BusinessCadTabPrecoItem.CdTabela WHERE…
-
7
votes4
answers4276
viewsA: Should I initialize strings (or objects in general) with null?
In my opinion it should not, objectively, whatever. It’s just that you’re being redundant and I don’t think this is good until you prove to me that in a certain place you’re the best at. Almost…
-
8
votes4
answers1204
views -
4
votes2
answers287
viewsA: Create product classes and photos and initialize
Already know how to solve the problem, I will complement that the ideal is not to make the initialization in the constructor. This should be avoided whenever possible, it is not always. In this case…
-
4
votes2
answers2200
viewsA: What is the difference between SVN and TFS?
It does essentially the same thing as SVN does, but in another way. You’ll have to learn all of its flow and specifics. You can’t say everything in one question, but specific questions are welcome.…
-
4
votes2
answers733
views -
3
votes1
answer1358
viewsA: How to save and recover a date field in Sqlite3?
You can use it the way you want, Sqlite gives you this freedom. Some prefer to format the date as character, something like 20160114, others prefer to use the timestamp simple without formatting or…
-
3
votes1
answer506
viewsA: Variable without initializing
The code has an error and some redundancies (I can’t even say that you can do this account more simply x * x, I understand the experience), and I took a line to facilitate in ideone, outside this is…
-
3
votes1
answer690
viewsA: Class to generate CPF does not print on console
Aside from recursion, it worked: import java.util.ArrayList; import javax.swing.text.MaskFormatter; class GeraCPF { private ArrayList<Integer> listaAleatoria = new ArrayList<Integer>();…
-
11
votes1
answer298
viewsA: Find slow point in code . NET
You need a profiler. It’s the only tool that can do it right. Visual Studio does have something. There is official documentation with various details about it. Other tools available: dotTrace. ANTS.…
-
13
votes2
answers7197
viewsA: Advantages of using Object-Oriented PHP? Where to use?
Contextual introduction or TL; DR This response is a democratic and healthy disagreement with the utluiz response. It is necessary to make this clear because some people think that diversity of…
-
7
votes1
answer192
viewsA: Vector start with element greater than 0 (zero)?
In C# I only see a way, create a structure of your own that does this for you. You cannot use anything that already exists directly, array, List, nothing. everything starts from scratch. It may have…
-
7
votes3
answers4752
viewsA: What is the difference between 'Yield' and 'Return' in PHP?
Wallace Maxters' answer is fine, I’m just going to give a slightly different view of the same thing. I see the yield as the cited generator/iterator. It is responsible for maintaining status between…
-
10
votes3
answers1372
viewsA: What is "Object-oriented" and what other methods?
Paradigm In the Wikipedia has an article that explains well what the paradigms are, which is the correct name of what you are calling "method". There are many, just see the table on the right side…
-
6
votes2
answers603
viewsA: ASP Classic runs on ASP.NET server?
Yes, it is possible, because there is no ASP or ASP.NET server, there is the HTTP server that has the ability to run these technologies. In this case, it’s Windows, right? Then it must be running…
-
2
votes2
answers922
viewsA: Error executing file. exe generated by Code::Blocks
Mingw, the compiler that Code::Blocks is using, requires this DLL in the applications it generates in certain circumstances in order to handle the received exceptions. It must follow the executable…
-
8
votes2
answers1705
viewsA: Why does unreachable code Detected error occur in C#?
Don’t worry, the connection will be closed by using. Good, because if it hadn’t been used, there would have been more serious problems with the code. I don’t know if you have other problems because…
-
20
votes1
answer990
viewsA: Is using an empty catch a bad practice?
Yeah. Terrible :) First I would need to see if that really is necessary to throw the exception. I see many cases where the exception is not the most appropriate (see more here and here). This may be…
-
11
votes2
answers995
viewsA: PHP 7 has argument typing and return, but is it optional. Is that good or bad?
Type Hinting What language is doing is putting as much as possible hinting type, or a help for the compiler to check contracts on the use of functions. This helps to detect errors more simply and…
-
7
votes1
answer3875
viewsA: How do I save an image to the database in Sqlite?
That’s effect through a column of guy BLOB which allows arbitrary data in binary format. I would add something like this in the structure: sb.append(" [imagem] BLOB);"); There’s a question in the OS…
-
52
votes5
answers7178
viewsA: What is the advantage of using recursive functions?
Actually recursion is overrated. I realize that the teaching of recursive function is not usually done the right way (in my opinion, of course) when the example always used is to do something that…
-
3
votes1
answer1906
views -
14
votes2
answers8871
viewsA: How and when to use Interface?
It is difficult to say without knowing the specific case and mainly without knowing the requirements, the rules of the business or mechanism. First obvious problems in the code In addition to the…
-
11
votes2
answers1708
viewsA: Is it correct to concatenate PHP in Javascript?
It’s okay to do that, all that’s between <?php ?> and <?= ?> will be interpreted by PHP, the rest is just any text that will be sent to the HTTP server and consequently to the browser…
-
4
votes1
answer142
viewsA: Accessing variables dynamically in C language
Language purely does not give. You have two options: Do right what needs to be done in this case, so instead of creating variables whose index is part of its name, create a variable where the index…
-
6
votes1
answer235
viewsA: How to access hardware on Linux in C?
You don’t access the hardware, you call the API of the operating system. By chance some of them access the hardware for you. Windows and Linux have different philosophies of how to do this. What can…
-
5
votes1
answer163
viewsA: Use php <?= ? > opening tag
Impressively none of the questions already asked on the subject answers this specifically. You can use in any situation, but you should avoid if you want to run in versions below 5.4 on any hosting…
-
8
votes6
answers22035
viewsA: Compute the rest of a decimal division in Javascript
You just figured out what every programmer should know before making a code that deals with money. The "decimal" values are actually binary and are not exact. For much of the things that need…
-
14
votes4
answers10808
viewsA: Is it possible to create a desktop application using only PHP, HTML, CSS and jQuery?
It is possible to use PHP to make real desktop applications, I I did it because I had to, but it got awful and was soon dropped. PHP decided it would be a niche language, and this is good. Or at…
-
2
votes2
answers268
views -
2
votes2
answers153
viewsA: Why does it not read the string matrix?
There may be more problems but the reading pattern is causing the problem. Is there any reason to use it? I took advantage and gave an organized in the code and fix other small problems: #include…
-
26
votes3
answers2857
viewsA: What characterizes a programming language?
The theory The most accepted definition is that the language needs to be Turing-Complete, or that can simulate the Universal Turing Machine to be considered programming. That means any function that…
-
7
votes1
answer356
viewsA: Develop for x86 and x64 platforms
Generally speaking you don’t need anything specific, especially in . Net that turns on which platform you will run. Of course there may be some incompatibilities with things that are external to .…
-
13
votes1
answer628
viewsA: What is C#metadata?
Within the Common Language Infrastructure used by . NET it is foreseen the use of these metadata to give more information about the operation of the applications. This information can be the most…
-
2
votes2
answers627
viewsA: How to save an attribute to image
It depends on what you want to do, if you want the photo to be there, probably the way is to use Image. Even if the photo is stored elsewhere you may want to load it into memory to put in this class…
-
4
votes2
answers102
views