Posts by Maniero • 444,682 points
6,921 posts
-
5
votes1
answer210
viewsA: What is a static website generator?
There is a huge amount of tools like this, some are very sophisticated CMS, with the difference that the page to be viewed is not created at each request as is common. Think about it, if a page…
-
3
votes2
answers1285
viewsA: Number of simultaneous requests a PHP server supports
They don’t. Simultaneous only the amount of existing processors. There is an illusion of simultaneity, as occurs on your computer now. It has hundreds or thousands of processes running and it seems…
-
2
votes2
answers248
viewsA: What is the best method to access a class member?
Each one does something different so the comparison gets complicated. The best is the one that meets you in the specific need of that moment. cMinhaClasse *mClasse = new cMinhaClasse(); Here is…
-
3
votes3
answers97
viewsA: How to write times on console entries without repeating too much code
You can do this (each line in a very different place, it’s not a sequential code): using static System.Console; private static DateTime data = DateTime.Now;…
-
3
votes2
answers177
viewsA: Near and Far pointer error in C code
Throw away this book. He talks about a non-standard C for an architecture that is no longer used, as well as containing several errors, nor wasting time with it. Adopt a modern and correct book.…
-
6
votes1
answer122
viewsA: Treatment of exceptions of different types
There is, yes, the first changes the stack trace, the second no. The first one intercepts the exception thrown and throws another exception there. The content may be the same, but the location is…
-
7
votes1
answer837
viewsA: Print sequence of numbers repeating in arithmetic progression
You have two problems. , The loop should start from the 1, after all if each number should be repeated the number of times it itself, has no why to print the 0, and was also printing the counter and…
-
6
votes1
answer172
viewsA: What is the role of parameters?
To parameterize information, to generic something that would be specific, to give variability to an algorithm with unknown external data at that location, is to establish a communication point…
-
1
votes1
answer499
views -
4
votes1
answer214
viewsA: Mysql connection security using PDO, am I doing right?
The problem of security is not in connection, it is in general use. The biggest problem that most applications have directly related to the database is the injection of SQL, then it is in the…
-
2
votes2
answers86
viewsA: Change type of return
It does not, if the signature of the method is different then they are completely different and there is no inheritance between them unless the guy is covariant, which is not the case. If there will…
-
10
votes1
answer115
viewsA: Why is the expression (double.Minvalue == double.Minvalue + 1) true?
First read What is the correct way to use the float, double and decimal types?. Ali says that it is not possible to represent all numbers in binary format. Then some numbers are taken by…
-
5
votes2
answers3537
viewsA: What is the function of the «??» operator (two questions) in PHP?
Same as in C# and other languages, is the null-coalescing, but since null is a confusing concept in PHP, the check is whether the variable exists. It’s the same as writing: $valor =…
-
13
votes4
answers2092
viewsA: Null values in PHP
See in itself documentation. This is a null: $valor = null; This is a string empty, nothing at all: $valor = ""; So compares null, only one string empty is null too, is a complete non-sense, but PHP…
-
4
votes2
answers398
views -
8
votes1
answer2473
viewsA: Is it possible to create a site with HTML and C# without ASP.NET?
Yes, HTML is default. CSS is also almost mandatory in practice. JS will probably be used. All this on the client side. On the server side you can use virtually any language. C# is one of them, and…
-
7
votes2
answers319
viewsA: Is it possible to create a website without markup language?
Yeah, but it doesn’t make any sense. You see, make a minimum, and I kind of like the idea in web application, but for a site that needs to be used under universal web conditions, which needs…
-
13
votes2
answers1034
viewsA: Why does the absence of the suffix L cause the long variable to be interpreted as int?
Why the language creators decided so. No better explanation :) It’s in the specification. In fact what is declaring there is a literal int which is made a cast by the compiler implicitly. So it is…
-
1
votes2
answers73
viewsA: Create folder on every console usage
If the name is the same it will not be created and will not erase anything, nothing will be done, nor will it make a mistake. I improved a little, but this code is still bad. using System; using…
-
3
votes2
answers3813
viewsA: How to truncate decimal in X decimal places?
Supports yes, see the documentation. There you have without the parameter of decimals, with this information and even as the rounding criterion should be. Math.Round(valorDecimal, 2); If what you…
-
5
votes2
answers324
viewsA: Firstordefault, Singleordefault, Elementatordefault
The versions without the Default make an exception if you find zero elements in the adopted criterion, so it should be used when there is certainty that it has at least one element. That is, if it…
-
3
votes2
answers1825
views -
2
votes2
answers136
viewsA: Scan more than one string
#include <stdio.h> int main(void) { char pal1[100], pal2[100]; scanf("%s %s", pal1, pal2); printf("%s - %s", pal1, pal2); } Behold working in the ideone. And in the repl it.. Also put on the…
-
5
votes1
answer3980
viewsA: In which cases return the System Exception error.Outofmemoryexception
It’s basically a lack of memory. It occurs more on 32-bit machines that can have applications of up to 2GB in total, in 64-bit it is less common but also has limit, and it is usually very slow…
-
2
votes1
answer185
viewsA: Class declaration in C#
Classes can be declared as public, private, or internal implicitly if nothing is described in the code. Contrary to what many people think a class without explicit visibility is not public, it is…
-
4
votes2
answers754
viewsA: Loop for ATM
You need to make a loop by adding an output condition. I chose to let the person type a negative number to leave, after all in the current form it would not make sense to accept a negative number. I…
-
1
votes1
answer41
viewsA: Comparison between Objects always returns false
Because Object is a type by reference, so the comparison is with the addresses of the objects and not with the values that are within them. Since they’re two different objects, they’re different…
-
4
votes2
answers590
viewsA: Is it possible to develop a C++ application in Visual Studio to run on Linux?
If it’s a good one it’s a matter of opinion and I’ll abstain. It’s possible, and a lot of people do. Microsoft’s C++ meets the C++17 standard (the last of this year) by almost 100% and, if I’m not…
-
15
votes1
answer386
viewsA: What is and how does the repetition of the for in C#?
This is the beginning of a repeat loop with an initialization, a condition that indicates the ending of the loop and a step that must be executed in each interaction. for () It is the keyword that…
-
3
votes2
answers1091
viewsA: Operation of the new operator
There is a huge difference between C++ and D. D creates classes always by reference and allocates in heap managed. In C++ a class is just a structure (struct) whose members are private by default,…
-
1
votes2
answers333
viewsA: Single variable declaration for scanf
There is not much to do. I will demonstrate to the more organized and with fewer lines, in addition to fewer characters. Note that the scanf() nay variable declaring some. In fact the scanf() nor…
-
3
votes1
answer327
viewsA: Batch create operating system (.bat)
It is not possible for a simple reason, to rotate a batch script needs an interpreter who needs an operating system. A simulation, something complementary to a basic made with other technologies but…
-
3
votes5
answers7921
viewsA: How to properly format CPF in Python?
It’s that simple: test = input("CPF: ") cpf = test[:3] + "." + test[3:6] + "." + test[6:9] + "-" + test[9:] print(cpf) Behold working in the ideone. And in the repl it.. Also put on the Github for…
-
3
votes3
answers141
viewsA: Isolate processor to run only my program
This is not possible in "normal" operating systems, the operating system controls this. What you can do is ask for high priority for the operating system, which will deliver as it wants. You can…
-
2
votes5
answers9375
viewsA: Program to find MMC in Python
I think this code is wrong, but if you’re gonna do it like this, then do it like this: num1 = int(input("Digite um número inteiro:")) num2 = int(input("Digite outro número inteiro:")) maior = num1…
-
8
votes4
answers1502
viewsA: How to inherit more than one class in PHP?
Can not, almost no language allows and even those that allow is problematic. There is the possibility of using interfaces (see also) defining contracts and making a kind of multiple inheritance,…
-
2
votes1
answer667
viewsA: How to prevent a variable from going negative in Java?
Basically create a condition that prevents this: public void decrement_item(View view) { if (quantity_item > 0) { quantity_item--; display_item(quantity_item); } } I could also do something like…
-
10
votes4
answers151
viewsA: How to build a class correctly with access methods?
This is so wrong. My suggestion is to focus on the fundamentals, on doing the procedural very well, when you see that you need it and realize that you already know the basics so think about OOP…
-
8
votes2
answers674
viewsA: Remove an N amount of days on a date
There is no method of subtraction, but just use a mathematical trick with the method AddDays(): using System; namespace TesteData { public class Program { public static void Main(string[] args) {…
-
5
votes2
answers753
viewsA: Daylight saving time with old dates
There is confusion in the question and comments. A time as we say informally is a point in time. It exists in a unique way. Time is something astrophysical, it has no time zone. That is why it is…
-
2
votes2
answers2246
viewsA: How to print from a web application to a local printer with C#
The server side you can do as you please as long as it serves the information you need the way you need it. Particularly I avoid making web because it has disadvantages. It’s fashionable that people…
-
8
votes2
answers233
viewsA: When I type broken number, it removes the comma and sums as integer
Probably need to resolve the issue of culture. Anyway various errors can occur in typing. If can’t convert properly can’t let do account. using static System.Console; public class Program { public…
-
2
votes2
answers672
viewsA: Allocation overflows memory in recursive function in C
It is programming error and stack crash because recursion has no end. If it switched to a loop and worked, it is because the loop has a condition that terminates it, otherwise it would have no end,…
-
16
votes4
answers1016
views -
6
votes1
answer125
viewsA: Return of the clean catch code
A practical example of how to eliminate an exception treatment and simplify code and give more performance: public static void main(String[] args) { String nome = null; //obviamente que é só para…
-
3
votes1
answer45
viewsA: Struct presenting problem
State the structure before using it. #include <iostream> using namespace std; struct produto { char nome[21]; float valorvenda; }; int main() { produto prod1 = { "Caneca", 5.00 }; cout…
-
3
votes4
answers819
viewsA: How to make a function to tell when an array is empty?
You got it ready: function validaCampo() { if (dias.length == 0) { alert("O Campo Dias disponíveis é obrigatório!"); return false; } return true; } I put in the Github for future reference.…
-
1
votes3
answers866
viewsA: Entering numerical data in the database
The first thing you need to change is the correct type in the code. Started doing well in the database, keep this in the code: public class Modelo { public float Valor { get; set; } } Then do it:…
-
12
votes2
answers5550
viewsA: What is the difference between website and web application?
Website is a content of publicly exposed pages of interaction with the user in general indexed by search engines with institutional content, informative and limited interaction with existing pages…
web-applicationanswered Maniero 444,682 -
1
votes2
answers51
viewsA: How to inform data in a vector
You should use a variable as an index just as the name itself says the index will vary with each passage through the loop. In the case what is varying according to the loop is the variable i. It has…