Posts by Maniero • 444,682 points
6,921 posts
-
20
votes2
answers13387
viewsQ: What is the difference between "NULL", "0" and 0?
Both are worth zero. I can use the 3 interchangeably always?
-
20
votes2
answers13387
viewsA: What is the difference between "NULL", "0" and 0?
All 3 are constant literals worth 0, that’s correct. 0 0 is a numerical value and can be used whenever you need the same zero number. In some places it ends up being used for other things. Where a…
-
5
votes1
answer10908
viewsA: What does a double precision variable mean?
Usually called double, is the variable that stores a number of floating point with space to indicate larger numbers, either in the whole part or in the decimal part. He is the "brother" of the type…
-
24
votes1
answer805
viewsA: In what language was HTTP written when implemented on the Web?
English. Protocols are specifications, therefore not written in programming languages. Implementations of protocols can be written in programming languages and may be written in any language. You…
-
2
votes1
answer783
viewsA: What is the problem with this code that takes the highest and lowest value?
You have two problems. You need to initialize the smallest number with a number that is the largest number to ensure that it will not be caught unless the smallest number typed is itself. This can…
-
8
votes3
answers3514
views -
7
votes1
answer112
viewsA: Tables with unconventional names like ABC1234
This was a technique used in the 1970s, there was a limit of possible characters and giving meaningful names was not a priority, it was better to use codes. It had some meaning back then, but not…
-
5
votes1
answer867
viewsA: Use of arrow keys to generate movement in play
This code has nothing C++, is very bad and I would not waste time with it. Learn with good codes. It uses bad techniques, bad style, is confusing, uses what is not available in all compilers, I…
-
11
votes2
answers3515
viewsA: What is the difference of an empty string and NULL in SQL?
To string empty is a text that has zero characters, but it’s a text. The null is the value indetermination. Not a text has there. Some think it’s value-free, but a null is a value. And so it’s…
-
7
votes1
answer426
views -
12
votes1
answer9161
viewsQ: What is Segmentation fault?
This error often occurs in code with problems. I don’t see it occurring in other languages. Why does it occur? What does it mean?
-
14
votes1
answer9161
viewsA: What is Segmentation fault?
This occurs by accessing an unauthorized memory point for your application. When your application is running, the operating system frees access to virtual memory. Contrary to what many people think,…
-
5
votes3
answers566
viewsA: Same types but with different objects. What is the best way to use it?
First point: you should think 10 times before cloning an object. It is usually problematic to do this and almost always not necessary. If the object was thought to be cloned it will implement the…
-
19
votes3
answers703
viewsA: Can I remove all the using I’m not using?
You can. The directive using (not to be confused with the command using which is used to free up resources) is only one way to avoid very large readings and typing. Visual Studio indicates what can…
-
3
votes3
answers150
viewsA: Database modeling, when it is possible to denormalize
Generally speaking the ideal is normalize. Until I have a reason not to. I I have already responded to this in general terms. There will never be more than 5 prices of competitors? I believe there…
-
6
votes1
answer75
views -
5
votes1
answer75
viewsA: Is it interesting to create a guy just for a pointer to a guy?
It’s all about semantics. What’s the point of your code? Should he know there’s a pointer there? So leave the pointer exposed and do not create a type to render the pointer opaque. Creating a type…
-
4
votes2
answers1332
viewsA: Are Quias the differences between Web App, Native App and Hybrid App?
Web App Web App is the application made for rotate in a browser normal internet. It can even be SPA, but it will still be like a website, using HTML, CSS, JS, etc. today pe JS is not so necessary,…
-
9
votes1
answer152
viewsA: Sealed class, with private constructor, versus Static class
The main difference is that the static class cannot even be instantiated. A normal class with private constructor just doesn’t let any code out of the class instantiate it, but it can be…
-
15
votes1
answer311
viewsQ: How does the switch work behind the scenes?
Seeing those comments on the use of switch is the doubt how it really works and why it is different from the if when only buy for the equality of a single variable against a sequence of values. How…
-
14
votes1
answer311
viewsA: How does the switch work behind the scenes?
How it works is implementation detail, it is not specified and you cannot use it to do something that only works if it is implemented in a specific way. What we do know is that the compiler does the…
-
5
votes5
answers1664
viewsA: I want to put the number of characters and put whether it even or odd
I believe you want this: using static System.Console; namespace Impar_ou_parr { public class Program { public static void Main(string[] args) { WriteLine("Digite uma Palavra: "); WriteLine($"Sua…
-
11
votes1
answer153
viewsA: What is an equal input parameter (allocation operator)?
Note that this is not equality, is the allocation operator. This is a parameter with default value (default). If no argument is passed to fill it, this value is used in this variable. It assigns a…
-
9
votes1
answer542
viewsQ: Why do we use parentheses in a pointer statement?
What is the difference between these two statements? int* array1[10]; int (*array2)[10]; Why are there parentheses in the second?
-
10
votes1
answer542
viewsA: Why do we use parentheses in a pointer statement?
We can see that both are arrays. int* array1[10]; It’s a case where the array will have as data elements of type "pointers to int". Then memory addresses will be stored in it. The value of each…
-
15
votes2
answers23324
viewsA: Count the number of occurrences of a value in a list
You can use the Counter: import collections numeros = [5, 3, 1, 2, 3, 4, 5, 5, 5] repetidos = collections.Counter(numeros) print(repetidos[5]) Behold working in the ideone. And in the repl it.. Also…
-
11
votes2
answers7582
viewsA: How to capture the last element of a list in Python?
Just take the negative index. It goes for any element, not just the last one. The idea is that it’s actually catching the length plus that value, as it is negative, it will pick up backwards.…
-
12
votes1
answer1550
viewsQ: Why can’t you declare a variable within a case?
Why don’t you compile? #include <stdio.h> int main(void) { int valor = 0; scanf("%d", &valor); switch (valor) { case 0: int variavel = 1; printf("%d", variavel); break; default: int…
-
13
votes1
answer1550
viewsA: Why can’t you declare a variable within a case?
A very common mistake is for people to think that the case is a command block and generates a new scope. Actually case is just one label. So it’s just a name for an address of the code used to cause…
-
5
votes3
answers2170
viewsA: How to compare two List and delete repeated fields?
If I understand correctly, with LINQ is the simplest way: lista2 = list1.Intersect(list2).ToList(); I put in the Github for future reference.…
-
6
votes2
answers106
viewsA: Attribute href exclusively for goal <a></a>?
Is incorrect in li. You can already see that it does not work in the question example. This attribute is specified as belonging to some tags, as <a>, <area>, <base> and…
-
3
votes1
answer701
views -
10
votes3
answers4250
viewsA: What is the purpose of the "header()" function?
What is the purpose of the header function()? Just mount a header for the HTTP package that will be transmitted in that request. By default it generates a basic with the minimum necessary, if you…
-
6
votes1
answer380
viewsA: Why use two server-side languages on the same system?
These decisions usually occur mostly for the reason you’ve already identified. They started with one technology and identified that another could be more useful for some tasks. And it is common not…
-
2
votes2
answers150
viewsA: What is the difference between public async System.Threading.Tasks.Task<Actionresult> Index() and public Actionresult Index()?
The difference is that the first can be executed asynchronously, so it will not block the execution of the application if the method takes too long. In general you will have a await within this…
-
6
votes3
answers230
viewsA: Reduce code repetition with loop creation (loop)
Just create the loop that will vary the numbers. The loop control variable will be used as part variable... (guess?) code variable, so everything that is repeated can be optimized: for (var i = 0; i…
-
3
votes1
answer99
viewsA: What is the usefulness of the "Add Fakes Assembly" feature?
You know what a Fake? Has documentation on the subject. So adding this Assembly is enabling the project to be testable with a mechanism that simulates the most complex mechanisms that are not…
-
4
votes2
answers66
viewsA: Storing data that can be accessed outside the database itself, goes against the 1st Normal Form?
Storing in a separate table in your database would not violate the first normal form. This normalization does not impose anything that information should be somewhere outside, it refers to the…
-
12
votes3
answers890
viewsA: Is it wrong to use more than one <thead>, <tbody> or <tfoot> in a table?
<tbody> yes, but <thead> and <tfoot> is not allowed by the HTML5 specification (the same was true for the HTML4). In this order: Optionally a caption element, Followed by zero or…
-
9
votes1
answer450
viewsQ: What’s the comma for?
The comma is what? Just a language construct? An operator? Because it exists? This question is based on what was seen in How to return or extract more than one value from a function?. return base2,…
-
9
votes1
answer450
viewsA: What’s the comma for?
This holds true for most languages that were based on the same C syntax principles. The comma is an operator that serves to separate and evaluate expressions can form a list, which is still a larger…
-
4
votes3
answers151
viewsA: Separate bytes that form an integer number?
You can use bit operations for this, without touching too much what you were doing: local function sepbytes(num) local t = {}; local byte = 0; repeat table.insert(t, 1, bit32.band(bit32.rshift(num,…
-
10
votes3
answers6900
viewsA: What’s the difference between Return and break in a switch case?
The break, only closes the execution of switch and goes to the next instruction after it, it is essentially the same that occurs in a loop. The return doesn’t do anything special inside the switch,…
-
3
votes2
answers759
viewsA: Understanding parameters and arguments in functions
When does function funcParm() { $foo = "parâmetro"; echo "$foo"; } in practice is making a procedure and not a function, despite being declared so. Why have a procedure? Avoid code repeats, or at…
-
3
votes2
answers72
viewsA: Composite allocation operator
How much is 0 multiplied by any value? It’s 0, right? So it’s explained. Pure mathematics. How much is 0 divided by any amount? Also 0. Programming follows the mathematical rules. If you put 1 in $r…
-
3
votes2
answers614
viewsA: It takes time to count records the first time
Without a proper record it is normal. and needs to be done fast so create an index for it. It will probably solve if using con_codigo_fk and mcon_data in the key. CREATE INDEX…
-
9
votes1
answer855
views -
6
votes1
answer855
views -
14
votes2
answers5495
viewsA: What are Async methods?
They are methods that can run asynchronously, IE, who called does not need to wait for its execution and it can continue normally without blocking the application, So when the asynchronous method…
-
3
votes3
answers82
viewsA: Error while traversing vector
You created a vector with 3 elements and even started well in the first loop going until reaching its size, although in this very specific case you do not need to do this. But then it was up to 3.…