Posts by Maniero • 444,682 points
6,921 posts
-
24
votes2
answers540
viewsA: + 3 overloads - What would that be?
In C there is no overloads (had it ma original question). Only in C++ and C#. This is the overload of methods or functions. Roughly it consists of having a function with the same name but with…
-
9
votes2
answers5043
viewsA: What is the meaning of a "Manifest" file in programming?
It is usually a file with basic data about an application that helps the platform run properly. For each platform may have some specificity, but the basic is to have the name, version, files that…
terminologyanswered Maniero 444,682 -
12
votes3
answers1063
viewsA: What is the difference between System.Web.Http and System.Web.Mvc?
This question was dated, today we can not question any of this, who encouraged the person to stay in the old version induced the person to error. See more in The . NET Framework is dead?. Has more…
-
3
votes2
answers389
viewsA: MD5 is good enough?
Reliability of the MD5 as a single If you want to trust 100% on MD5 to find out if it’s the same, know you can’t trust it. The MD5 can be a basis to already be sure that it is different, it is…
-
3
votes2
answers62
viewsA: Can only use get without the set in Object.defineProperty?
Yes, you can define only one of them according to your need. It is common to define both or only define the get, but nothing prevents you from doing the opposite. Object.defineProperty(obj, 'prop',…
javascriptanswered Maniero 444,682 -
6
votes1
answer446
viewsA: Clang has Character error Too large but Visual Studio builds normal
First: compiling or working is different from being right. Every programmer should have this very clearly. You were right to ask here to understand why it works or not. I don’t have any official…
-
14
votes1
answer528
views -
20
votes4
answers1698
viewsA: Why use C#extension methods?
There is a question that partially answers what is being asked here: Java 8 "default method" versus C# "extend method". I will not repeat here what is already there. Extension method has nothing to…
-
1
votes2
answers286
viewsA: Convert an Ipaddress to string
This property is obsolete. Use the method GetAddressBytes() that will return a array bytes with each part of the IP. Then just give one Join() to form the text. Something like this (using LINQ):…
-
10
votes2
answers2598
viewsA: Can this asterisk pyramid code be further simplified?
Does it give: #include <stdio.h> int main() { for (int x = 9; x > 0; x--) { for(int y = 9 - x; y > 0; y--) printf(" "); for (int y = 1; y <= x * 2 - 1; y++) printf("*"); printf("\n");…
-
8
votes2
answers2280
viewsA: Change Varchar field to Date Mysql
I think I’d better use the right kind, but the problem isn’t even VARCHAR is the content has been saved with the least relevant data before the most relevant. If it had been placed year, month and…
-
29
votes4
answers2216
viewsA: Is there a problem using Java for commercial automation application in dektop? Or is it better to do it for the web using PHP?
All languages have defects. You will read up the problems of various languages in various places. If it is in a place where people like C#, they will hear very badly of Java. And the opposite is…
-
6
votes1
answer1975
viewsA: Calculate square root in C#
Just use the . NET function Sqrt(): if (op2 == null) flag = !flag; else if (operacao != null) { op1 = operacao(op1, op2); op2 = null; flag = true; } operacao = (a, b) =>…
-
5
votes1
answer334
viewsA: Why are you saying this object is null?
The mistake is precisely because the member participantes of the object papelX is null. You cannot try to add anything in nothingness. First you need to initialize that member, probably with a new…
-
5
votes2
answers605
viewsA: Field format for saving time
The correct type of . NET to represent time lengths is the TimeSpan. It is possible to use type Time to store this data, according to this compatibility table. Using . NET 6 forward it is possible…
-
7
votes1
answer842
viewsA: Why does a string assignment in C not work?
The main error is finding that the assignment operator works for strings. Do not give, you need to call the function that copies the characters to where you want (strcpy()). There is still the…
-
13
votes1
answer469
viewsA: What is the purpose of empty parentheses in a lambda statement?
It is to indicate that the anonymous function it represents has no parameter. It was the way you arranged for the syntax not to be lame, since you always have to have something before the =>…
-
5
votes1
answer88
viewsA: How to decide the type of a function?
Actually the function has no type, who has type is the value it returns. This yes is important. The return, as well as the parameters, variables, constants, etc. can and should have any type…
-
9
votes1
answer271
viewsA: Is there a problem assigning a value to a pointer?
This is completely wrong. What this code is doing is to say that the variable inteiro_ptr has the value 4 (then the value 0 when cancels it), therefore it refers to position 4 (5o. byte) of the…
-
12
votes1
answer159
viewsA: How does logic work to figure out the size of the image?
Obviously the file has metadata with relevant information. Normally it is a header with the data, its format varies in each type of image according to some normally public specification so that…
-
12
votes3
answers11758
viewsA: When to use const and when to use #define
They don’t do the same thing. They’re semantically different. Even if they often produce the same result, it’s an eventuality. #define The first is a preprocessor directive code. It is just one text…
-
6
votes1
answer157
viewsA: Library equal to C# 6.0 runtime Interpolation string
It is not necessary any library, the . NET has always had this resource. In fact the interpolation shown is new and few know. This is the first time I meet someone who knows the new resource and not…
-
7
votes1
answer3121
viewsA: Class and interface difference
Classes are complete data structures. They have, or at least can have state and behavior. Then they are composed of several variables and methods including the implementation of the methods. Normal…
-
9
votes2
answers345
viewsA: Values that can be entered as primary key
Is this code unique and will never be changed for each line (entity)? If so, it is a good candidate for primary key yes. Otherwise I would suggest using another, some artificial (surrogate), one id…
-
8
votes2
answers4751
viewsA: How to do Table Test for a particular algorithm?
Each adopts its own technique of doing the table test. I will describe more or less how I do. I create a table with the declared variables, each in a column. Each row in the column will serve to…
-
8
votes2
answers271
views -
8
votes3
answers932
viewsA: Error comparing numbers and checking if they are equal
The code does what you tell it to do, not what you want. In this case you are using the wrong method. o Read() is to read a single character. To read several is the ReadLine(). Then you can think,…
-
5
votes2
answers407
views -
20
votes1
answer4057
viewsQ: What is the difference between statement and definition?
These things seem to be the same thing. Are they? And assignment is different? The terms are interchangeable.
-
18
votes1
answer4057
viewsA: What is the difference between statement and definition?
Statement Declaration is something the code does to show the compiler that an identifier will exist in the code. It can be a variable, function, label, data structures (such as classes, for…
-
8
votes3
answers563
viewsA: What does <!-- //--> mean in html / javascript?
That’s a tag html comment. It starts with !-- and ends with the --. Without that comment the parser HTML can get lost. It is common to use it to "hide" a script Javascript. Only this will be…
-
9
votes4
answers6903
viewsA: Generate random numbers that do not repeat
The simplest and universally accepted solution is to use the algorithm Fisher-Yates which consists of storing all possible numbers, so you have control that they will not repeat themselves, and only…
-
5
votes1
answer894
viewsA: Tryparse error of Datetime converting string in Double format
A method of parse analyzes a text and tries to find something he recognizes there. If he recognizes and can generate a result he will do it. He makes the best possible effort. If the intention is…
-
3
votes3
answers404
viewsA: How to store static information without using a database?
The best way is to use a database. Use the Sqlite and be happy. He has all the advantages he seeks and none of the disadvantages he does not want. Any other alternative of using files on your own…
-
6
votes2
answers212
viewsA: Does the user need to have . NET if I compile using Mono?
Windows Generally speaking, yes. Unless you use .NET Core which allows running any application based on CLR (another reference) without having anything installed. Everything you need goes along with…
-
3
votes2
answers397
views -
3
votes1
answer865
viewsA: Conversion from flowchart to code
Whatever. After all this flowchart is an excrescence :) Thing done by those who are not programmers. Actually flowcharts are horrible. They served well in the '50s/60s in very small code. They even…
-
9
votes1
answer91
viewsA: Type Int8 on Swift does not store maximum integer 255
You can use this to find out the maximum value of a type: print(Int8.max) //vai responder 127 print(UInt8.max) //vai responder 255 I put in the Github for future reference. Int8 is an integer marked…
-
3
votes1
answer240
viewsA: How is a scope block identified in a language like Python?
A language like Python, as well as several functional languages, just to name a few, the delimitation of a block of commands (which can generate new scope or not) is basically indented (the offset…
-
11
votes3
answers2573
viewsA: Is it possible to avoid using ifs in these cases?
Myths You’re learning that the overwhelming majority of the things you read around don’t make sense. At least not without a good explanation that makes sense. If they said something is good or bad…
-
2
votes2
answers176
views -
3
votes1
answer107
viewsA: Is there a distinction between software that has a database or not?
I may be wrong, but I don’t think there is one. The term is generic. There are good and bad definitions out there. This seems very reasonable. You’d actually need to define what a database is and…
-
43
votes1
answer2413
viewsQ: What’s the difference between scope and lifespan?
What is scope? What is life time? They get confused? Visibility has something to do with this too?
-
36
votes1
answer2413
viewsA: What’s the difference between scope and lifespan?
They may get confused in some situations, but they are completely different concepts. There are cases where life time seems to be equal to the scope, so it looks like it’s the same thing. Scope This…
-
3
votes1
answer159
viewsA: Improve the performance of a pointer method
Before anything else do crazy things that "work" is not programming. Doing what is right is programming. Working is not a parameter to know if it is right. I will not say whether it is right or not…
-
1
votes1
answer63
views -
4
votes2
answers89
viewsA: Access internal C#/. NET code structures
Microsoft provides a dedicated website for code consultation with easy navigation. One of several implementations of First(), for example. No .NET Core. In addition it is possible to see the…
-
6
votes1
answer493
viewsA: Finding out which value is higher
Going by parts The code runs in parts. First it calculates some parts to get a boolean result: $dataInicio->format('d/m') //resulta em "14/06" "16/06" >= "14/06" //resulta em true porque são…
-
12
votes1
answer292
viewsA: What is the difference between "using" and "using Static"?
This is possible from C# 6. You can use using static to import static classes or static members from other classes, so all of its public members are available for direct use without needing the…
-
7
votes2
answers321
viewsA: Are static classes shared by threads?
Yes, they are shared throughout the application, independent of threads. For this reason static data are inherently nay thread-safe. One of the reasons it is often said to avoid its use, or when it…