Posts by Maniero • 444,682 points
6,921 posts
-
2
votes3
answers159
viewsA: Doubt about the lower value of banknotes
This algorithm is very complex and has a lot of unnecessary things. And I would use it like this: #include <stdio.h> #include <limits.h> #define NUM 5 int main(){ float notas[NUM]; float…
-
10
votes2
answers3382
viewsA: What are the states of a thread?
If it is specific to Java it is easy to find out since the states are defined by an enumeration, then it has all in the documentation of Thread.State. NEW - it has been created and is ready to start…
-
9
votes2
answers6664
viewsA: How to create and manipulate lists in PHP?
Is the array even normal. The array PHP is not a array as we know in other languages. They are lists by definition. Remember that PHP is a language of script, it is not made to have the best…
-
31
votes2
answers8678
viewsA: What is NPM and Node?
Nodejs Nodejs is a Runtime which allows the execution of Javascript code outside the browsers. It can be used inside other applications or even alone. It is an environment that functions as a…
-
2
votes3
answers682
viewsA: What is the difference between Smtpclient.Sendasync and Smtpclient.Send() using Thread?
The two methods produce the same result. The difference is only in the way you do it. One of them blocks the thread where it is called. The technique used in such cases is to create a thread…
-
18
votes2
answers21759
viewsA: What are the main differences between Unicode, UTF, ASCII, ANSI?
ASCII American Standard Code for Information Interchange. As the name already says is a standard that suits Americans well. It goes from number 0 to 127, and the first 32 and the last are considered…
-
6
votes2
answers199
viewsA: Is there any difference between the ways of declaring classes in C++?
Put everything into header The great advantage is to enable better optimizations. If you want implementations to be inline have to do this. The same goes for the use of templates that there’s always…
-
7
votes2
answers1010
viewsA: Does the use of traits replace the role of multiple inheritance?
In a way yes. Not entirely because a trait can not have been. But you can get subtype and subclass of various types with it. Name conflicts If the class has an implementation of the method it will…
-
11
votes2
answers688
views -
3
votes2
answers953
viewsA: It is wrong to use common variables within a PHP class
It is wrong to use common variables within a class? It’s not about being wrong, it’s just not allowed. It is an erroneous form of POO? What? Using variables that look like locations in the class?…
-
9
votes2
answers354
viewsA: How do C#properties work?
In C# what you call an attribute is treated as a field, since attribute is something else in language (something similar to the Java annotation). In fact after study I saw that in almost all…
-
1
votes1
answer50
viewsA: Alert Resharper Access to modified closure
See this code to better understand: using static System.Console; using System; using System.Collections.Generic; public class Program { public static void Main() { var lista = new…
-
5
votes2
answers230
viewsA: Direct cast or cast functions. What is the best option?
Given that function calls often consume more resources than using a language constructor or cast operator This is false, at least conceptually speaking. A language construct can be quite complex.…
-
12
votes2
answers1435
viewsA: A game-specific programming language
None serious with the requirements placed in the question. There’s even a toy language that makes it easier to create games, but you can only do really gross things. It’s practically for children to…
-
17
votes2
answers1493
viewsA: What can I do in . NET Framework and . NET Core not? And vice versa
This question makes little sense now because the . NET Framework died, only left . NET Core, which happens to be called .NET. Mainly the completion of this answer no longer matters more. There’s a…
-
41
votes2
answers3637
viewsA: The first programming language
TL;DR Some statements in the question use contemporary premises. You have to abandon all this to understand the functioning of the "old" computers. And I doubt that anything succinct will give a…
-
3
votes2
answers144
views -
7
votes1
answer972
viewsA: How do they represent complex numbers in C?
It would be by including complex.h: #include <stdio.h> #include <complex.h> int main() { double x = 1.0; double y = 2.0; double complex z = x + y * I; printf("%.2f %+.2fi\n", creal(z),…
-
12
votes2
answers454
viewsA: How to convert Float to String using LINQ for Entity?
You can use the SqlFunctions.StringConvert(), it will be converted to proper SQL code: ChaveArquivo = StringConvert(n.scanIma.Imagem) I put in the Github for future reference. This answers the…
-
1
votes1
answer7041
viewsA: Function that counts number of vector elements
The second code in for appears to be a "vector" in fact. And its total size must be known. The first code in the function is just a pointer. It has its known size, i.e., it is the size of the…
-
7
votes1
answer334
views -
4
votes1
answer91
viewsA: Generator x Sequence in Firebird
It’s exactly the same. GENERATOR was the old syntax that is still accepted, but should be preferred SEQUENCE which is more SQL standard. This feature is used to create single and sequential identity…
-
3
votes1
answer51
viewsA: Unsigned modifier for integer type in C
No, C doesn’t work like that. C is a language designed to be a higher-level assembly. So the language should allow the user to do unsafe things. C is a weakly typed language. Not to be confused with…
-
2
votes1
answer441
viewsA: Understanding structures in the Assemblyinfo.Cs file
In fact they are called attributes. They are basically annotations that can be used in several contexts. In this case it is created metadata to inform and configure how the Assembly will behave. It…
-
3
votes2
answers507
viewsA: Doubts about the compilation and "linkage" phase of a C-Program
The #include is something that only serves the compiler. You already have question speaking of, there’s no need to repeat here. I have already answered in general terms how a compiler works. The…
-
10
votes3
answers23806
viewsA: Size of a String
Let’s conceptualize correctly. Variables are spaces reserved to store something. Just that, nothing more than reserved somehow. This variable will store 4 bytes in memory. If the intention is to…
-
11
votes4
answers549
viewsA: Problem with polymorphism
I don’t know what the purpose of the AP is, but I shouldn’t do this, nor as a learning experience. Learning is doing right. Unless I wanted to prove it wrong. From the point of view of OOP all this…
-
4
votes1
answer504
viewsA: How to "concatenate" Javascript functions?
This is called interface Fluent or method chaining. Or at least it’s a similar way. The basic technique is to return the very object being manipulated, the this. The return something that can be…
-
3
votes1
answer106
viewsA: Understanding #line directive
Are you saying that the code this.Startup += new System.Windows.StartupEventHandler(this.Application_Start); will appear as being on line 5 in the file ..\..\App.xaml, no matter which line is…
-
6
votes2
answers235
viewsA: What does the _t suffix mean and when to use it?
It is a convention indicating that that name represents a type of data (t of type). It is used not to be confused with other code identifiers. As far as I know it was created to avoid conflicts with…
-
1
votes1
answer300
viewsA: Reporting - Consistency of data when prices are changed
We have no way of telling which one is right for you. We can evaluate the options abstractly. The second option, blocking operations, is completely meaningless. It is an alternative, but is to…
-
8
votes2
answers422
viewsA: Application server
I don’t know if this is in the scope, but it can partially answer and I think it will be useful. do not want to host the system in a data center or in the clouds I don’t know the specific case, but…
-
8
votes3
answers4855
viewsA: Usefulness of #pragma
I start talking about it in In C/C++, what are build directives for? When should I use them?. All of these are used by the Microsoft compiler, so far as I know exclusively, therefore not portable.…
-
2
votes3
answers399
views -
3
votes2
answers472
viewsA: MVC and DAO - Data Rules
This is always very controversial, everyone has an opinion. Some people like the anemic model then they will talk to put in the controller. But this is a conceptual error. The correct is in the…
-
5
votes1
answer96
views -
2
votes1
answer74
viewsA: Is there Smtpclient.Timeout with infinite value?
By "lucky" can not. It makes no sense to do this, but if you want to do wrong can use the time int.MaxValue, will give almost a month. If you need this you may have another problem. If one sending…
-
8
votes2
answers291
views -
4
votes2
answers1115
viewsA: Treatment of exceptions in C++
There are some possible solutions, even no exception. If the construction of the object has a contract that generates an exception when the creation fails you have to capture the exception and…
-
2
votes1
answer112
views -
4
votes1
answer239
viewsA: How do I get rid of these warnings
I tidied up the variables that were being sent with & and are already pointers. I put returns in functions (kicked a value just to end Warning), made use of the variable aux and assigned values…
-
3
votes1
answer624
viewsA: How to truncate text without cutting words . NET?
The secret is to use the LastindexOf(' ') to find out where the last space is. It would be something like this in C#: if (text.Length <= length) { return text; } if (length <= ellipsis.Length)…
-
4
votes1
answer101
viewsA: Send email without it appearing in the mailbox
The technology being used is to connect to an SMTP server and send the message. Nothing more. There is no way to control how the provider will manipulate the messages. In the case of Google I know…
-
5
votes1
answer3201
viewsA: How do I know the address of each vector position in C?
To get the vector address just use its own variable. The point is that the placeholder of formatting of printf() correct is the %p to receive a pointer. This will require a cast (void *) (generic…
-
6
votes2
answers907
viewsA: How to work with lock in SQL records?
If that’s what it is, you’d better use it LOCK. But this mechanism very rarely should be used. The normal thing is not to want it to be stuck. It can be stuck for hours, days, it is not what you…
-
3
votes2
answers252
viewsA: Error comparing two C strings
The code has several flaws and does not even closely what you are asking in the question. I will try to fix. Note that the statements of arrays can be made to the size they are needed. This gives…
-
2
votes2
answers5533
viewsA: Return string in C for manipulation outside the function in which it was declared
The correct is to always allocate the necessary memory where you need it and pass this address to anyone who will manipulate it. In exercises the allocation of a array in the stack it’s not usually…
-
8
votes1
answer1270
viewsA: Calculate cubic root
The correct formula for obtaining the cubic root is: Pow(primeiro, 1.0/3.0) Behold working in the ideone. And in the .NET Fiddle. Also put on the Github for future reference. Note that this…
-
6
votes2
answers1284
viewsA: Are there differences between Post and Request?
The request is a generic way of referring to the subject, we can use the translation which will be as well or better understood as it is a request for information to the server. There are several…
-
3
votes2
answers198
viewsA: Windows Blibiotecas to use in Assembly
All* to Windows API is provided in C. Then you have to use these libraries. You can also refer to Docs in general. The bulk of the learning should be on top of what you have for C. As said that…